Exercise

1. The keyword used to transfer control from a function back to the calling function is

A. switch
B. goto
C. return
D. exit

View Answer

2. What is the default return type if it is not specified in function definition?

A. void
B. int
C. float
D. short int

View Answer


3. The default parameter passing mechanism is

A. Call by value
B. call by reference
C. call by value result
D. None

View Answer


4. Pick the correct statements.
I.   The body of a function should have only one return statement.
II.  The body of a function may have many return statements.
III. A function can return only one value to the calling environment.
IV. If return statement is omitted, then the function does its job but returns no value to the calling environment.

A. I and II
B. I and III
C. II and III
D. II anf IV

View Answer


5. Functions can return structure in c?

A. True
B. False

View Answer


6. Forward declaration is absolutely necessary

A. If a function returns a non-integer quantity
B. If the function call precedes its definition
C. If the function call precedes its definition and the function returns a non integer quantity
D. None of the above

View Answer


7. In C, what is the meaning of following function prototype with empty parameter list
void fun()
{
/* .... */
}

A. Function can only be called without any parameter
B. Function can be called with any number of parameters of any types
C. Function can be called with any number of integer parameters.
D. Function can be called with one integer parameter.

View Answer


8. A pointer is

A. A variable that stores address of an instruction
B. A variable that stores address of other variable
C. A keyword used to create variables
D. None of these

View Answer


9. The reason for using pointers in a Cprogram is

A. Pointers allow different functions to share and modify their local variables.
B. To pass large structures so that complete copy of the structure can be avoided.
C. Pointers enable complex “linked" data structures like linked lists and binary trees.
D. All of the above

View Answer


10. How can you write a[i][j][k][l] in equivalent pointer expression?

A. (((***(a+i)+j)+k)+l)
B. ((**(*(a+i)+j)+k)+l)
C. (*(*(*(a+i)+j)+k)+l)
D. *(*(*(*(a+i)+j)+k)+l)

View Answer


11. What is wild pointer?

A. Pointer which is wild in nature
B. Pointer which has no value.
C. Pointer which is not initialized
D. None

View Answer


12. Address stored in the pointer variable is of type __________.

A. Integer
B. Float
C. Array
D. Character

View Answer


13. In order to fetch the address of the variable we write preceding _________ sign before variable name.

A. Percent(%)
B. Comma(,)
C. Ampersand(&)
D. Asteric(*)

View Answer


14. Comment on this
const int *ptr;

A. You cannot change the value pointed by ptr
B. You cannot change the pointer ptr itself
C. Both (a) and (b)
D. You can change the pointer as well as the value pointed by it

View Answer


15. Choose the best one
prior to using a pointer variable

A. It should be declared.
B. It should be initialized.
C. It should be both declared and initialized.
D. None of the above.

View Answer



Discussion

* You must be logged in to add comment.