Quiz-1
Q 1.
size of union is size of the longest element in the union / संघ का आकार संघ में सबसे लंबे तत्व का आकार है
- Yes
- No
- May Be
- Can't Say
Q 2. Members of a union are accessed as___?. / एक संघ के सदस्यों को ____ के रूप में एक्सेस किया जाता है।
- union-name.member
- union-pointer->member
- Both a & b
- None of the mentioned
Q 3.
The size of the following union, where an int occupies 4 bytes of memory is / निम्नलिखित संघ का आकार, जहां एक इंट मेमोरी के 4 बाइट्स रखता है:
union demo
{
float x;
int y;
char z[10];
};
- 8 byte
- 4 byte
- 10 byte
- 18 byte
Q 4. The size of a union is determined by the size of the __________ / एक संघ का आकार __________ के आकार से निर्धारित होता है
- First member in the union
- Last member in the union
- Biggest member in the union
- Sum of the sizes of all members
Q 5.
Which among the following is never possible in C when members are different in a structure and union? / निम्नलिखित में से कौन सी में कभी भी संभव नहीं है जब सदस्य संरचना और संघ में भिन्न होते हैं?
Let P be a structure
Let Q be a union
- sizeof(P) is greater than sizeof(Q)
- sizeof(P) is less than sizeof(Q)
- sizeof(P) is equal to sizeof(Q)
- None of the above
Q 6. Which of the following comment about Union is false? / संघ के बारे में निम्नलिखित में से कौन सी टिप्पणी असत्य है?
- Union is a structure whose members share same memory area
- The compiler will keep track of what type of information is currently stored
- Only one of the members of union can be assigned a value at particular time
- Size allocated for Union is the size of its member needing the maximum storage
Q 7.
union test
{
int x;
char arr[4];
int y;
};
int main()
{
union test t;
t.x = 0;
t.arr[1] = 'G';
printf("%s", t.arr);
return 0;
}
Predict the output of above program. Assume that the size of an integer is 4 bytes and size of character is 1 byte. Also assume that there is no alignment needed. / उपरोक्त कार्यक्रम के आउटपुट की भविष्यवाणी करें। मान लें कि एक पूर्णांक का आकार 4 बाइट्स है और वर्ण का आकार 1 बाइट है। यह भी मान लें कि संरेखण की कोई आवश्यकता नहीं है।
- Nothing is printed
- Garbage character followed by 'G'
- Garbage character followed by 'G', followed by more garbage characters
- Compiler Error
Q 8. What is the similarity between a structure, union and enumeration? / एक संरचना, संघ और गणना के बीच समानता क्या है?
- All of them let you define new values
- All of them let you define new data types
- All of them let you define new pointers
- All of them let you define new structures
Q 9. Which of the following keyword is used for union in c language? / सी भाषा में संघ के लिए निम्नलिखित में से कौन सा कीवर्ड का उपयोग किया जाता है?
- un
- unt
- ion
- union
Q 10.
What is the output of the following C code(on a 64 bit machine)?
union Sti
{
int nu;
char m;
};
int main()
{
union Sti s;
printf("%d", sizeof(s));
return 0;
}
- 8
- 5
- 9
- 4