C Pointers Test 416) What will be the output of the program given below?
The correct option is (c). Explanation: In the program x points the NULL address. It is invalid to access the NULL address hence the program gives Runtime error. Therefore the output of the program is Runtime error. 17) Is this a right way for NULL pointer assignment?
The correct option is (b). Explanation: The above null pointer assignment method is incorrect. The correct way is: 18) Will the program be compiled in Turbo C?
The correct option is (b). Explanation: In statement p++ error occur because we cannot perform arithmetic operation on void pointers. The following error is display on compiling the above program in TurboC. Compiling PROGRAM.C: Error PROGRAM.C 8: Size of the type is unknown or zero. 19) Which statement is correct about the program given below?
The correct option is (d). Explanation: In program 'i' is the variable contain pointer. So it is pointer variable and points toward an integer type in memory location. Therefore 'i' is a pointer to an int. Now the address of 'j' is assigned to the 'i' pointer, i.e. address of 'j' store to 'i' location. Therefore the 'i' is a pointer to an int and it stores the address of 'j'. 20) What will be the output of the program given below?
The correct option is (a). Explanation: In program while loop continues until *s is not equal to '\0'. Inside loop character is fetched first and address is incremented later. Therefore the print statement i.e. printf("%c", *p++); will print the Xyz in output. |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India