C++ (C Plus Plus) MCQ: Multiple Choice Questions and Answers

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

C++ (C Plus Plus) MCQ : Multiple

Choice Questions and Answers


1. The Packing of _____________ into single component is know as
encapsulation.
A. data
B. function
C. data and functions
D. none

Answer: Option C
2. Which of the following converts bool values to text(“ true or false”)?
A.ios:: boolalpha
B.ios:: showpos
C.ios:: stdio
D.none

Answer: Option A
3. Which of the following skip white space on input?
A.ios:: boolalpha
B.ios:: showpos
C.ios:: skipus
D.none

Answer: Option C
4. Which of the following omits white space on input?
A.skipws
B.noskipws
C.ios:: skipus
D. none

Answer: Option A
5. The void type is also called as ——————?
A. null datatype
B. empty datatype
C. zero datatype
D. none
Answer: Option B
6. The keywords signed, unsigned, short and long are called————-?
A.Type modifiers
B. type casting
C.type conversion
D. none

Answer:OptionA
7. The values of variables are to be converted from one type to another type
is called___________________?
A. Type modifiers
B. type casting
C.type conversion
D. none

Answer:Option B
8. The operator ::* is called ______________?
A.pointer to member decelerator
B.insertion operator
C.extraction operator
D.none

Answer:Option A
9. The operator ->* is called ____________?
A. deference pointers to pointers to class members
B.insertion operator
C.extraction operator
D.none

Answer: Option A
10. The operator .* is called_________?
A.deference pointers to class members
B.insertion operator
C. extraction operator
D.none

Answer: Option A
11. The operator “,” is used to ________________?
A .equal to
B. Evaluate
C.shift left
D. none

Answer:Option B
12. The new, operator, inline, friend are called______________?
A. keywords
B. operator
C.method
D. functions

Answer: Option A
13. The asm, catch, class are called ____________?
A.keywords
B.operator
C.method
D. functions
Answer:Option A
14._______________loop will be executed at least once even if the condition
is false initially
A.do-while
B.while
C.for
D.none

Answer:Option A
15. This statement passes control anywhere in the program without least
care for any condition is called _____________ statement?
A.goto
B.jump
C. break
D.none

Answer:Option A
16. The ________keyword makes variable value stable.
A.const
B.constant
C.temp
D.none

Answer: Option A
17. When a function is declared as _________, the compiler copies the code
of the function in the calling function that is function body is inserted in
place of function call during compilation.
A.inline
B.outline
C. function overloading
D.none

Answer: Option A
18. Defining multiple functions with same names is known as ____________
A.function overloading
B.function polymorphism
C.function overriding
D.both a & b

Answer: Option D
19. The functions ceil and ceill round up the given________ number.
A. float
B. char
C. double
D. none

Answer: Option A
20. Inline mechanisms increases execution performance in terms of
________.
A. speed
B. memory
C. accuracy
D. none

Answer: Option A
21. Which of the following statement is incorrect?
A. Friend keyword can be used in the class to allow access to another class.
B. Friend keyword can be used for a function in the public section of a class.
C. Friend keyword can be used for a function in the private section of a class.
D. Friend keyword can be used on main() .
Answer: Option D
22. Which of the following statement is correct regarding destructor of 
base class ?
A. Destructor of base class should always be static.
B. Destructor of base class should always be virtual.
C. Destructor of base class should not be virtual.
D. Destructor of base class should always be private.

Answer: Option B
23. Which of the following two entities ( reading from Left to Right) can be
connected by the dot operator ?
A. A class member and a class object.
B. A class object and a class.
C. A class and a member of that class.
D. A class object and a member of that class.

Answer: Option D
24. How can we make a class abstract?
A. By making all member functions constant.
B. By making at least one member function as pure virtual function.
C. By declaring it abstract using the static keyword.
D. By declaring it abstract using virtual keyword.

Answer: Option B
25. Which of the following statement is correct when a class is inherited
publicly?
A. Public members of the base class  become protected members of derived
class.
B. Public members of the base class  become private members of derived class.
C. Private members of the base class  become protected members of derived
class.
D. Public members of the base class  become public members of derived class.

