C Programming Multiple Choice Question - Functions And Pointers
This section focuses on the "Functions And Pointers" of the C programming. These Multiple Choice Questions (mcq) should be practiced to improve the C programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. The keyword used to transfer control from a function back to the calling function is
Explanation: The keyword return is used to transfer control from a function back to the calling function.
2. What is the default return type if it is not specified in function definition?
3. The default parameter passing mechanism is
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. 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.
5. Functions can return structure in c?
Explanation: Yes, functions can return structure
6. Forward declaration is absolutely necessary
Explanation: If the function call precedes its definition and the function returns a non integer quantity
7. In C, what is the meaning of following function prototype with empty parameter list
/* .... */
Explanation: Empty list in C mean that the parameter list is not specified and function can be called with any parameters. In C, to declare a function that can only be called without any parameter, we should use "void fun(void)" As a side note, in C++, empty list means function can only be called without any parameter. In C++, both void fun() and void fun(void) are same.
8. A pointer is
Explanation: a pointer is a programming language object that stores the memory address of another value located in computer memory. A pointer references a location in memory, and obtaining the value stored at that location is known as dereferencing the pointer.
9. The reason for using pointers in a Cprogram is
Explanation: (A) With pointers, address of variables can be passed different functions can use this address to access the variables. (B) When large structure variables passed or returned, they are copied as everything is passed and returned by value in C. This can be costly with structure containing large data. To avoid this copying of large variables, we generally use poitner for large structures so that only address is copied. (C) With pointers, we can implement "linked" data structures. Java uses reference variables to implement these data structures. Note that C doesn't support reference variables.
10. How can you write a[i][j][k][l] in equivalent pointer expression?
Also check :