C Functions Test 416) What is the output of below program?
The correct option is (d). Explanation: There is an error in the line 16 i.ea>=45 ? return(*y): return(*z); we are not allowed to use return keyword in the ternary operator Therefore compile error occur in the output of a program 17) What is the output of below program?
The correct option is (a). Explanation: Step 1: int j; The variable j is declared as an integer type. Step 2: int function(); This statement tells the compiler that the function does not accept any argument and it returns an integer value. Step 3: while(j) The value of j is not initialized so the while condition is failed. Therefore it does not execute the while block. Step 4: printf("Hi\n"); This statement prints "Hi". Therefore the output of the program is "Hi". 18) The C library function rewind() is used for re-position the file pointer at the beginning of the file.
The correct option is (a). Explanation: In C, rewind function reposition the file position at the beginning of the file of given stream. The syntax of using function rewind() is: void rewind(FILE *stream) This function also erases the error and end-of-file indicators for stream. 19) Which header file is used for supporting the functions- malloc() and calloc().
The correct option is (c). Explanation: void *calloc(size_h nitems, size_h size): Function calloc() requires the double argument. void *malloc(size_h size) : Function malloc() requires the single argument. For supporting the function- malloc() and calloc() stdlib.h header file is required. 20) A function can execute faster than a macro.
The correct option is (b). Explanation: Macro can be executed faster with no overhead of context switch because the code of macro gets expanded at the line of call. Therefore, the above statement is false. |