Thursday 15 August 2013

Answers to C- test papre-1



Ans: d (Q1)
printf( ) prints address/garbage of i,
scanf() dont hav & sign, so scans address for i
+1, -1 dont hav any effect on code

Ans: b (Q2)


Ans: c) 100, 4, 0  (Q3)
Ans: c)  (Q4)
Error becoz i/(*p) is 25/25 i.e 1 which is int & printed as a float, So abnormal program termination, runs if (float) i/(*p) -----> Type Casting

Ans: b) Hello world (Q5)

Ans: c) (Q6)    printf(" %% ");

Ans: c) (Q7)

Ans a)  (Q8)

Ans: d)   (Q9)  printd Nothing, as after free(obj), no memory is there containing
obj->pName & pbj->pAddress

 Ans: b) (Q10)

Ans: c) (Q11)

Ans: a) (Q12)   2, 2

Ans: a)  (Q13) 2

Ans: a)    (Q14) 1, if we use main|c then error, illegal use of pointer

Ans: c)  (Q15)

Ans: d)  (Q16)  Infinite loop as x is decremented twice, it never be 0
and loop is going on & on

Answer : c) (Q17)       5

Answer : d)  (Q18)  compilation error no ++++ operator allowed

Output: Infinite loop (Q19)

Output:  (Q20)  5 5 5

No comments:

Post a Comment