Skip to main content

C Plus Plus Miscellaneous — Part 1 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on C Plus Plus Miscellaneous — Part 1 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 will be the output of the following C++ code? #include <iostream> #include <complex> using namespace std; int main() { complex <double> cn(3.0, 5.0); cout<<"Complex number is: "<<real(cn)<<" + "<<imag(cn)<<"i"<<endl; return 0; }

Question 2 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> #include <vector> #include <algorithm> using namespace std; void Display(const vector<int>& vi) { for (size_t i = 0; i < vi.size(); ++i) cout << vi[i]; cout<<endl; } int main() { vector<int> vi; vi.push_back(3); vi.push_back(5); sort(vi.begin(), vi.end()); Display(vi); while(next_permutation(vi.begin(), vi.end())) Display(vi); return 0; }

Question 3 of 40
★ FPSC ★ PPSC

What is the difference between '++i' and 'i++' in C++?

Question 4 of 40
★ FPSC ★ PPSC

What does the 'const' qualifier indicate in C++?

Question 5 of 40
★ FPSC ★ PPSC

What is the purpose of the 'inline' keyword in C++?

Question 6 of 40
★ FPSC ★ PPSC

What is the purpose of the 'volatile' qualifier in C++?

Question 7 of 40
★ FPSC ★ PPSC

Which of the following is a valid way to initialize a constant variable in C++?

Question 8 of 40
★ FPSC ★ PPSC

What is the purpose of the 'using' directive in C++?

Question 9 of 40
★ FPSC ★ PPSC

Which of the following is not a valid C++ data type?

Question 10 of 40
★ FPSC ★ PPSC

What is the purpose of the typeid operator in C++?

Question 11 of 40
★ FPSC ★ PPSC

What does the mutable keyword in C++ mean when applied to a class member function?

Question 12 of 40
★ FPSC ★ PPSC

Which of the following correctly defines a lambda function in C++?

Question 13 of 40
★ FPSC ★ PPSC

What is the purpose of the static_cast operator in C++?

Question 14 of 40
★ FPSC ★ PPSC

Which of the following is not a valid way to initialize an array in C++?

Question 15 of 40
★ FPSC ★ PPSC

What does the nullptr keyword represent in C++?

Question 16 of 40
★ FPSC ★ PPSC

What is the purpose of the std::move function in C++?

Question 17 of 40
★ FPSC ★ PPSC

What is the purpose of the std::initializer_list class in C++?

Question 18 of 40
★ FPSC ★ PPSC

What is the purpose of the volatile keyword in C++?

Question 19 of 40
★ FPSC ★ PPSC

Which of the following is not a valid C++ standard library container?

Question 20 of 40
★ FPSC ★ PPSC

What is the purpose of the const keyword in C++?

Question 21 of 40
★ FPSC ★ PPSC

What does RAII stand for in C++?

Question 22 of 40
★ FPSC ★ PPSC

Which class is used to design the base class?

Question 23 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> #include <limits> using namespace std; int main( ) { cout << numeric_limits<float> :: is_exact; cout << numeric_limits<double> :: is_exact; cout << numeric_limits<long int> :: is_exact; cout << numeric_limits<unsigned char> :: is_exact; }

Question 24 of 40
★ FPSC ★ PPSC

Where does the abstract class is used?

Question 25 of 40
★ FPSC ★ PPSC

Which is the best design choice for using pointer to member function?

Question 26 of 40
★ FPSC ★ PPSC

Which function is used to check whether a character is punctuation mark?

Question 27 of 40
★ FPSC ★ PPSC

Which function is used to calculate the norm of a complex number?

Question 28 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> #include <cctype> using namespace std; int main(int argc, char const *argv[]) { char arr[20] = "\'H3ll0\'"; for(int i=0;i<8;i++) { cout<<(bool)ispunct(arr[i]); } }

Question 29 of 40
★ FPSC ★ PPSC

What is the syntax of printing the first element of an array Arr using get() function?

Question 30 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> #include <vector> #include <forward_list> using namespace std; int main() { forward_list<int> fl1 = {1,7,8,9,10}; forward_list<int> fl2 = {2,3,4,5,6}; fl1.splice_after(fl1.begin(), fl2); for (int&c : fl1) cout << c << " "; cout<<endl; return 0; }

Question 31 of 40
★ FPSC ★ PPSC

Which of the following is correct about map and multimap?

Question 32 of 40
★ FPSC ★ PPSC

Which of the following is correct about Input Iterators?

Question 33 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> #include <functional> #include <numeric> using namespace std; int myop (int x, int y) { return x + y; } int main () { int val[] = {1, 2, 3, 5}; int result[7]; adjacent_difference (val, val + 7, result); for (int i = 0; i < 4; i++) cout << result[i] <<' '; return 0; }

Question 34 of 40
★ FPSC ★ PPSC

Pick the incorrect statement.

Question 35 of 40
★ FPSC ★ PPSC

Given below classes which of the following are the possible row entries in vtable of D1 class? class Base { public: virtual void function1() {}; virtual void function2() {}; }; class D1: public Base { public: virtual void function1() {}; }; class D2: public Base { public: virtual void function2() {}; };

Question 36 of 40
★ FPSC ★ PPSC

What will be the capacity of the vector after 10 is pushed into the vector in the following C++ code? #include <iostream> #include <vector> using namespace std; int main() { vector<int> v; for (int i = 1; i <= 5; i++) v.push_back(i); cout<<v.capacity()<<endl; v.shrink_to_fit(); cout<<v.capacity()<<endl; v.push_back(10); return 0; }

Question 37 of 40
★ FPSC ★ PPSC

Which header file is used for generating random numbers?

Question 38 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include<iostream> using namespace std; class X { int m; public: X() : m(10) { } X(int mm): m(mm) { } int getm() { return m; } }; class Y : public X { int n; public: Y(int nn) : n(nn) {} int getn() { return n; } }; int main() { Y yobj( 100 ); cout << yobj.getm() << " " << yobj.getn() << endl; }

Question 39 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> #include <bitset> using namespace std; int main() { bitset<8> b1(95); bitset<8> b2(45); cout<<~b1<<endl; cout<<(b1|b2)<<endl; cout<<(b1&b2)<<endl; }

Question 40 of 40
★ FPSC ★ PPSC

Which function is used to check whether a character is a number?

✓ 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 →