Explore topic-wise MCQs in C++ Programming.

This section includes 14 Mcqs, each offering curated multiple-choice questions to sharpen your C++ Programming knowledge and support exam preparation. Choose a topic below to get started.

1.

What is the output of this program?
#include 
using namespace std;
int main()
{
char str[20] = "Interview Mania";
cout << str[10];
cout < return 0;
}

A. Mania
B. Interview Mania
C. M Interview Mania
D. Interview
E. None of these
Answer» D. Interview
2.

What is the output of this program?
#include 
using namespace std;
int main()
{
int arr[] = {15, 25, 50};
cout << -2[arr];
return 0;
}

A. 15
B. 25
C. 50
D. -2
E. -50
Answer» F.
3.

What is the output of this program?
#include 
using namespace std;
int main()
{
int p = 15, q = 11, r = 12;
int array[3] = {&p, &q, &r};
cout << *array[*array[1] - 8];
return 0;
}

A. 11
B. 12
C. 15
D. Compilation Error
E. Garbage value
Answer» E. Garbage value
4.

What will be the output of the this program?
#include 
using namespace std;
int main ()
{
int arr[] = {10, 12, 40, 16, 70, 15, 30};
int k, res = 0;
for (k = 0; k < 5; k++) {
res += arr[k];
}
cout << res;
return 0;
}

A. 70
B. 40
C. 30
D. 184
E. 148
Answer» F.
5.

What will be the output of this program?
#include 
using namespace std;
int arr1[] = {150, 50, 230, 130, 160};
int arr2[] = {13, 15, 30, 28, 50};
int temp, res = 0;
int main()
{
for (temp = 0; temp < 5; temp++)
{
res += arr1[temp];
}
for (temp = 0; temp < 4; temp++)
{
res += arr2[temp];
}
cout << res;
return 0;
}

A. 806
B. 150
C. 130
D. 13
E. 15
Answer» B. 150
6.

What is the output of this program?
#include 
using namespace std;
int main()
{
int array[] = {41, 15, 61, 27};
int *ptr = (array + 3);
cout << *ptr;
return 0;
}

A. 41
B. 15
C. 61
D. 27
E. None of these
Answer» E. None of these
7.

What is the output of this program?
#include 
using namespace std;
int main()
{
int k;
char *array[] = {"Red", "Blue", "Green", "Yellow"};
char *(*p)[4] = &array;
cout << ++(*p)[2];
return 0;
}

A. Red
B. Blue
C. Green
D. Yellow
E. reen
Answer» F.
8.

What is the output of this program?
#include 
using namespace std;
int main()
{
int num[10] = {13, 16, 19, 11, 18, 13, 22, 26};
cout << num[1] + 2< return 0;
}

A. 13, 16, 19, 11, 18, 13, 22, 26
B. 18, 13, 22, 26
C. 13, 16, 19, 11, 18
D. 19, 11, 18, 13
E. 18 22 13
Answer» F.
9.

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

A. p is pointer to array of function
B. p is pointer to function
C. p is array of pointer to function
D. p is pointer to such function which return type is the array
E. None of these
Answer» D. p is pointer to such function which return type is the array
10.

Which of the following accesses the ninth element stored in array?

A. array;
B. array[8];
C. array[7];
D. array(10);
E. None of these
Answer» C. array[7];
11.

What is the index number of the last element of an array with 12 elements?

A. 1
B. 2
C. 11
D. 10
E. Programmer-defined
Answer» D. 10
12.

What will be the output of the this program?

A. 70
B. 40
C. 30
D. 184
E. 148
Answer» F.
13.

What will be the output of this program?

A. 806
B. 150
C. 130
D. 13
E. 15
Answer» B. 150
14.

What is the meaning of the following declaration?

A. p is pointer to array of function
B. p is pointer to function
C. p is array of pointer to function
D. p is pointer to such function which return type is the array
E. None of these
Answer» D. p is pointer to such function which return type is the array