Object Oriented Programming In C Plus Plus — Part 2 MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Object Oriented Programming In C Plus Plus — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
38
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
46 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
38
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/38 answered
✓0 correct
✗0 wrong
0% score
🎉 Set complete! All 38 questions answered.
Question 1 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the default access specifier for members of a class in C++?
Correct Answer: Option C — private
Detailed Academic Explanation:
private is the correct answer to “What is the default access specifier for members of a class in C++”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 2 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which keyword is used to make a class inheritable by other classes in C++?
Correct Answer: Option C — extends
Detailed Academic Explanation:
extends is the correct answer to “Which keyword is used to make a class inheritable by other classes in C++”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 3 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of destructors in C++?
Correct Answer: Option D — To release resources acquired by the object
Detailed Academic Explanation:
To release resources acquired by the object is the correct answer to “What is the purpose of destructors in C++”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 4 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C++ code? #include<iostream> using namespace std; class Base { public: Base() { cout<<"Constructing Base \n"; } virtual~Base() { cout<<"Destructing Base \n"; } }; class Derived: public Base { public: Derived() { cout<<"Constructing Derived \n"; } ~Derived() { cout<<"Destructing Derived \n"; } }; int main(void) { Derived *d = new Derived(); Base *b = d; delete b; return 0; }
Correct Answer: Option B — Constructing Base Constructing Derived Destructing Derived Destructing Base
Detailed Academic Explanation:
Constructing Base Constructing Derived Destructing Derived Destructing Base is the correct answer to “What will be the output of the following C++ code? #include<iostream> using namespace std; class Base { public: Base() { cout<<"Constructing Base \n"; } virtual~Base() { cout<<"Destructing Base \n"; } }; class Derived: public Base { public: Derived() { cout<<"Constructing Derived \n"; } ~Derived() { cout<<"Destructing Derived \n"; } }; int main(void) { Derived *d = new Derived(); Base *b = d; delete b; return 0; }”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 5 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which concept allows you to reuse the written code?
Correct Answer: Option C — Inheritance
Detailed Academic Explanation:
Inheritance is the correct answer to “Which concept allows you to reuse the written code”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 6 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is virtual inheritance?
Correct Answer: Option A — C++ technique to avoid multiple copies of the base class into children/derived class
Detailed Academic Explanation:
C++ technique to avoid multiple copies of the base class into children/derived class is the correct answer to “What is virtual inheritance”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 7 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How structures and classes in C++ differ?
Correct Answer: Option A — In Structures, members are public by default whereas, in Classes, they are private by default
Detailed Academic Explanation:
In Structures, members are public by default whereas, in Classes, they are private by default is the correct answer to “How structures and classes in C++ differ”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 8 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following class allows to declare only one object of it?
Correct Answer: Option C — Singleton class
Detailed Academic Explanation:
Singleton class is the correct answer to “Which of the following class allows to declare only one object of it”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 9 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is correct about new and malloc? i. new is an operator whereas malloc is a function ii. new calls constructor malloc does not iii. new returns required pointer whereas malloc returns void pointer and needs to be typecast
Correct Answer: Option D — i, ii and iii
Detailed Academic Explanation:
i, ii and iii is the correct answer to “Which of the following is correct about new and malloc? i. new is an operator whereas malloc is a function ii. new calls constructor malloc does not iii. new returns required pointer whereas malloc returns void pointer and needs to be typecast”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 10 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How run-time polymorphisms are implemented in C++?
Correct Answer: Option D — Using Inheritance and Virtual functions
Detailed Academic Explanation:
Using Inheritance and Virtual functions is the correct answer to “How run-time polymorphisms are implemented in C++”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 11 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Out of the following, which is not a member of the class?
Correct Answer: Option B — Friend function
Detailed Academic Explanation:
Friend function is the correct answer to “Out of the following, which is not a member of the class”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 12 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the correct syntax of declaring array of pointers of integers of size 10 in C++?
Correct Answer: Option B — int **arr = new int*[10]
Detailed Academic Explanation:
int **arr = new int*[10] is the correct answer to “What is the correct syntax of declaring array of pointers of integers of size 10 in C++”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 13 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following explains Polymorphism?
Correct Answer: Option C — int func(float); float func(int, int, char)
Detailed Academic Explanation:
int func(float); float func(int, int, char) is the correct answer to “Which of the following explains Polymorphism”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 14 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following feature of OOPs is not used in the following C++ code? class A { int i; public: void print(){cout<<"hello"<<i;} } class B: public A { int j; public: void assign(int a){j = a;} }
Correct Answer: Option D — Polymorphism
Detailed Academic Explanation:
Polymorphism is the correct answer to “Which of the following feature of OOPs is not used in the following C++ code? class A { int i; public: void print(){cout<<"hello"<<i;} } class B: public A { int j; public: void assign(int a){j = a;} }”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 15 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Why references are different from pointers?
Correct Answer: Option D — All of the mentioned
Detailed Academic Explanation:
All of the mentioned is the correct answer to “Why references are different from pointers”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 16 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following explains the overloading of functions?
Correct Answer: Option C — Ad-hoc polymorphism
Detailed Academic Explanation:
Ad-hoc polymorphism is the correct answer to “Which of the following explains the overloading of functions”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 17 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the difference between delete and delete[] in C++?
Correct Answer: Option C — delete is used to delete single object whereas delete[] is used to multiple(array/pointer of) objects
Detailed Academic Explanation:
delete is used to delete single object whereas delete[] is used to multiple(array/pointer of) objects is the correct answer to “What is the difference between delete and delete[] in C++”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 18 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the other name used for functions inside a class?
Correct Answer: Option B — Member functions
Detailed Academic Explanation:
Member functions is the correct answer to “What is the other name used for functions inside a class”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 19 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is an abstract data type?
Correct Answer: Option C — class
Detailed Academic Explanation:
class is the correct answer to “Which of the following is an abstract data type”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 20 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What happens if the following C++ statement is compiled and executed? int *ptr = NULL; delete ptr;
Correct Answer: Option D — The program is compiled and executed successfully
Detailed Academic Explanation:
The program is compiled and executed successfully is the correct answer to “What happens if the following C++ statement is compiled and executed? int *ptr = NULL; delete ptr;”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 21 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C++ code? #include <iostream> using namespace std; class A { int a; A() { a = 5;} }; int main() { A *obj = new A; cout << obj->a; }
Correct Answer: Option C — Compile-time error
Detailed Academic Explanation:
Compile-time error is the correct answer to “What will be the output of the following C++ code? #include <iostream> using namespace std; class A { int a; A() { a = 5;} }; int main() { A *obj = new A; cout << obj->a; }”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 22 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is not a type of Constructor?
Correct Answer: Option A — Friend constructor
Detailed Academic Explanation:
Friend constructor is the correct answer to “Which of the following is not a type of Constructor”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 23 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following cannot be a friend?
Correct Answer: Option C — Object
Detailed Academic Explanation:
Object is the correct answer to “Which of the following cannot be a friend”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 24 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How access specifiers in Class helps in Abstraction?
Correct Answer: Option B — They allows us to show only required things to outer world
Detailed Academic Explanation:
They allows us to show only required things to outer world is the correct answer to “How access specifiers in Class helps in Abstraction”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 25 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following approach is used by C++?
Correct Answer: Option B — Bottom-up
Detailed Academic Explanation:
Bottom-up is the correct answer to “Which of the following approach is used by C++”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 26 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following provides a programmer with the facility of using object of a class inside other classes?
Correct Answer: Option B — Composition
Detailed Academic Explanation:
Composition is the correct answer to “Which of the following provides a programmer with the facility of using object of a class inside other classes”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 27 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which concept means the addition of new components to a program as it runs?
Correct Answer: Option C — Dynamic loading
Detailed Academic Explanation:
Dynamic loading is the correct answer to “Which concept means the addition of new components to a program as it runs”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 28 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does polymorphism in OOPs mean?
Correct Answer: Option A — Concept of allowing overiding of functions
Detailed Academic Explanation:
Concept of allowing overiding of functions is the correct answer to “What does polymorphism in OOPs mean”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 29 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C++ code? #include <iostream> using namespace std; class A{ public: A(){ cout<<"Constructor called\n"; } ~A(){ cout<<"Destructor called\n"; } }; int main(int argc, char const *argv[]) { A *a = new A[5]; delete a; return 0; }
Correct Answer: Option D — Segmentation fault
Detailed Academic Explanation:
Segmentation fault is the correct answer to “What will be the output of the following C++ code? #include <iostream> using namespace std; class A{ public: A(){ cout<<"Constructor called\n"; } ~A(){ cout<<"Destructor called\n"; } }; int main(int argc, char const *argv[]) { A *a = new A[5]; delete a; return 0; }”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 30 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Wrapping data and its related functionality into a single entity is known as . . . . . . . .
Correct Answer: Option B — Encapsulation
Detailed Academic Explanation:
Encapsulation is the correct answer to “Wrapping data and its related functionality into a single entity is known as . . . . . . . .”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 31 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C++ code? #include<iostream> using namespace std; class Base { public: Base() { cout<<"Constructing Base \n"; } ~Base() { cout<<"Destructing Base \n"; } }; class Derived: public Base { public: Derived() { cout<<"Constructing Derived \n"; } ~Derived() { cout<<"Destructing Derived \n"; } }; int main(void) { Derived *d = new Derived(); Base *b = d; delete b; return 0; }
Correct Answer: Option A — Constructing Base Constructing Derived Destructing Base
Detailed Academic Explanation:
Constructing Base Constructing Derived Destructing Base is the correct answer to “What will be the output of the following C++ code? #include<iostream> using namespace std; class Base { public: Base() { cout<<"Constructing Base \n"; } ~Base() { cout<<"Destructing Base \n"; } }; class Derived: public Base { public: Derived() { cout<<"Constructing Derived \n"; } ~Derived() { cout<<"Destructing Derived \n"; } }; int main(void) { Derived *d = new Derived(); Base *b = d; delete b; return 0; }”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 32 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
C++ is . . . . . . . .
Correct Answer: Option D — both procedural and object oriented programming language
Detailed Academic Explanation:
both procedural and object oriented programming language is the correct answer to “C++ is . . . . . . . .”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 33 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How compile-time polymorphisms are implemented in C++?
Correct Answer: Option C — Using Templates
Detailed Academic Explanation:
Using Templates is the correct answer to “How compile-time polymorphisms are implemented in C++”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 34 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does modularity mean?
Correct Answer: Option B — Subdividing program into small independent parts
Detailed Academic Explanation:
Subdividing program into small independent parts is the correct answer to “What does modularity mean”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 35 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How many types of polymorphism are there in C++?
Correct Answer: Option B — 2
Detailed Academic Explanation:
2 is the correct answer to “How many types of polymorphism are there in C++”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 36 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following shows multiple inheritances?
Correct Answer: Option C — A,B->C
Detailed Academic Explanation:
A,B->C is the correct answer to “Which of the following shows multiple inheritances”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 37 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What happens if a pointer is deleted twice in a program as shown in the following C++ statements? int *ptr = new int; delete ptr; delete ptr;
Correct Answer: Option A — Undefined behaviour
Detailed Academic Explanation:
Undefined behaviour is the correct answer to “What happens if a pointer is deleted twice in a program as shown in the following C++ statements? int *ptr = new int; delete ptr; delete ptr;”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
Question 38 of 38
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is correct about new and malloc?
Correct Answer: Option C — Pointer object initialization of a class using new involves constructor call whereas using malloc does not involve constructor call
Detailed Academic Explanation:
Pointer object initialization of a class using new involves constructor call whereas using malloc does not involve constructor call is the correct answer to “Which of the following is correct about new and malloc”. This question is standard in competitive examination syllabi for Object Oriented Programming In C Plus Plus.
💡Key Conceptual Anchor:Object Oriented Programming In C Plus Plus
✓Link copied to clipboard
Continue Your Practice
Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡Examiner's Advisory for Programming & Software Development
In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.