Skip to main content

Variables And Data Types In C Plus Plus — Part 2 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Variables And Data Types In 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 way to declare a pointer to a character in C++?

Question 2 of 40
★ FPSC ★ PPSC

What does the 'volatile' keyword indicate in C++?

Question 3 of 40
★ FPSC ★ PPSC

What is the output of the following code: cout << (true && true); in C++?

Question 4 of 40
★ FPSC ★ PPSC

Which type is best suited to represent the logical values?

Question 5 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ function? int main() { register int i = 1; int *ptr = &i; cout << *ptr; return 0; }

Question 6 of 40
★ FPSC ★ PPSC

What is the value of the bool? bool is_int(789.54)

Question 7 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { char c = 74; cout << c; return 0; }

Question 8 of 40
★ FPSC ★ PPSC

Evaluate the following. (false && true) || false || true

Question 9 of 40
★ FPSC ★ PPSC

The size_t integer type in C++ is?

Question 10 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int a = 10; if (a < 10) { for (i = 0; i < 10; i++) cout << i; } else { cout << i; } return 0; }

Question 11 of 40
★ FPSC ★ PPSC

What happens when a null pointer is converted into bool?

Question 12 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { float i = 123.0f; cout << i << endl; return 0; }

Question 13 of 40
★ FPSC ★ PPSC

Pick the odd one out.

Question 14 of 40
★ FPSC ★ PPSC

How many characters are specified in the ASCII scheme?

Question 15 of 40
★ FPSC ★ PPSC

Choose the correct option. extern int i; int i;

Question 16 of 40
★ FPSC ★ PPSC

Which is used to indicate single precision value?

Question 17 of 40
★ FPSC ★ PPSC

0946, 786427373824, 'x' and 0X2f are . . . . . . . . and . . . . . . . . literals respectively.

Question 18 of 40
★ FPSC ★ PPSC

In which type do the enumerators are stored by the compiler?

Question 19 of 40
★ FPSC ★ PPSC

The value 132.54 can be represented using which data type?

Question 20 of 40
★ FPSC ★ PPSC

What is the size of wchar_t in C++?

Question 21 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int x = -1; unsigned int y = 2; if(x > y) { cout << "x is greater"; } else { cout << "y is greater"; } }

Question 22 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; void addprint() { static int s = 1; s++; cout << s; } int main() { addprint(); addprint(); addprint(); return 0; }

Question 23 of 40
★ FPSC ★ PPSC

What is the value of p in the following C++ code? #include <iostream> using namespace std; int main() { int p; bool a = true; bool b = false; int x = 10; int y = 5; p = ((x | y) + (a + b)); cout << p; return 0; }

Question 24 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int f(int p, int q) { if (p > q) return p; else return q; } main() { int a = 5, b = 10; int k; bool x = true; bool y = f(a, b); k =((a * b) + (x + y)); cout << k; }

Question 25 of 40
★ FPSC ★ PPSC

Which of these expressions will return true if the input integer v is a power of two?

Question 26 of 40
★ FPSC ★ PPSC

What constant defined in <climits> header returns the number of bits in a char?

Question 27 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <stdio.h> int main() { char a = '\012'; printf("%d", a); return 0; }

Question 28 of 40
★ FPSC ★ PPSC

What will happen when defining the enumerated type?

Question 29 of 40
★ FPSC ★ PPSC

When a language has the capability to produce new data type mean, it can be called as

Question 30 of 40
★ FPSC ★ PPSC

Which of the given statements are false i. extern int func; ii. extern int func2(int,int); iii. int func2(int,int); iv. extern class foo;

Question 31 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int i = 3; int l = i / -2; int k = i % -2; cout << l << k; return 0; }

Question 32 of 40
★ FPSC ★ PPSC

What does the following statement mean? void a;

Question 33 of 40
★ FPSC ★ PPSC

What is the value of the following 8-bit integer after all statements are executed? int x = 1; x = x << 7; x = x >> 7;

Question 34 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int num = 0x20 + 020 + 20; cout << sizeof(num)<<'\n'; return 0; }

Question 35 of 40
★ FPSC ★ PPSC

Which of the following will not return a value?

Question 36 of 40
★ FPSC ★ PPSC

Suppose in a hypothetical machine, the size of char is 32 bits. What would sizeof(char) return?

Question 37 of 40
★ FPSC ★ PPSC

Is bool a fundamental data type in C++?

Question 38 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int a = 8; cout << "ANDing integer 'a' with 'true' :" << (a && true); return 0; }

Question 39 of 40
★ FPSC ★ PPSC

Which data type is used to represent the absence of parameters?

Question 40 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { enum channel {star, sony, zee}; enum symbol {hash, star}; int i = 0; for (i = star; i <= zee; i++) { printf("%d ", i); } 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 →