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
Question 2: Which of the following is the correct operator to compare two variables?
(A) :=
(B) =
(C) equal
(D) ==
Question 3: Variables that are declared inside a function are called as ______.
(A) local
(B) global
(C) scope
(D) external
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 (:)
Question 5: __________ is a newline character in c++.
(A) end
(B) endl
(C) \t
(D) ;
Question 6: If and the switch statements are called as _____ statements.
(A) iteration
(B) jump
(C) selection
(D) conditional
Question 7: The switch expression must be of type _______ or _______.
(A) char, float
(B) float, int
(C) int, char
(D) har, float
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
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
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
Question 11: getline() and write() are _________ oriented functions.
(A) line
(B) character
(C) data
(D) integer
Question 12: The general form, of assignment operator is _____.
(A) variable_name=expression
(B) datatype=expression
(C) variable=expression
(D) datatype=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
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
Question 15: The name of a function variable or class is called ________.
(A) libraries
(B) stream
(C) identifiers
(D) keywords
Question 16: >> is called as __________ operator.
(A) insertion
(B) extraction
(C) greater than
(D) lesser than
Question 17: << is called as _______________ operator.
(A) insertion
(B) extraction
(C) greater than
(D) esser than
Question 18: Arguments of functions are separated with ________.
(A) comma (,)
(B) semicolon (;)
(C) colon (:)
(D) dot(.)
Question 19: _____________ is a variable preserves its value between function calls.
(A) extern
(B) auto
(C) register
(D) static
Question 20: ________ supports simultaneous input and output operations on file.
(A) ifstream
(B) fopen
(C) ostream
(D) fstream
Question 21: ________ is a default access specifier for members of class in C++.
(A) protected
(B) public
(C) private
(D) default
Question 22: A Class can have how many destructor?
(A) 1
(B) 2
(C) 3
(D) 4
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
Question 24: Data members is also called?
(A) Attribute
(B) Method
(C) Class
(D) Object
Question 25: In how many ways is polymorphism achived in C++?
(A) 2
(B) 1
(C) 3
(D) 4
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
Question 27: The ______ keyword brings the members of a namespace into view.
(A) view
(B) using
(C) additive
(D) show
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
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
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
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
Question 32: Which of the following is not a keyword?
(A) inherit
(B) auto
(C) extern
(D) void
Question 33: The expression 5/2 in c++ is evaluated to ____________.
(A) 2
(B) 3
(C) 2.5
(D) 0
Question 34: The result of the expression 15%3 in c++ is ___________.
(A) 5
(B) 3
(C) 0
(D) error
Question 35: An ____________ is a collection of elements of same data type.
(A) structure
(B) union
(C) class
(D) array
Question 36: ______________ operator has the lowest priority.
(A) ,
(B) ++
(C) *
(D) +
Question 37: ___________ variables can be initialized only once.
(A) void
(B) static
(C) const
(D) int
Question 38: Static variables can be ______________.
(A) cannot be created
(B) initialized only once.
(C) a constant
(D) a class
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.
Question 40: What is the syntax of friend function?
(A) friend class1 Class2;
(B) friend class;
(C) friend class
(D) classfriend