Structure & Union

11.What is the similarity between a structure, union and enumeration?

A. All of them let you define new values
B. All of them let you define new data types
C. All of them let you define new pointers
D. All of them let you define new structures

View Answer


12.Which of the following share a similarity in syntax?
1. Union
2. Structure
3. Arrays
4. Pointers

A. 3 and 4
B. 1 and 2
C. 1 and 3
D. 1, 3 and 4

View Answer


13. Size of a union is determined by size of the.

A. First member in the union
B. Last member in the union
C. Biggest member in the union
D. Sum of the sizes of all members

View Answer


14.Which operator connects the structure name to its member name?

A. -
B. .
C. Both (b) and (c)
D. None of the above

View Answer


15.How will you free the allocated memory ?

A. remove(var-name);
B. free(var-name);
C. delete(var-name);
D. dalloc(var-name);

View Answer


16.Which of the following accesses a variable in structure b?

A. b->var;
B. b.var;
C. b-var;
D. b>var;

View Answer


17.Which of the following accesses a variable in structure *b?

A. b->var;
B. b.var;
C. b-var;
D. b>var;

View Answer


18.Which of the following is a properly defined struct?

A. struct {int a;}
B. struct a_struct {int a;}
C. struct a_struct int a;
D. struct a_struct {int a;};

View Answer


19.Which properly declares a variable of struct foo?

A. struct foo;
B. struct foo var;
C. foo;
D. int foo;

View Answer


20. What is the output of this program?

#include<stdio.h>
struct test {
int x = 0;
char y = 'A';
};
int main()
{
struct test t;
printf("%d, %c", s.x, s.y);
return 0;
}

A. 0 A
B. Error
C. garbage value garbage value
D. None of these

View Answer






Also check :


Discussion


* You must be logged in to add comment.