C++/ Java Interview Questions - Mahindra Satyam

1. How many times 'Jamboree' will be displayed?
main()
{
Cout<< “Jamboree”;
main();
}

(a) infinite times (b) 32767 times
(c) 65535 times (d) till stack overflow

2. Find the error in the program?
main()
{
int a=10,j;
j=fn(a);
switch(j)
{
case 30: cout<<"the value is 30";
break;
case 50: cout<<"the value is 50";
break;
default:cout<<"the value is not 30 or 50";
}
}
fn(int a)
{
return (++a);
}

(a) the value is 30
(b) the value is not 30 or 50
(c) Compilation Error
(d) No output

3. What is the output of the following program?
main()
{
struct emp
{
char name[20];
int age;
float sal;
};
struct emp e = {"tiger"};
cout<
(a) 0 0.000000 (b) Garbage value (c) Error (d) None

4. What is the difference between the structure of c and structure of C++?

5. What are the different types of storage classes?

6. Write a program to make a binary tree?

7. What is meant by inline function?

8. Write a program in java to show the interface class?
Post your comment