Hey Guys Welcome to CSE Study247, This page provides you 20 Basic C++ Programming MCQs SET-1 which is useful for Semester and competitive exams.
Q.1 Who is the developer of the C++ programming language?
Dennis Ritchie
Charles Babbage
Bjarne Stroustrup
None
Explanation
C++ was created by Bjarne Stroustrup at Bell Labs starting in 1979 as an extension of the C programming language.
Q.2 In which year was C++ developed?
1972
1978
1979
1996
Explanation
Bjarne Stroustrup began working on ‘C with Classes’ in 1979, which was later renamed to C++ in 1983.
Q.3 Which of the following are good reasons to use an object-oriented language?
We can define our own data types
Program statements are simpler than in procedural language
OOP can be taught to correct its own errors
None
Explanation
One of the core strengths of OOP is the ability to create user-defined data types through classes, which allows for better abstraction and encapsulation.
Q.4 What was the name of C++ earlier?
C with classes
C++
CPP
None
Explanation
Before it was officially named C++ in 1983, the language was known as ‘C with Classes’.
Q.5 Which of the following is NOT a character constant?
CSE Study
Enter value of A,B,C
24.56e-04
All of these
Explanation
A character constant in C++ must be a single character enclosed in single quotes. All the options provided are strings or invalid formats, not single character constants.
Q.6 The expression a=7/22*(3.14+2)*3/5; is equal to:
0
5.35
3.14
8.25
Explanation
In C++, integer division of 7/22 results in 0. Since the entire multiplication sequence begins with 0, the final result of the expression is 0.
Q.7 C++ is a _____ language?
Object oriented Programming Language
Semi-Object oriented Programming Language
Procedural Oriented Programming
None
Explanation
C++ is often called semi-object-oriented because it allows programming without classes (procedural style) and does not require every part of the program to be an object, unlike ‘pure’ OOP languages.
Q.8 When a language has the capability to produce new data types, it is known as?
Extensible
Encapsulation
Reprehensible
None
Explanation
While the term ‘extensible’ is often used to describe this capability, the provided answer key for this specific set indicates ‘None’.
Q.9 Which of the following loops is faster?
for
while
do while
All work at the same speed
Explanation
Modern compilers optimize all basic loop structures (for, while, do-while) into similar machine code, so there is generally no performance difference between them.
Q.10 What is the size of the int data type in C++?
1 Byte
2 Byte
3 Byte
Depends on compiler
Explanation
The size of an integer is not fixed by the C++ language standard; it depends on the specific compiler and the architecture of the computer system.
” correct=”b” ans=”The extraction operator (>>) is used with the ‘cin’ object to read data from the standard input device.”]
” b=”float (*a)[9]” c=”float*a[9]” d=”None” correct=”b” ans=”The syntax ‘float (*a)[9]’ declares a single pointer that points to an entire array of 9 floating-point numbers.”]
Q.13 Which type of language is C++?
Statically typed language
Dynamic typed language
Procedural
None
Explanation
C++ is a statically typed language, meaning that the data type of every variable is checked at compile time rather than at runtime.
Q.14 Which type of language is C++?
Low level
High level
Middle level
None
Explanation
C++ is classified as a high-level language because it provides strong abstraction from the hardware and uses human-readable syntax, though it also offers low-level memory manipulation features.
Q.15 How many types of constructors are in C++?
1
2
3
None
Explanation
There are three main types of constructors: Default Constructor (no arguments), Parameterized Constructor (with arguments), and Copy Constructor (initializes an object using another object of the same class).
Q.16 A C++ stream is:
Flow of control through a function
A flow of data from one place to another
A File
None
Explanation
In C++, a stream is an abstraction that represents a flow of data between a source (like a keyboard or file) and a destination (like a screen or file).
Q.17 A C++ class holds:
Data
Function
Both A & B
None
Explanation
A class is a blueprint that groups together both data members (variables) and member functions (methods) into a single unit.
Q.18 Which of the following symbols is used to denote a pre-processor?
*
#
@
%
Explanation
The hash symbol (#) is used to identify pre-processor directives, such as #include or #define, which are processed before the actual compilation begins.
Q.19 A C++ statement ends with a:
:
;
?
Explanation
The semicolon (;) is the statement terminator in C++, used to signify the end of a logical instruction.
Q.20 Function Overriding is an example of?
Compile time polymorphism
Runtime Polymorphism
Both A & B
None
Explanation
Function overriding allows a derived class to provide a specific implementation of a method already defined in its base class, which is resolved during program execution (Runtime Polymorphism).
Some Important Link
| 1. Official Telegram | Click Here |
| 2. Telegram For CSE MCQs | Click Here |
| 3. You Tube | Click Here |