C++ MCQ’s

C++ MCQ’s Home Page

C++ Basic 1
C++ Basic 2
C++ Basic 3
C++ Basic 4
C++ Basic 5
C++ OOPs Concepts 1
C++ OOPs Concepts 2
C++ OOPs Concepts 3
C++ OOPs Concepts 4
C++ OOPs Concepts 5

 

C++ Language MCQ’S | OOPs Concepts Set 3

6.
What is name mangling in C++?

a) The process of adding more information to a function name so that it can be distinguished from other functions by the compiler
b) The process of making common names for all the function of C++ program for better use
c) The process of changing the names of variable
d) The process of declaring variables of different types

 

7.
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;
}

a) Output in C is 1 and in C++ is 4
b) Output in C is 4 and in C++ is 1
c) Output in C is 1 and in C++ is 1
d) Output in C is 4 and in C++ is 4

 

8.
What will be the output of the following C++ code?

#include<stdio.h>
int main(int argc, char const *argv[])
{
char a = ‘a’;
printf(“%d\n”, (int)sizeof(a));
return 0;
}

a) Output in C is 1 and in C++ is 4
b) Output in C is 4 and in C++ is 1
c) Output in C is 1 and in C++ is 1
d) Output in C is 4 and in C++ is 4

 

9.
Which of the following syntax for declaring a variable of struct STRUCT can be used in both C and C++?

a) struct STRUCT S;
b) STRUCT S;
c) Both struct STRUCT S; and STRUCT S;
d) Both C and C++ have different syntax

 

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

a) Error in C but not in C++
b) Error in C++ but not in C
c) No error in both C and C++
d) Error in both C and C++

 

Visitor Counter

0056727