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

 

Cpp MCQ’S | Basics 1

21.
What happens if the following program is executed in C and C++?

#include <stdio.h>
void func(void)
{
printf(“Hello”);
}
void main()
{
func();
func(2);
}

a) Error in both C and C++
b) Outputs Hello twice in both C and C++
c) Error in C and successful execution in C++
d) Error in C++ and successful execution in C

 

22.
What happens if the following program is executed in C and C++?

#include <stdio.h>
void func()
{
printf(“Hello”);
}
void main()
{
func();
func(2);
}

a) Error in both C and C++
b) Outputs Hello twice in both C and C++
c) Error in C and Outputs Hello twice in C++
d) Error in C++ and Outputs Hello twice in C

 

23.
Which of the following type is provided by C++ but not C?

a) int
b) bool
c) float
d) double

 

24.
Which of the following feature is not provided by C?

a) Pointers
b) Structures
c) References
d) Functions

 

25.
Which of the following statement is correct?

a) Structure in C allows Constructor definition
b) Structure in C++ allows Constructor definition
c) Both allow Constructor definition
d) C allows constructor definition while C++ does not