Skip to main content

Introduction To C Plus Plus — Part 2 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Introduction To C Plus Plus — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.

Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40

Verified Practice Questions

Interactive test mode with detailed academic worked solutions

Live Progress | 0/40 answered
✓ 0 correct ✗ 0 wrong 0% score
Question 1 of 40
★ FPSC ★ PPSC

What is the correct syntax to define a class named 'Rectangle' with private member variables 'length' and 'width' in C++?

Question 2 of 40
★ FPSC ★ PPSC

What is the purpose of the 'break' statement in a loop in C++?

Question 3 of 40
★ FPSC ★ PPSC

What is the correct way to define a constant named 'PI' with a value of 3.14159 in C++?

Question 4 of 40
★ FPSC ★ PPSC

What is the output of the following code: cout << (10 % 3); in C++?

Question 5 of 40
★ FPSC ★ PPSC

What will be the output of the following program in both C and C++? #include<stdio.h> int main(int argc, char const *argv[]) { printf("%d\n", (int)sizeof('a')); return 0; }

Question 6 of 40
★ FPSC ★ PPSC

What happens if a class does not have a name?

Question 7 of 40
★ FPSC ★ PPSC

Which of the following escape sequence represents carriage return?

Question 8 of 40
★ FPSC ★ PPSC

What are the formal parameters in C++?

Question 9 of 40
★ FPSC ★ PPSC

Which of the following is a static polymorphism mechanism?

Question 10 of 40
★ FPSC ★ PPSC

What if we define the below structure in C and C++?

Question 11 of 40
★ FPSC ★ PPSC

Which of the following is true? I. All operators in C++ can be overloaded. II. The basic meaning of an operator can be changed.

Question 12 of 40
★ FPSC ★ PPSC

What is std in C++?

Question 13 of 40
★ FPSC ★ PPSC

What is dynamic binding?

Question 14 of 40
★ FPSC ★ PPSC

What happens if the following line is executed in C and C++? const int a;

Question 15 of 40
★ FPSC ★ PPSC

What happens if we run the following code in both C and C++? #include<stdio.h> struct STRUCT { int a = 5; int func() { printf("%d\n", a); } }; int main() { struct STRUCT s; s.func(); return 0; }

Question 16 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include<iostream> using namespace std; class A { ~A(){ cout<<"Destructor called\n"; } }; int main() { A *a1 = new A(); A *a2 = new A(); return 0; }

Question 17 of 40
★ FPSC ★ PPSC

Which of the following is called extraction/get from operator?

Question 18 of 40
★ FPSC ★ PPSC

Which of the following is called address operator?

Question 19 of 40
★ FPSC ★ PPSC

What is name mangling in C++?

Question 20 of 40
★ FPSC ★ PPSC

What is the size of a boolean variable in C++?

Question 21 of 40
★ FPSC ★ PPSC

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

Question 22 of 40
★ FPSC ★ PPSC

Which of the following is correct?

Question 23 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include<iostream> using namespace std; class A { ~A(){ cout<<"Destructor called\n"; } }; int main() { A a; return 0; }

Question 24 of 40
★ FPSC ★ PPSC

Why this pointer is used?

Question 25 of 40
★ FPSC ★ PPSC

Which of the following is correct about static variables?

Question 26 of 40
★ FPSC ★ PPSC

Which of the following syntax can be used to use a member of a namespace without including that namespace?

Question 27 of 40
★ FPSC ★ PPSC

Who created C++?

Question 28 of 40
★ FPSC ★ PPSC

Which of the following is correct about static polymorphism?

Question 29 of 40
★ FPSC ★ PPSC

Which of the following is the scope resolution operator?

Question 30 of 40
★ FPSC ★ PPSC

What happens if the following program is executed in C and C++? #include <stdio.h> void main() { printf("Hello World"); }

Question 31 of 40
★ FPSC ★ PPSC

Which of the following is an entry-controlled loop?

Question 32 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> int const s=9; int main() { std::cout << s; return 0; }

Question 33 of 40
★ FPSC ★ PPSC

Which concept is used to implement late binding?

Question 34 of 40
★ FPSC ★ PPSC

Which of the following cannot be used with the virtual keyword?

Question 35 of 40
★ FPSC ★ PPSC

What happens if the following program is executed in C and C++? #include <stdio.h> int main(void) { int new = 5; printf("%d", new); }

Question 36 of 40
★ FPSC ★ PPSC

Which of the following is an exit-controlled loop?

Question 37 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; class Test { static int x; public: Test() { x++; } static int getX() {return x;} }; int Test::x = 0; int main() { cout << Test::getX() << " "; Test t[5]; cout << Test::getX(); }

Question 38 of 40
★ FPSC ★ PPSC

What happens if the following program is executed in C and C++? #include<stdio.h> int main() { foo(); } int foo() { printf("Hello"); return 0; }

Question 39 of 40
★ FPSC ★ PPSC

Which of the following is C++ equivalent for scanf()?

Question 40 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include<iostream> using namespace std; int x = 1; int main() { int x = 2; { int x = 3; cout << ::x << endl; } return 0; }

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

💡 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.

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →