IBM
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 in the following program?
main()
{char c=-64;
int i=-32
unsigned int u =-16;
if(c>i)
{cout<<pass1;
if(c<i)
cout<<pass2;
else
cout<<fail2;
}
else
cout<<fail1;
if(i<c)
cout<<pass2;
else
cout<<fail2;}
a) Pass1,Pass2 b) Pass1,Fail2 c) Fail1,Pass2 d) Fail1,Fail2
e) None of these

  1. 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<<i;}}
    a) 0,5,9,13,17 b) 5, 9, 13, 17 c) 12, 17, 22 d) 16, 21 e) Syntax error
  1. Why link list is used?
  2. What is the difference between a normal pointer and a void pointer?
  3. What is Hash function? Explain with an example</fail2;}
    </pass2;
    </c)
    </fail1;
    </fail2;
    </pass2;
    </i)
    </pass1;
    </i;}}

q2) trace the ouput
struct s{
int i,char j}
main()
{
struct s s1;
s.s1=5;
printf(“%d”,s.s1);
}
q3) condition for empty queue
q4) trace the output
main()
{
int i,j;
int p,q;
p=&i; q=&j;
i = 10;
j= 2;
i = i++ + —j;
j = –i* – ++j; printf(“%d%d”,i,j); printf(“%d%d”,p,*q);
}

  1. How do you differentiate between aggregation and association?
  2. How do you find out the size of a class?
  3. How do you implement an itoa function?
  4. How do you initialize a pointer to a function?
  5. How do you link a C++ program to C functions?
  6. How do you return a structure from functions?
  7. How do you check whether a linked list is circular?
  8. How do you decide which integer type to use?
  9. How do you differentiate between a constructor and destructor?
  10. What are the different types of Storage classes?
  11. What do you mean by inline function?
  12. What is a copy constructor?
  13. What is a namespace?
  14. What does extern mean in a function declaration?
  15. How do you write a function that can reverse a linked-list?
  16. What are the benefits of using exceptions in C++?
  17. What are the differences between a struct and a class in C++?
  18. What does extern mean in a function declaration?
  19. What does it mean to declare a function or variable as static?
  20. What is a conversion constructor?

Read More