Explore topic-wise MCQs in C++ Programming.

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

801.

Which function is used to write a single character to console in C++?

A. cout.put(ch)
B. cout.putline(ch)
C. write(ch)
D. printf(ch)
Answer» B. cout.putline(ch)
802.

Which of the following is used for comments in C++?

A. // comment
B. /* comment */
C. both // comment or /* comment */
D. // comment */
Answer» D. // comment */
803.

What are the formal parameters in C++?

A. Parameters with which functions are called
B. Parameters which are used in the definition of the function
C. Variables other than passed parameters in a function
D. Variables that are never used in the function
Answer» C. Variables other than passed parameters in a function
804.

What are the actual parameters in C++?

A. Parameters with which functions are called
B. Parameters which are used in the definition of a function
C. Variables other than passed parameters in a function
D. Variables that are never used in the function
Answer» B. Parameters which are used in the definition of a function
805.

Which of the following escape sequence represents carriage return?

A. \r
B. \n
C. \n\r
D. \c
Answer» B. \n
806.

Which of the following is a correct identifier in C++?

A. 7var_name
B. 7VARNAME
C. VAR_1234
D. $var_name
Answer» D. $var_name
807.

Which of the following is called address operator?

A. *
B. &
C. _
D. %
Answer» C. _
808.

Which of the following escape sequence represents tab?

A. \t
B. \t\r
C. \b
D. \a
Answer» B. \t\r
809.

What are the escape sequences?

A. Set of characters that convey special meaning in a program
B. Set of characters that whose use are avoided in C++ programs
C. Set of characters that are used in the name of the main function of the program
D. Set of characters that are avoided in cout statements
Answer» B. Set of characters that whose use are avoided in C++ programs
810.

Which function is used to read a single character from the console in C++?

A. cin.get(ch)
B. getline(ch)
C. read(ch)
D. scanf(ch)
Answer» B. getline(ch)
811.

Which of the following is the correct syntax of including a user defined header files in C++?

A. #include <userdefined.h>
B. #include <userdefined>
C. #include “userdefined”
D. #include [userdefined]
Answer» D. #include [userdefined]
812.

Out of the following, which is not a member of the class?

A. Static function
B. Friend function
C. Constant function
D. Virtual function
Answer» C. Constant function
813.

Which of the following provides a programmer with the facility of using object of a class inside other classes?

A. Inheritance
B. Composition
C. Abstraction
D. Encapsulation
Answer» C. Abstraction
814.

How many types of polymorphism are there in C++?

A. 1
B. 2
C. 3
D. 4
Answer» C. 3
815.

Why references are different from pointers?

A. A reference cannot be made null
B. A reference cannot be changed once initialized
C. No extra operator is needed for dereferencing of a reference
D. All of the mentioned
Answer» E.
816.

What is the other name used for functions inside a class?

A. Member variables
B. Member functions
C. Class functions
D. Class variables
Answer» C. Class functions
817.

What does modularity mean?

A. Hiding part of program
B. Subdividing program into small independent parts
C. Overriding parts of program
D. Wrapping things into single unit
Answer» C. Overriding parts of program
818.

Which of the following class allows to declare only one object of it?

A. Abstract class
B. Virtual class
C. Singleton class
D. Friend class
Answer» D. Friend class
819.

How access specifiers in Class helps in Abstraction?

A. They does not helps in any way
B. They allows us to show only required things to outer world
C. They help in keeping things together
D. Abstraction concept is not used in classes
Answer» C. They help in keeping things together
820.

Which of the following cannot be a friend?

A. Function
B. Class
C. Object
D. Operator function
Answer» D. Operator function
821.

How structures and classes in C++ differ?

A. Classes follows OOP concepts whereas structure does not
B. In Structures, members are private by default whereas in Classes they are public by default
C. Structures by default hide every member
D. Classes and Structures are the same
Answer» B. In Structures, members are private by default whereas in Classes they are public by default
822.