Answer: Option D
26. Which of the following statement is correct about the constructors and
destructors?
A. Destructors can take arguments but constructors can not.
B. Constructors can take arguments but destructors can not
C. Destructors can be overloaded but constructors can not be overloaded.
D. Constructors and destructors can both return a value.

Answer: Option B
27. Which of these access specifiers is used in class definition by default ?
A. Protected
B. Public
C. Private
D. Friend

Answer: Option C
28. Which of the following statement is correct  with regard  to the use of
keyword friend inside a class ?
A. A private member can be declared as a friend.
B. A class may be declared as a friend.
C. An object may be declared as a friend.
D. We can use friend keyword as a class name.

Answer: Option B
29. Which of these keywords is used to control access to a class member ?
A. Default
B. Break
C. Protected
D. Asm

Answer: Option C
30. Which of the following can access private data members or member
functions of a class ?
A. Any function in the program.
B. All global functions in the program.
C. Any member function of that class.
D. Only public member functions of that class.

Answer: Option C 
31. Which of the following type of data member can be shared by all
instances of its class?
A. Public
B. Inherited
C. Static
D. Friend

Answer: Option C
32. What is also termed as an instance of a class?
A. Friend Function
B. Object
C. Member Function
D. Member Variables

Answer: Option B
33. Constructor is executed when ________ .
A. an object is created
B. an object is used
C. a class is declared
D. an object goes out of scope.

Answer: Option A
34. Which of these statements is true about virtual base classes ?
A. It is used to provide multiple inheritance.
B. It is used to avoid multiple copies of base class in derived class.
C. It is used to allow multiple copies of base class in a derived class.
D. It allows private members of the base class to be inherited in the derived
class.

Answer: Option B
35. ________ can have default and can be overloaded.
A. constructor
B. destructor
C. Friend Function
D. None

Answer: Option A
36. Destructor can be ________ but constructors can not.
A. Virtual
B. Friend
C. Inline
D. None

Answer: Option A
37. Constructor is arguments are called _________
A. Parametrized constructor
B. default constructor
C. Zero- constructor
D. None

Answer: Option A
38. The opearator ++,– and – are called _______ operators.
A. unary
B. binary
C. arithmetic
D. none

Answer: Option A
39. Overloading with a _____ parameter is called binary operator
overloading.
A. single
B. double
C. three
D. none

Answer: Option A
40. ?:,::,sizeof(),”.” Are called as  _________ operators.
A. overloadable
B. non-overloadable
C. default
D. none

Answer: Option B
41. (),= Are called non-overloadable with _______ function.
A. friend
B. inline
C. default
D. none
Answer: Option A
42. The procedure of creating a new class from one or more existing classes
is termed as ________.
A. Inheritance
B. Polymorphism
C. Encapsulation
D. None

Answer: Option A
43. The combination of one or more types of inheritance _________
A. Hybrid
B. multipath
C. multilevel
D. none

Answer: Option A
44. To overcome the ambiguity occurred due to multipath inheritance, c++
provides the keyword ________.
A. Virtual
B. friend
C. default
D. none

Answer: Option A
45. A _______ is a memory variable that stores memory address.
A. pointer
B. array
C. inheritance
D. none

Answer: Option A
46. The ______ operator(*) is called as deference operator.
A. indirection
B. direction
C. bidirection
D. none

Answer: Option A
47. When a pointer points to an unallocated memory location or to data
value whose memory is deallocated, such a pointer is called ________
pointer .
A. arithmetic
B. logic
C. wild
D. none

Answer: Option C
48. _______ is a collection of elements of similar data types in which each
element is unique and located in separate memory location.
A. pointer
B. array
C. attributes
D. none

Answer: Option B
49. The ______ operator not only creates an object but also allocates
memory.
A. new
B. old
C. delete
D. none

Answer: Option A
50. The _____ operator not only destroys object but also releases allocated
memory.
A. new
B. delete
C. old
D. none

Answer: Option B

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy