Amdocs C++ Interview Questions

1. Write a program to show string copy and concatenate in C++?

2. What will be the output of the program?
If switch(n)
case 1:cout<<'CASE !';

a) CASE! b) default c) Error d) None of the above

3. How to use Macros in C++?

4. Maintaining the state of an object is called____.

a) Serialization
b) Persistence
c) Marshalling
d) None of these options

5. What is the name of the java file of the given program?

import myLibrary.*;

public class ShowSomeClass
// your class code

c) ShowSomeClass
d) ShowSomeClass.class

6. Out of below mentioned options, which of the following is TRUE?

a) In java, an instance field declared public generates a compilation error.
b) int is the name of a class available in the package java.lang
c) Instance variable names may only contain letters and digits.
d) A class has always a constructor
e) The more comments in a program, the faster the program runs.

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

String river = new String(“Columbia”);

a) 6 b) 7 c) 8 d) Columbia e)river

8. What is a constructor?

a) Same name as the class it is declared within.
b) is used to create objects.
c) may be declared private
d) A and B only
e) A, B and C

9. What is the output of the following program?

main ()
{ int x=5;
cout<< x; }

a) 5 b) 4 c) 3 d) None of these

10. What is the output of the following program?

float a=.7

a) this b) that c) Error d) None of the above

11. What is the output of the following program?

case 1: cout<<'hello';
case (2) : cout<<'default';
a) hello b) default c) Garbage value d) hello and default e) None of the above

Shared by: Susant Kumar