Gate CS-2014-1 Question Paper With Solutions

Q. 20 Consider the following program is C language:

#include <stdio.h>
main()
{
    int i;
    int *pi = &i;
    scanf("%d", pi);
    printf("%d\n", i+5);
}

Which one of the following statements is TRUE?

(A) Compilation fails

(B) Execution results in a run-time error

(C) On execution, the value printed is 5 more than the address of variable 1

(D) On execution, the value printed in 5 more than the integer value entered

Answer: (D)

Explanation:

Gate CS-2014-1 Question Paper With Solutions

Learn More:   Gate ME-2013 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here