C++ Interview Questions - KPIT Cummins

1. Choose from the below given option the answer of the question?
2. cin in C++ is a

a) function
b) object
c) class
d) prototype

3. Why Scope Resolution operator is used?

4. What are the advantages of inline function?

5. Copy constructor is
a) call by value
b) call by reference
c) function
d) object

6. Why virtual destructor is used?
7. What is the use of virtual class?
8. What is the output of the following program?
main(){
int i = 10, j =20;
j = i ,j?(i,j)?i :j:j;
cout<
a) 20 20 b) 20 10 c) 10 20 d) 10 10

9. What is the output of the following program?

main(){
extern i;
cout<{int i =20;
cout<
a) “Extern valueof I” 20
b) Externvalue of i
c) 20
d) Linker Error: unresolved external symbol i

10. What is the output of the following program?
int DIMension(int array[]){
return sizeof(array/sizeof(int);}
main(){
int arr[10];
cout<< “Dimension of array is”<}

a) Dimension of array is 10
b) Dimension of array is 1
c) Dimension of array is 2
d) Dimension of array is 5
Post your comment