A language which has the capability to generate new data types are called ________________

A. Extensible
B. Overloaded
C. Encapsulated
D. Reprehensible
Answer» B. Overloaded
823.

Which of the following is called insertion/put to operator?

A. <<
B. >>
C. >
D. <
Answer» B. >>
824.

Who created C++?

A. Bjarne Stroustrup
B. Dennis Ritchie
C. Ken Thompson
D. Brian Kernighan
Answer» B. Dennis Ritchie
825.

Which of the following shows multiple inheritances?

A. A->B->C
B. A->B; A->C
C. A,B->C
D. B->A
Answer» D. B->A
826.

Wrapping data and its related functionality into a single entity is known as _____________

A. Abstraction
B. Encapsulation
C. Polymorphism
D. Modularity
Answer» C. Polymorphism
827.

What does polymorphism in OOPs mean?

A. Concept of allowing overiding of functions
B. Concept of hiding data
C. Concept of keeping things in differnt modules/files
D. Concept of wrapping things into a single unit
Answer» B. Concept of hiding data
828.

Which concept allows you to reuse the written code?

A. Encapsulation
B. Abstraction
C. Inheritance
D. Polymorphism
Answer» D. Polymorphism
829.

C++ is ______________

A. procedural programming language
B. object oriented programming language
C. functional programming language
D. both procedural and object oriented programming language
Answer» E.
830.

Which of the following is correct about static variables?

A. Static functions do not support polymorphism
B. Static data members cannot be accessed by non-static member functions
C. Static data members functions can access only static data members
D. Static data members functions can access both static and non-static data members
Answer» D. Static data members functions can access both static and non-static data members
831.

Const qualifier can be applied to which of the following?i) Functions inside a classii) Arguments of a functioniii) Static data membersiv) Reference variables

A. i, ii and iii
B. i, ii, iii, and iv
C. ii, iii and iv
D. i only
Answer» C. ii, iii and iv
832.

Which of the following operator(s) can be used with pointers?i) – onlyii) +, *iii) +, –iv) +, -, *v) /vi) + only

A. i only
B. vi only
C. ii and v
D. iv
Answer» B. vi only
833.

What is the other name of run-time polymorphism?

A. Static polymorphism
B. Dynamic polymorphism
C. Executing polymorphism
D. Non-executing polymorphism
Answer» C. Executing polymorphism
834.

Which of the following is correct about dynamic polymorphism?

A. In dynamic polymorphism, the conflict between the function call is resolved during the compile time
B. In dynamic polymorphism, the conflict between the function call is resolved during the run time
C. In dynamic polymorphism, the conflict between the function call is never resolved during the execution of program
D. In dynamic polymorphism, the conflict between the function call is resolved at the beginning of the program
Answer» C. In dynamic polymorphism, the conflict between the function call is never resolved during the execution of program
835.

What is the other name of compile-time polymorphism?

A. Static polymorphism
B. Dynamic polymorphism
C. Executing polymorphism
D. Non-executing polymorphism
Answer» B. Dynamic polymorphism
836.

What is std in C++?

A. std is a standard class in C++
B. std is a standard namespace in C++
C. std is a standard header file in C++
D. std is a standard file reading header in C++
Answer» C. std is a standard header file in C++
837.

How many types of polymorphism are there?

A. 1
B. 2
C. 3
D. 4
Answer» C. 3
838.

Which of the following syntax can be used to use a member of a namespace without including that namespace?

A. namespace::member
B. namespace->member
C. namespace.member
D. namespace~member
Answer» B. namespace->member
839.

Which of the following is correct about static polymorphism?

A. In static polymorphism, the conflict between the function call is resolved during the compile time
B. In static polymorphism, the conflict between the function call is resolved during the run time
C. In static polymorphism, the conflict between the function call is never resolved during the execution of a program
D. In static polymorphism, the conflict between the function call is resolved only if it required
Answer» B. In static polymorphism, the conflict between the function call is resolved during the run time