MCQ-5 Structure
MCQ-5 Structure
MCQ-5 Structure
2. A short integer occupies 2 bytes an, ordinary integer 4 bytes and a long
integer occupies 8 bytes of memory
If a structure is defined as
struct TAB{
short a;
int b;
long c;
}TABLE[10];
the the total memory requirement for TABLE is
A. 14
B. 140
C. 40
D. 32
{
char name[20];
int sex;
struct addr locate;
}criminal, *kd=&criminal;
The third character in the criminal name can be accessed by
A. criminal.name[2]
B. kd—>name[2]
C. ((*kd).name)[2]
D. All of these
9. Assuming that bit-fields are accomodated from right to left and word size is
16-bits
Consider the declaration
static struct
{
unsigned a : 5;
unsigned b : 5;
unsigned c : 5;
unsigned d : 5;
} v = (1, 2, 3, 4);
information about d will be in the
A. first word
B. second word
C. in both words
D. none of the above
10. Assuming that bit-fields are accomodated from right to left and word size
Page (4/7)
is 16-bits
Consider the declaration
static struct {
unsigned a : 5;
unsigned b : 5;
unsigned c : 5;
unsigned d : 5;
} v = (1, 2, 3, 4);
If the declaration unsigned c : 5; is replaced by unsigned : 6; then,
A. it results in a syntax error
B. it is meaningless
C. The compiler will give a new name for the field, which can be used in the
program
D. none of the above
14. the changes made in the members of a structure are available in the
calling function if
a) pointer to structure is passed as argument
b) structure variable is passed
c) the member other then pointer type are passed as argument
d) both option a and c
b) Only option 2
c) Both option 1 and 2
d) Neither option 1 nor 2
}u;
print sizeof( s ) and sizeof( u ) if sizeof( int ) = 4 and sizeof( long ) = 4.
a) sizeof( s ) = 8, sizeof( u ) = 4.
b) sizeof( s ) = 4, sizeof( u ) = 4.
c) sizeof( s ) = 4, sizeof( u ) = 8.
d) sizeof( s ) = 8, sizeof( u ) = 8.
21. The size of the following union, where an int occupies 4 bytes of memory is
union arc
{
char x;
int y;
char ax[8];
}aha;
a) 16 byte
b) 13 byte
c) 8 byte
d) 4 byte
Page (7/7)