LG Soft C++ Interview Questions

1. What will be the value of i & j?
for(i=0,j=0;i<5,j<25;i++,j++)

(a) i=4,j= 24 (b) i=24,j= 24 (c) i=25,j= 25 (d) i=5,j=25

2. What is the output of the following program?
main()
{
int i,j;
i=10;
j=sizeof(++i);
cout< }

(a) 11 (b) 10 (c) 4 (d) Compiler Error

3. What is the output of the following program?
main()
{
int i=7;
cout< }

(a) 49 (b) 56 (c) 72 (d) Compiler error

4. What is the output of the following program.
main()
{
char *p,*f();
p=f();
cout<< f() returns:<

}
char *f()
{
char result[80];
strcpy(result,'anything will do');
return (result);
}

(a) f() returns: anything will do
(b) f() returns: result
(c) Compiler error
(d) None

5. How to initialize a pointer to a function?

6. Can a C++ program be linked with a C program?

7. How a function can return a structure?

8. Write a program to reverse a link list?

9. What are the advantages of exceptions in C++?

Shared by: Susant Kumar