Home »» Placement Papers »» All Papers »» Aditi »» Placement Paper

C++ Interview Questions - Aditi


1. What is the output of the program given below?

#include
main()
{
char i=0;
for(;i>=0;i++) ;
cout<}

a) 0 b) 1 c) Error d) ASCII value e) No output

2. What is the output of the following program? 

#include
main()
{
int i=0;
fork();
cout<fork();
cout<fork();
wait();
}

a) 0 b) 1 c) Garbage value d) Error e) No output

3. How much memory will be allocated in the following statement?

int (*x)[10];

a) 10 b) 20 c) Garbage value d) 2 e) No output

4. How much memory will be allocated in the following statement?

int (*x)();

a) NULL b) 0 c) Garbage value d) 2 e) No output

5. How many times is c=c*a calculated?

#include
main()
{
int a=2;
int b=9;
int c=1;
while(b)
{
if(odd(b))
c=c*a;
a=a*a;
b=b/2;
}
cout<}

a) 1 b) 9 c) 2 d) Error e) No output

6. Write a program to initialize a string using copy constructor?

7. What is the result of the expression: (x-a)(x-b)(x-c).....(x-z) ? 

Comment

0 Answers