Skip to main content

Pointers And References In C Plus Plus — Part 2 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Pointers And References 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 will be the output of the following C++ code? #include <iostream> #include <string> #include <cstdlib> using namespace std; int main(int argc, char const *argv[]) { int a = 5; int *p = &a; int &q = a; cout<<p<<endl; cout<<q<<endl; return 0; }

Question 2 of 40
★ FPSC ★ PPSC

How to declare a wide character in the string literal?

Question 3 of 40
★ FPSC ★ PPSC

Pick the correct statement about references.

Question 4 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int main () { int numbers[5]; int * p; p = numbers; *p = 10; p++; *p = 20; p = &numbers[2]; *p = 30; p = numbers + 3; *p = 40; p = numbers; *(p + 4) = 50; for (int n = 0; n < 5; n++) cout << numbers[n] << ","; return 0; }

Question 5 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstdlib> using namespace std; void func(const int &a) { int temp = 10; a = temp; cout<<a; } int main(int argc, char const *argv[]) { int a = 5; func(a); return 0; }

Question 6 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int i; char c; void *data; i = 2; c = 'd'; data = &i; cout << "the data points to the integer value" << data; data = &c; cout << "the data now points to the character" << data; return 0; }

Question 7 of 40
★ FPSC ★ PPSC

Regarding the following statement which of the statements is true? const int a = 100;

Question 8 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { char *ptr; char Str[] = "abcdefg"; ptr = Str; ptr += 5; cout << ptr; return 0; }

Question 9 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstdlib> using namespace std; int main(int argc, char const *argv[]) { int a = 5; int &q = a; cout<<&a<<endl; cout<<&q<<endl; return 0; }

Question 10 of 40
★ FPSC ★ PPSC

The pointer can point to any variable that is not declared with which of these?

Question 11 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; void swap(int &a, int &b); int main() { int a = 5, b = 10; swap(a, b); cout << "In main " << a << b; return 0; } void swap(int &a, int &b) { int temp; temp = a; a = b; b = temp; cout << "In swap " << a << b; }

Question 12 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int a = 5, b = 10, c = 15; int *arr[ ] = {&a, &b, &c}; cout << arr[1]; return 0; }

Question 13 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include<iostream> using namespace std; int main() { int x = 10; int& ref = x; ref = 20; cout << x << endl ; x = 30; cout << ref << endl; return 0; }

Question 14 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int a[2][4] = {3, 6, 9, 12, 15, 18, 21, 24}; cout << *(a[1] + 2) << *(*(a + 1) + 2) << 2[1[a]]; return 0; }

Question 15 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int i; const char *arr[] = {"C", "C++", "Java", "VBA"}; const char *(*ptr)[4] = &arr; cout << ++(*ptr)[2]; return 0; }

Question 16 of 40
★ FPSC ★ PPSC

Pick the correct statement about references in C++.

Question 17 of 40
★ FPSC ★ PPSC

A void pointer cannot point to which of these?

Question 18 of 40
★ FPSC ★ PPSC

Identify the correct sentence regarding inequality between reference and pointer.

Question 19 of 40
★ FPSC ★ PPSC

Which of the following is illegal?

Question 20 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstdlib> using namespace std; int main(int argc, char const *argv[]) { int a = 5; int *p = &a; int *(&q) = p; cout<<q; return 0; }

Question 21 of 40
★ FPSC ★ PPSC

Which one of the following is not a possible state for a pointer.

Question 22 of 40
★ FPSC ★ PPSC

Which value can we not assign to reference?

Question 23 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int f(int &x, int c) { c = c - 1; if (c == 0) return 1; x = x + 1; return f(x, c) * x; } int main(int argc, char const *argv[]) { int a = 4; cout<<f(a,a); return 0; }

Question 24 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstdlib> using namespace std; int main(int argc, char const *argv[]) { int &q = NULL; cout<<q; return 0; }

Question 25 of 40
★ FPSC ★ PPSC

Which reference modifier is used to define the reference variable?

Question 26 of 40
★ FPSC ★ PPSC

The operator used for dereferencing or indirection is . . . . . . . .

Question 27 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstdlib> using namespace std; int main(int argc, char const *argv[]) { int &q = 5; cout<<q; return 0; }

Question 28 of 40
★ FPSC ★ PPSC

When does the void pointer can be dereferenced?

Question 29 of 40
★ FPSC ★ PPSC

The constants are also called as . . . . . . . .

Question 30 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int arr[] = {4, 5, 6, 7}; int *p = (arr + 1); cout << *arr + 9; return 0; }

Question 31 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstdlib> using namespace std; int main(int argc, char const *argv[]) { int &p; int a = 5; &p = a; cout<<p; return 0; }

Question 32 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { char arr[20]; int i; for(i = 0; i < 10; i++) *(arr + i) = 65 + i; *(arr + i) = '\0'; cout << arr; return(0); }

Question 33 of 40
★ FPSC ★ PPSC

What are the parts of the literal constants?

Question 34 of 40
★ FPSC ★ PPSC

What is the meaning of the following declaration? int(*p[5])();

Question 35 of 40
★ FPSC ★ PPSC

What will happen in the following C++ code snippet? int a = 100, b = 200; int *p = &a, *q = &b; p = q;

Question 36 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; #define PI 3.14159 int main () { float r = 2; float circle; circle = 2 * PI * r; cout << circle; return 0; }

Question 37 of 40
★ FPSC ★ PPSC

What is the difference between references and pointers?

Question 38 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int *p; void *vp; if (vp == p) cout << "equal"; return 0; }

Question 39 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include<iostream> using namespace std; int &fun() { static int x = 10; return x; } int main() { fun() = 30; cout << fun(); return 0; }

Question 40 of 40
★ FPSC ★ PPSC

What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstdlib> using namespace std; int main(int argc, char const *argv[]) { int a = 5; int *p = &a; int &q = p; cout<<p; 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 →