C++ Interview Questions- IBM

1. In the following program what is the value of e?

enum number { a= -1, b= 4,c,d,e}

(a) 7 (b) 4 (c) 5 (d) 15 (e) 3

2. What is the output of the following program is

main()
{int i=0;
for(i=0;i<20;i++)
{switch(i)
case 0:i+=5;
case 1:i+=2;
case 5:i+=5;
default i+=4;
break;}
cout<
a) 0,5,9,13,17 b) 5, 9, 13, 17 c) 12, 17, 22 d) 16, 21 e) Syntax error

3.What is the output in the following program?

main()
{char c=-64;
int i=-32
unsigned int u =-16;
if(c>i)
{cout<if(ccout<else
cout<}
else
cout<if(icout<else
cout<
a) Pass1,Pass2 b) Pass1,Fail2 c) Fail1,Pass2 d) Fail1,Fail2
e) None of these

4. What is the difference between a normal pointer and a void pointer?
5. Why link list is used?
6. What is Hash function? Explain with an example
Post your comment