Complicated Declarations(C Programming ) Questions and Answers

Question 1.


Are the following declarations same?


c* scr;har far *far *scr;
char far far*
  1.    Yes
  2.    No
Explanation:-
Answer: Option B. -> No



Question 2.

Is the following declaration correct?
void(*f)(int, void(*)());


  1.    Yes
  2.    No
Explanation:-
Answer: Option A. -> Yes

f is a pointer to a function which returns nothing and receives as its parameter an integer

 and a pointer to a function which receives nothing and returns nothing.



Question 3.

Is the following declaration correct?
char (* ( *f())[])();


  1.    Yes
  2.    No
Explanation:-
Answer: Option A. -> Yes

f is a function that returns a pointer to an array of pointers to functions that return a char



Question 4.

Is the following declaration correct?
char far *far *ptr;


  1.    Yes
  2.    No
Explanation:-
Answer: Option A. -> Yes

ptr is a far pointer to a far pointer to a char. (or) ptr contains a far address of a far pointer to a char



Question 5.

Is the following declaration correct?
typedef *void (*pfun)(**int, *float);


  1.    Yes
  2.    Yes
Explanation:-
Answer: Option B. -> Yes



Question 6.

We can allocate a 2-Dimensional array dynamically.


  1.    True
  2.    False
Explanation:-
Answer: Option A. -> True



Question 7.

We can modify the pointers "source" as well as "target".


  1.    True
  2.    False
Explanation:-
Answer: Option A. -> True



Question 8.

Does the data type of all elements in the union will be same.


  1.    True
  2.    False
Explanation:-
Answer: Option B. -> False



Question 9.

It is not necessary to typecast the address returned by malloc().


  1.    True
  2.    False
Explanation:-
Answer: Option B. -> False



Question 10.

Function can return a floating point number.


  1.    True
  2.    False
Explanation:-
Answer: Option A. -> True