Professional Documents
Culture Documents
•A. print()
•B. cin
•C. output()
•D. scanf()
(Answer: B)
3. In C++, what is the keyword used to define a class?
•A. struct
•B. class
•C. type
•D. object
(Answer: B)
4. Which library should be included to use the sqrt() function in C++?
•A. cmath
•B. math.h
•C. iostream
•D. iomanip
(Answer: A)
5. What is the purpose of variables in C++?
Which C++ keyword is used to dynamically allocate memory for a variable in the
heap?
•A. stack
•B. alloc
•C. malloc
•D. new
(Answer: D)
12.In C++, what is the purpose of the break statement in a loop?
•A. Big-O
•B. Big-Theta
•C. Big-Omega
•D. All represent the same bound
(Answer: A)
What is the purpose of the virtual keyword in C++ in the context of object-
oriented programming?
•A. Queue
•B. Set
•C. Stack
•D. List
(Answer: C)
23.What is the role of the std::cin.ignore() function in C++?
•A. O(n)
•B. O(log n)
•C. O(n^2)
•D. O(1)
(Answer: B)
25.In C++, what is the purpose of the nullptr keyword?
•A. void
•B. loop
•C. execute
•D. output
(Answer: A)
28.What does the const qualifier mean when applied to a member
function in a C++ class?
•A. begin
•B. start
•C. function
•D. void
(Answer: D)
32.What is the purpose of the getline() function in C++?
•A. cmath
•B. cstdlib
•C. cstring
•D. cstdio
(Answer: B)
35.What is the primary purpose of the do-while loop in C++?
What is the purpose of the friend keyword in C++ when used in the context of
classes?
•A. immutable
•B. unchangeable
•C. const
•D. readonly
(Answer: C)
43.In C++, what is the purpose of the typeid operator when used with
type_info objects?
•A. catch
•B. finally
•C. throw
•D. try
(Answer: C)
46.What is the role of the const_iterator in C++ when used with
containers?
In C++, what does the auto keyword indicate when used for variable
declaration?