Wednesday, February 10, 2010

What does the operation shown below produce?

11 ^ 5

a) 1
b) 6
c) 8
d) 14
e) 15

Which of the following is the correct way to increment the variable "ptr"?

a) ptr = ptr + sizeof(myStruct); [Ans]
b) ++(int*)ptr;
c) ptr = ptr + sizeof(myArray);
d) increment(ptr);
e) ptr = ptr + sizeof(ptr);

What number will z in the sample code contain?

int z,x=5,y=-10,a=4,b=2;
z = x++ - --y * b / a;

a) 5
b) 6
c) 10
d) 11
e) 12

Understanding Stack and Queue

The five items: A, B, C, D and E are pushed in a stack,one after the other starting from A. The stack is popped four times and each element is inserted in a queue. Then two elements are deleted from the queue and pushed back on the stack. Now one item is popped from the stack.
The popped item is


a) A
b) B
c) C
d) D

fputs function is used to ?

i. write characters to a file
ii. takes 2 parameters
iii. returns a character
iv. requires a file pointer

a) all are true
b) all are false
c) only i and ii are true
d) only i,ii and iv are true