C++ Programming MCQs
12 practice MCQs on this page Page 3 of 3
Tap an option to check your answer — the correct answer and full explanation appear after you choose.
ProgrammingC++ Programming BPSCID: BPP-2781
In object-oriented programming, the same function behaving differently is called:
- AEncapsulation
- BAbstraction
- CPolymorphism ✓ Correct answer
- DInheritance
✓ Correct answer: Polymorphism
Full explanation
Polymorphism is the ability of the same function or operator to behave differently in different contexts.
ProgrammingC++ Programming BPSCID: BPP-2783
In C++, the operator used to insert output is:
- A->
- B>>
- C==
- D<< ✓ Correct answer
✓ Correct answer: <<
Full explanation
In C++, the << operator is used to insert output into a stream.
ProgrammingC++ Programming BPSCID: BPP-3691
Which keyword is used to define a class in C++?
- Astruct
- Bobject
- Cclass ✓ Correct answer
- Ddefine
✓ Correct answer: class
Full explanation
A class in C++ is defined with the class keyword, followed by the class name and the member declarations.
ProgrammingC++ Programming BPSCID: BPP-3692
In C++, the operator used to access a member through a pointer is?
- A.
- B&
- C::
- D-> ✓ Correct answer
✓ Correct answer: ->
Full explanation
The arrow operator -> is used to access a member of an object through a pointer to that object.
ProgrammingC++ Programming BPSCID: BPP-3693
Which concept in C++ allows a function to have the same name with different parameters?
- AFunction overloading ✓ Correct answer
- BFunction overriding
- CInheritance
- DEncapsulation
✓ Correct answer: Function overloading
Full explanation
Function overloading allows several functions with the same name but different parameter lists to exist in C++.
ProgrammingC++ Programming BPSCID: BPP-3694
The destructor of a class in C++ is identified by which symbol before its name?
- A#
- B@
- C~ ✓ Correct answer
- D$
✓ Correct answer: ~
Full explanation
A destructor in C++ has the same name as the class, preceded by the tilde symbol ~.
ProgrammingC++ Programming PPSCID: LTP-7708
The C++ programming language was created by:
- ABjarne Stroustrup ✓ Correct answer
- BJames Gosling
- CGuido van Rossum
- DDennis Ritchie
✓ Correct answer: Bjarne Stroustrup
Full explanation
C++ was created by Bjarne Stroustrup, who extended the C language with object-oriented features.
ProgrammingC++ Programming PPSCID: LTP-7709
In C++, which object is used to display output on the screen?
- Acin
- Bcout ✓ Correct answer
- Cprint
- Decho
✓ Correct answer: cout
Full explanation
In C++ the cout object is used to display output on the screen, usually with the insertion operator.
ProgrammingC++ Programming PPSCID: LTP-7710
In C++, which object is used to take input from the user?
- Acout
- Bscanf
- Ccin ✓ Correct answer
- Dget
✓ Correct answer: cin
Full explanation
In C++ the cin object is used to take input from the user, usually with the extraction operator.
ProgrammingC++ Programming PPSCID: LTP-7711
C++ is best known as a language that supports which programming style?
- AOnly machine code
- BOnly web design
- COnly database queries
- DObject-oriented programming ✓ Correct answer
✓ Correct answer: Object-oriented programming
Full explanation
C++ supports object-oriented programming, with classes, objects, inheritance and polymorphism built into the language.
ProgrammingC++ Programming PPSCID: LTP-7712
In C++, which operator is used to allocate memory dynamically?
- Anew ✓ Correct answer
- Bmalloc
- Calloc
- Dcreate
✓ Correct answer: new
Full explanation
In C++ the new operator is used to allocate memory dynamically at run time.
ProgrammingC++ Programming PPSCID: LTP-7713
In C++, the symbol * when used with a pointer variable means:
- AMultiply two numbers only
- BDereference the pointer to get the value it points to ✓ Correct answer
- CStart a comment
- DEnd the program
✓ Correct answer: Dereference the pointer to get the value it points to
Full explanation
In C++ the * symbol is used to dereference the pointer to get the value it points to, reaching the data stored at that address.
Practice these MCQs interactively
← Programming MCQs