C - Structure and Union Questions and Answers
Practice ModeShowing 10 of 51 questions
Q31
A bit field is
Answer: Option D
Q32
A bit field can be of
Answer: Option A
Q33
Identify the wrong statement(s).
Answer: Option D
Q34
Identify the correct statement (s).
Answer: Option D
Q35
About structures which of the following is true.
1. Struture members are aligned in memory depending on their data type.
2. The size of a structure may not be equal to the sum of the sizes of its members.
Answer: Option C
Q36
struct data
{
int day;
int month;
int year;
};
main ( )
{
struct date *d;
...
++d->day; /*satementN*/
....
}
then the statement statementN
...
Answer: Option B
Q37
struct cost_record
{
long cost_no;
char cost_name[31]];
double current_bal;
} CUST_REC;
Is the sample code above a usable structure variable declaration?
Answer: Option C
Q38
struct car
{
int speed;
char type [10];
} vehicle;
struct car *ptr;
ptr = &vehicle;
Referring to the sample code above, which of the following will make the speed equal to 200?
Answer: Option A
Q39
Consider the following structure.
struct numname
{
int no;
char name [25];
};
struct numname n1 [ ] = {
{12, "Raja"},
{15, "selvan"},
{18, "Prema"},
{21, "Naveen"}
};
The output for the following statement would be:
printf ("%d, %d",n1 [ 2].no, (* (n1 + 2)). no);
Answer: Option B
Q40
struct customer *ptr = malloc (sizeof (struct customer));
Given the sample allocation for the pointer "ptr" found above, which statement would be used to reallocate ptr to be an array of 10 elements?
Answer: Option A