C++ Quiz – 3

C++ MCQ Questions
Play C++ Quiz
C++ MCQ Quiz 1 (Basic)
C++ Quiz 2 (Function-Class)
Advance C++ Quiz 3 (OOP-Function-Class-Object)

CPP Quiz 3


Question 1: ___________ is not a type of scope in c++.

(A) Global

(B) Local

(C) File

(D) Function

View Answer
(D) Function

Question 2: Which of the following is the correct operator to compare two variables?

(A) :=

(B) =

(C) equal

(D) ==

View Answer
(D) ==

Question 3: Variables that are declared inside a function are called as ______.

(A) local

(B) global

(C) scope

(D) external

View Answer
(A) local

Question 4: Most of the statement in C++ program should end with ______.

(A) a full stop (.)

(B) `a comma (,)

(C) a semicolon (;)

(D) a colon (:)

View Answer
(C) a semicolon (;)

Question 5: __________ is a newline character in c++.

(A) end

(B) endl

(C) \t

(D) ;

View Answer
(B) endl

Question 6: If and the switch statements are called as _____ statements.

(A) iteration

(B) jump

(C) selection

(D) conditional

View Answer
(C) selection

Question 7: The switch expression must be of type _______ or _______.

(A) char, float

(B) float, int

(C) int, char

(D) har, float

View Answer
(C) int, char

Question 8: Find out the error in following block of code. if (x=100) cout<<“x is 100”;

(A) 100 should be enclosed in quotations

(B) There is no semicolon at the end of first line

(C) Equals to operator mistake

(D) Variable x should not be inside quotation

View Answer
(C) Equals to operator mistake

Question 9: Looping in a program means _____.

(A) jumping to the specified branch of program.

(B) repeat the specified lines of code

(C) execute only once

(D) jump to random location of the program

View Answer
(B) repeat the specified lines of code

Question 10: If the type specifier of parameters of a function is followed by an ampersand (&), that function call is _______.

(A) pass by value

(B) pass by reference

(C) array of structures

(D) array of structures. pointers

View Answer
(B) pass by reference

Question 11: getline() and write() are _________ oriented functions.

(A) line

(B) character

(C) data

(D) integer

View Answer
(A) line

Question 12: The general form, of assignment operator is _____.

(A) variable_name=expression

(B) datatype=expression

(C) variable=expression

(D) datatype=expression

View Answer
(A) variable_name=expression

Question 13: Overloaded functions are ______.

(A) very long functions that can hardly run

(B) two or more functions with the same name but different number of parameters or type

(C) short functions that can easily modified

(D) one function containing another one or more functions inside it

View Answer
(B) two or more functions with the same name but different number of parameters or type

Question 14: ________ function is a function in which expansion of the function takes place rather than execution.

(A) Friend

(B) Inline

(C) Recursive

(D) Member

View Answer
(B) Inline

Question 15: The name of a function variable or class is called ________.

(A) libraries

(B) stream

(C) identifiers

(D) keywords

View Answer
(C) identifiers

Question 16: >> is called as __________ operator.

(A) insertion

(B) extraction

(C) greater than

(D) lesser than

View Answer
(B) extraction

Question 17: << is called as _______________ operator.

(A) insertion

(B) extraction

(C) greater than

(D) esser than

View Answer
(A) insertion

Question 18: Arguments of functions are separated with ________.

(A) comma (,)

(B) semicolon (;)

(C) colon (:)

(D) dot(.)

View Answer
(A) comma (,)

Question 19: _____________ is a variable preserves its value between function calls.

(A) extern

(B) auto

(C) register

(D) static

View Answer
(D) static

Question 20:  ________ supports simultaneous input and output operations on file.

(A) ifstream

(B) fopen

(C) ostream

(D) fstream

View Answer
(D) fstream

Question 21: ________ is a default access specifier for members of class in C++.

(A) protected

(B) public

(C) private

(D) default

View Answer
(C) private

Question 22: A Class can have how many destructor?

(A) 1

(B) 2

(C) 3

(D) 4

View Answer
(A) 1

Question 23: The parameter list in function overloading must differ by?

(A) Number of functions

(B) Function Size

(C) Function Name

(D) Number of argument

View Answer
(D) Number of argument

Question 24: Data members is also called?

(A) Attribute

(B) Method

(C) Class

(D) Object

View Answer
(A) Attribute

Question 25: In how many ways is polymorphism achived in C++?

(A) 2

(B) 1

(C) 3

(D) 4

View Answer
(C) 3

Question 26: A __________ is a special method used to initialize the instance variable of a class.

(A) Member function

(B) Destructor

(C) Constructor

(D) Structure

View Answer
(C) Constructor 

Question 27: The ______ keyword brings the members of a namespace into view.

(A) view

(B) using

(C) additive

(D) show

View Answer
(B) using

Question 28: If class A inherits from class B, then B is called _______ of A. A is called ________ of B.

(A) Super class, Sub class

(B) Subclass, Super class

(C) Abstract class, Base Class

(D) Child class, Sub Class

View Answer
(A) Super class, Sub class

Question 29: ________ is the mechanism which allows a class A to inherit properties of a class B.

(A) Data abstraction

(B) Encapsulation

(C) Inheritance

(D) Polymorphism

View Answer
(C) Inheritance

Question 30: The mechanism that binds code and data together and keeps them secure from outside world is known as _______________.

(A) Abstraction

(B) Encapsulation

(C) Inheritance

(D) Polymorphism

View Answer
(B) Encapsulation

Question 31: To overload an operator_________________ keyword must be used along with the operator to be overloaded.

(A) Over

(B) Overload

(C) void

(D) Operator

View Answer
(D) Operator

Question 32: Which of the following is not a keyword?

(A) inherit

(B) auto

(C) extern

(D) void

View Answer
(A) inherit

Question 33: The expression 5/2 in c++ is evaluated to ____________.

(A) 2

(B) 3

(C) 2.5

(D) 0

View Answer
(A) 2

Question 34: The result of the expression 15%3 in c++ is ___________.

(A) 5

(B) 3

(C) 0

(D) error

View Answer
(C) 0

Question 35: An ____________ is a collection of elements of same data type.

(A) structure

(B) union

(C) class

(D) array

View Answer
(D) array 

Question 36: ______________ operator has the lowest priority.

(A) ,

(B) ++

(C) *

(D) +

View Answer
(A) ,

Question 37: ___________ variables can be initialized only once.

(A) void

(B) static

(C) const

(D) int

View Answer
(B) static

Question 38: Static variables can be ______________.

(A) cannot be created

(B) initialized only once.

(C) a constant

(D) a class

View Answer
(B) initialized only once.

Question 39: Which of the following is true?

(A) presents the standard output stream in c++.

(B) cout declare in the conio standard file.

(C) cout is declared as constants.

(D) cout does nothing in C++ program.

View Answer
(A) presents the standard output stream in c++.

Question 40: What is the syntax of friend function?

(A) friend class1 Class2;

(B) friend class;

(C) friend class

(D) classfriend

View Answer
(A) friend class1 Class2;