Home Company Questions TCS Interview Questions TCS Interview Questions - 3

Login Form




TCS Interview Questions - 3 Print E-mail

1. The following statement is _________________

" The size of a struct is always equal to the sum of the sizes of its members"

a) valid              b) invalid               c) can't say

 


2. What is the value of *p;

a) 2          b) 3          c) 4          d) 5


3. x = malloc (y). Which of the following statements is correct.

a) x is the size of the memory allocated

b) y points to the memory allocated

c) x points to the memory allocated

d) none of the above


4. p and q are pointers to the same type of dataitems. Which of these are valid?

i) *(p+q)

ii) *(p-q)

iii) *p - *q

 

a) all             b) iii is valid sometimes


5. int a = 0, b = 2;

if (a = 0)

b = 0;

else

b *= 10;

what is the value of b?

a) 0             b) 20            c) 2             d) none


6. #define max(a,b) (a>b?b:a)

#define squre(x) x*x

int i = 2, j = 3, k = 1;

printf ("%d %d", max(i,j), squre(k));

output?

a) 32                b)23          c)31            d)13


7. What is the value of the following expression?

i = 1;

i << 1 % 2

a) 2             b) 1           c) 0


8. C allows

a) only call by value

b) only call by reference

c) both

d) only call by value and sometimes call by reference


9. x = fopen (b, c)    what is b?

a) pointer to a character array which contains the filename

b) filename whithin double quotes

c) can be anyone of the above

d) none


 

10. Which is the valid declaration?

a) #typedef struct { int i;}in;

b) typedef struct in {int i;};

c) #typedef struct int {int i;};

d) typedef struct {int i;} in;