Exercise

1. Which of the following are themselves a collection of different data types?

A. String
B. Structures
C. Char
D. None of the above

View Answer

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

A. -
B. ->
C. .
D. both . and ->

View Answer


3. Which of the following cannot be a structure member?

A. Function
B. Array
C. Structure
D. None of the above

View Answer


4. What is the correct syntax to declare a function foo() which receives an array of structure in function?

A. void foo(struct *var);
B. void foo(struct *var[]);
C. void foo(struct var);
D. none of the mentioned

View Answer


5. Union differs from structure in the following way

A. All members are used at a time
B. Only one member can be used at a time
C. Union cannot have more members
D. Union initialized all members as structure

View Answer


6. The size of the following union, where an int occupies 4 bytes of memory is
    union demo     {     float x;     int y;     char z[10];     };

A. 8 byte
B. 4 byte
C. 10 byte
D. 18 byte

View Answer


7. Members of a union are accessed as________________.

A. union-name.member
B. union-pointer->member
C. Both a & b
D. None of the mentioned

View Answer


8. It is not possible to create an array of pointer to structures.

A. True
B. False

View Answer


9. Which of the following statement is True?

A. User has to explicitly define the numeric value of enumerations
B. User has a control over the size of enumeration variables.
C. Enumeration can have an effect local to the block, if desired
D. Enumerations have a global effect throughout the file.

View Answer


10. size of union is size of the longest element in the union

A. Yes
B. No

View Answer


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



Discussion

* You must be logged in to add comment.