C++ MCQ’s

C++ MCQ’s Home Page

C++ Basic 1
C++ Basic 2
C++ Basic 3
C++ Basic 4
C++ Basic 5
C++ OOPs Concepts 1
C++ OOPs Concepts 2
C++ OOPs Concepts 3
C++ OOPs Concepts 4
C++ OOPs Concepts 5

 

Cpp Language MCQ’S | OOPs Concepts Set 3

16.
What will be the output of the following C++ code?

#include<iostream>
using namespace std;
int main ()
{
int cin;
cin >> cin;
cout << “cin: ” << cin;
return 0;
}

a) cin: garbage value
b) Error
c) Segmentation fault
d) Nothing is printed

 

17.
Which of the following operator has left to right associativity?

a) Unary operator
b) Logical not
c) Array element access
d) addressof

 

18.
Which of the following is accessed by a member function of a class?

a) The object of that class
b) All members of a class
c) The public part of a class
d) The private part of a class

 

19.
What is the size of a character literal in C and C++?

a) 4 and 1
b) 1 and 4
c) 1 and 1
d) 4 and 4

 

20.
What is the size of a character type in C and C++?

a) 4 and 1
b) 1 and 4
c) 1 and 1
d) 4 and 4