InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 51. |
How can the member functions in the container be accessed?(a) Iterator(b) Indirect(c) Both Iterator & Indirect(d) VectorThe question was posed to me during an internship interview.This interesting question is from Container Design in division Class Hierarchies, Library & Containers of C++ |
|
Answer» The correct OPTION is (a) Iterator |
|
| 52. |
Which operators are used in the free store?(a) new(b) delete(c) both new & delete(d) terminateThis question was addressed to me at a job interview.Asked question is from Free Store topic in section Class Hierarchies, Library & Containers of C++ |
|
Answer» Correct answer is (C) both new & delete |
|
| 53. |
What is the Run-Time Type Information?(a) Information about an object’s data type at runtime(b) Information about the variables(c) Information about the given block(d) Information about the functionsThe question was asked in quiz.The doubt is from Run Time Type Information in chapter Class Hierarchies, Library & Containers of C++ |
|
Answer» The correct option is (a) Information about an object’s DATA type at RUNTIME |
|
| 54. |
What is Inheritance in C++?(a) Wrapping of data into a single class(b) Deriving new classes from existing classes(c) Overloading of classes(d) Classes with same namesThe question was asked in class test.This interesting question is from Inheritance topic in division Class Hierarchies, Library & Containers of C++ |
|
Answer» Correct ANSWER is (B) Deriving NEW classes from EXISTING classes |
|
| 55. |
What is the use of clog?(a) Standard logging stream(b) Error stream(c) Input stream(d) output streamThe question was posed to me during an interview for a job.I want to ask this question from Class Hierarchies Introduction in section Class Hierarchies, Library & Containers of C++ |
|
Answer» Correct option is (a) Standard LOGGING stream |
|
| 56. |
Which container is used to keep priority based elements?(a) queue(b) stack(c) set(d) priority queueI got this question by my school teacher while I was bunking the class.Query is from More Containers in portion Class Hierarchies, Library & Containers of C++ |
|
Answer» Right option is (d) priority queue |
|
| 57. |
Which container is best to keep the collection of distinct elements?(a) multimap(b) heap(c) set(d) queueThe question was asked during an interview.This question is from More Containers topic in section Class Hierarchies, Library & Containers of C++ |
|
Answer» CORRECT choice is (c) SET Best explanation: C++ PROVIDES a set container to store a collection of DISTINCT ELEMENTS. This container behaves similar to mathematical sets. |
|
| 58. |
How many types of Association can be there between classes?(a) 1(b) 2(c) 3(d) 4I have been asked this question in unit test.The origin of the question is Class Relationships in chapter Class Hierarchies, Library & Containers of C++ |
|
Answer» Right ANSWER is (d) 4 |
|
| 59. |
What is any in C++?(a) STL container used to store a single value of any type(b) Exception class in C++(c) Fundamental type provided by C++(d) Template data typeThis question was posed to me in my homework.I want to ask this question from STL Container Any in section Class Hierarchies, Library & Containers of C++ |
|
Answer» RIGHT CHOICE is (a) STL CONTAINER used to STORE a single value of any type The explanation: Any is an STL container provided by C++ to store value or objects of any type. |
|
| 60. |
Which of the following operations can be performed on a pair?(a) Assignment of pairs(b) Copying of one pair to another(c) Comparison of two pairs(d) All of the mentionedThe question was asked at a job interview.This is a very interesting question from STL topic in portion Class Hierarchies, Library & Containers of C++ |
|
Answer» Correct CHOICE is (d) All of the mentioned |
|
| 61. |
Which header file is required to use pair container in your program?(a) (b) (c) (d) I had been asked this question in semester exam.The above asked question is from STL in chapter Class Hierarchies, Library & Containers of C++ |
|
Answer» The correct OPTION is (b) |
|
| 62. |
Which function is used to get the total capacity of a vector?(a) v.size()(b) v.capacity()(c) v.max_size()(d) v.no_of_elements()This question was addressed to me during a job interview.This intriguing question comes from seq_con Vector Class in section Class Hierarchies, Library & Containers of C++ |
|
Answer» Correct CHOICE is (b) v.capacity() |
|
| 63. |
Pick the incorrect statement.(a) Vectors have a dynamic size(b) Vectors are placed in contiguous storage(c) Insertion in vectors always takes constant time(d) Vectors insert the element at the endThe question was asked during an interview for a job.My enquiry is from seq_con Vector Class in chapter Class Hierarchies, Library & Containers of C++ |
|
Answer» The correct option is (c) INSERTION in vectors always takes CONSTANT time |
|
| 64. |
Which of the follwoing function(s) of Array classes are similar to [] operator?(a) at()(b) get()(c) both at() and get()(d) front()I had been asked this question in exam.I'd like to ask this question from seq_con Array Class topic in division Class Hierarchies, Library & Containers of C++ |
|
Answer» The correct CHOICE is (c) both at() and GET() |
|
| 65. |
What do container adapter provide to interface?(a) Restricted interface(b) More interface(c) No interface(d) Memory interfaceThe question was asked during a job interview.This is a very interesting question from Sequence Adapters in section Class Hierarchies, Library & Containers of C++ |
|
Answer» RIGHT option is (a) Restricted interface To EXPLAIN: A container adapter PROVIDES a restricted interface to a container.In PARTICULAR, adapters do not provide iterators; they are intended to be used only through their SPECIALIZED interfaces. |
|
| 66. |
Which of the following type does the container should define?(a) Iterator type(b) Vector type(c) Storage type(d) Memory typeThe question was posed to me in an interview for internship.Query is from Container Design topic in chapter Class Hierarchies, Library & Containers of C++ |
|
Answer» The correct option is (a) ITERATOR type |
|
| 67. |
Which is used for manually writing lookup table?(a) std:map(b) std:lookup(c) std:find(d) std:lockThis question was posed to me during an interview.I need to ask this question from Container Design in chapter Class Hierarchies, Library & Containers of C++ |
|
Answer» Correct answer is (a) STD:map |
|
| 68. |
Which is used to allocate and deallocate storage for objects during the execution?(a) Stack(b) Heap(c) Freestore(d) QueueThe question was posed to me during an interview.The above asked question is from Free Store topic in section Class Hierarchies, Library & Containers of C++ |
|
Answer» The correct option is (C) Freestore |
|
| 69. |
Which operators are part of RTTI?(a) dynamic_cast()(b) typeid(c) both dynamic_cast & typeid(d) dynamic_cast[]The question was asked during an internship interview.My question comes from Run Time Type Information in portion Class Hierarchies, Library & Containers of C++ |
|
Answer» Correct ANSWER is (C) both dynamic_cast<> & typeid |
|
| 70. |
How many specifiers are used to derive a class?(a) 1(b) 2(c) 3(d) 4The question was asked during an interview.My question is based upon Inheritance in section Class Hierarchies, Library & Containers of C++ |
|
Answer» Right CHOICE is (C) 3 |
|
| 71. |
Which classes are called as mixin?(a) Represent a secondary design(b) Classes express functionality which represents responsibilities(c) Standard logging stream(d) Represent a priary designThis question was posed to me in a national level competition.My question is from Class Hierarchies Introduction in section Class Hierarchies, Library & Containers of C++ |
|
Answer» The correct option is (b) Classes express FUNCTIONALITY which represents responsibilities |
|
| 72. |
Which type of relationship is modelled by Inheritance?(a) Is-A relationship(b) Has-A relationship(c) Part-Of relationship(d) Belongs-to relationshipThis question was addressed to me in an international level competition.I would like to ask this question from Class Relationships in division Class Hierarchies, Library & Containers of C++ |
|
Answer» The correct OPTION is (a) Is-A relationship |
|
| 73. |
What is the use of the set() function in bitset?(a) Used to make alternate bits zero(b) Used to make a bit 0 in a bitset(c) Used to make all bits zero(d) Used to set bit(s) in a bitsetI had been asked this question by my school principal while I was bunking the class.This intriguing question comes from Bitset in section Class Hierarchies, Library & Containers of C++ |
|
Answer» CORRECT choice is (d) Used to set bit(s) in a bitset The EXPLANATION: |
|
| 74. |
Which of the following is correct about any() function in bitset?(a) Returns true if the number of 1’s equal to the number of 0’s(b) Returns true if any bit is set 0(c) Returns true if any bit is set 1(d) Returns true only if all bits are 1The question was posed to me in an internship interview.Question is from Bitset in chapter Class Hierarchies, Library & Containers of C++ |
|
Answer» The correct choice is (c) Returns TRUE if any bit is SET 1 |
|
| 75. |
Which of the following is correct about extent() function?(a) Returns how many elements are in array currently(b) Returns the size of the 1st dimension(c) Returns how many total elements can be stored in an array(d) Returns the size of a given dimensionThe question was posed to me in an interview for internship.The question is from Array Type Manipulation in portion Class Hierarchies, Library & Containers of C++ |
|
Answer» The CORRECT choice is (d) RETURNS the size of a GIVEN dimension |
|
| 76. |
Which header file is used for generating random numbers?(a) (b) (c) (d) I got this question during an interview for a job.My query is from Generators topic in chapter Class Hierarchies, Library & Containers of C++ |
|
Answer» The CORRECT answer is (d) <RANDOM> |
|
| 77. |
What is the full form of vptr?(a) Vector Pointer(b) Virtual Pointer(c) V type Pointer(d) Virtual-vector PointerThis question was addressed to me at a job interview.The origin of the question is vtable and vptr in division Class Hierarchies, Library & Containers of C++ |
|
Answer» Correct answer is (a) VECTOR POINTER |
|
| 78. |
Which exception is thrown if the typecasting is not done properly?(a) bad_type_cast(b) bad_any_cast(c) type_mismatched(d) bad_cast_mismatchedThis question was posed to me in unit test.My enquiry is from STL Container Any topic in section Class Hierarchies, Library & Containers of C++ |
|
Answer» Correct choice is (b) bad_any_cast |
|
| 79. |
What is the difference between begin() and cbegin() in vectors?(a) both are same(b) begin() returns iterator to first element and cbegin() returns iterator to last element(c) begin() returns an iterator to first element whereas cbegin() returns constant iterator to first element(d) begin() returns returns first element cbegin() returns voidI have been asked this question by my college professor while I was bunking the class.My query is from seq_con Vector Class in division Class Hierarchies, Library & Containers of C++ |
|
Answer» Correct choice is (c) begin() returns an ITERATOR to first element whereas cbegin() returns constant iterator to first element |
|
| 80. |
Pick the correct statement.(a) Sequence Container arrays know (somehow stores within) its size whereas C-like arrays do not(b) Sequence Container arrays have no advantage over C-like arrays(c) Sequence Container arrays are same as C-like arrays(d) Sequence Container arrays are also present in CI have been asked this question during an online interview.Enquiry is from seq_con Array Class topic in division Class Hierarchies, Library & Containers of C++ |
|
Answer» The CORRECT ANSWER is (a) Sequence Container ARRAYS know (somehow stores within) its size whereas C-like arrays do not |
|
| 81. |
How many iterators are needed for the defining a new container?(a) 1(b) 2(c) 3(d) 4This question was posed to me in an online quiz.My query is from Defining a New Container topic in portion Class Hierarchies, Library & Containers of C++ |
|
Answer» The correct choice is (c) 3 |
|
| 82. |
What kind of library is Standard Template Library?(a) Polymorphic(b) Generic(c) Both Polymorphic & Generic(d) VirtualThe question was asked during an online exam.This interesting question is from Almost Containers in portion Class Hierarchies, Library & Containers of C++ |
|
Answer» Right CHOICE is (b) Generic |
|
| 83. |
What will happen when introduce the interface of classes in a run-time polymorphic hierarchy?(a) Separation of interface from implementation(b) Merging of interface from implementation(c) Separation of interface from debugging(d) Merging of interface from debuggingThe question was posed to me by my school principal while I was bunking the class.My question is taken from Class Hierarchies Introduction topic in division Class Hierarchies, Library & Containers of C++ |
|
Answer» Right option is (a) SEPARATION of interface from implementation |
|
| 84. |
Sets are implemented using _______________________(a) binary search tree(b) red black tree(c) avl tree(d) heapThis question was addressed to me during an interview for a job.My enquiry is from More Containers in section Class Hierarchies, Library & Containers of C++ |
|
Answer» The correct answer is (a) binary search tree |
|
| 85. |
Which type of relationship is modelled by Composition?(a) Is-A relationship(b) Has-A relationship(c) Part-Of relationship(d) Have-A relationshipThis question was addressed to me in my homework.My question is taken from Class Relationships topic in division Class Hierarchies, Library & Containers of C++ |
|
Answer» RIGHT option is (c) PART-Of relationship The explanation: Composition models the part-of relationship between CLASSES. In this CHILDREN cannot exits without a parent, therefore, they are part of each other. |
|
| 86. |
What is the class relationship?(a) A relationship between classes that tells how they are related(b) A relationship between classes that tells how much power one class has over other class(c) A relationship between classes that tells which parts of a class is visible to other classes(d) All of the mentionedThis question was addressed to me in an internship interview.My question is taken from Class Relationships topic in division Class Hierarchies, Library & Containers of C++ |
|
Answer» Correct option is (d) All of the mentioned |
|
| 87. |
Which of the following is correct about none() function in bitset?(a) Returns true if any bits is set 1(b) Returns true if all bits is set 0(c) Returns true if the number of 1’s equal to the number of 0’s(d) Returns true only if all bits are 1I got this question during an interview.This interesting question is from Bitset topic in division Class Hierarchies, Library & Containers of C++ |
|
Answer» Correct choice is (b) Returns true if all bits is set 0 |
|
| 88. |
Which header file is required to use complex class in your program?(a) (b) (c) (d) The question was posed to me in an online interview.I want to ask this question from Complex Library topic in division Class Hierarchies, Library & Containers of C++ |
|
Answer» The CORRECT ANSWER is (a) <COMPLEX> |
|
| 89. |
What is vtable in C++?(a) Lookup table to resolve function calls in dynamic manners(b) Lookup table to resolve function calls in static manners(c) Lookup table to see which are the functions available for calls throughout the program(d) Lookup table to check how many functions are there int he programThe question was posed to me in final exam.My question comes from vtable and vptr in division Class Hierarchies, Library & Containers of C++ |
|
Answer» CORRECT option is (a) Lookup table to RESOLVE function calls in dynamic MANNERS The explanation: VTABLE is a lookup table that is used to resolve the function calls in dynamic/late binding manners. |
|
| 90. |
Which function is used to construct heap from given sequence of numbers?(a) create_heap()(b) make_heap()(c) construct_heap()(d) start_heap()I have been asked this question in an internship interview.This question is from STL topic in chapter Class Hierarchies, Library & Containers of C++ |
|
Answer» Right answer is (b) make_heap() |
|
| 91. |
In which context does the stack operates?(a) FIFO(b) LIFO(c) Both FIFO & LIFO(d) LIFIThe question was posed to me in quiz.My question is taken from Sequence Adapters topic in portion Class Hierarchies, Library & Containers of C++ |
|
Answer» Right choice is (b) LIFO |
|
| 92. |
What is meant by type_info?(a) Used to hold the type information returned by the typeid operator(b) Used to hold the type information returned by the dynamic_cast(c) Used to hold the type information returned by the static_cast(d) Used to hold the type information returned by the static_idThe question was posed to me in examination.I'd like to ask this question from Run Time Type Information topic in chapter Class Hierarchies, Library & Containers of C++ |
|
Answer» Right choice is (a) Used to HOLD the type INFORMATION RETURNED by the typeid operator |
|
| 93. |
Unordered map is implemented using _________________(a) binary search tree(b) red black tree(c) heap(d) hash tableI got this question at a job interview.My doubt is from More Containers in division Class Hierarchies, Library & Containers of C++ |
|
Answer» Correct option is (d) hash table |
|
| 94. |
Which container can have the same keys?(a) map(b) multimap(c) unordered map(d) setI got this question in an international level competition.The above asked question is from More Containers topic in section Class Hierarchies, Library & Containers of C++ |
|
Answer» The correct OPTION is (b) multimap |
|
| 95. |
Which of the following is the correct syntax of declaring a complex number?(a) complex variable_name;(b) complex variable_name;(c) Complex variable_name;(d) Complex variable_name;The question was asked in an interview.My question is from Complex Library topic in section Class Hierarchies, Library & Containers of C++ |
|
Answer» Correct answer is (B) complex |
|
| 96. |
What is the use of is_same() function in C++?(a) To check if a variable is array type or not(b) To check whether two variables have the same characteristics(c) To check if two variable is of array type or not(d) To check whether two variables are different or notThis question was posed to me by my school principal while I was bunking the class.This question is from Array Type Manipulation topic in division Class Hierarchies, Library & Containers of C++ |
|
Answer» RIGHT CHOICE is (b) To CHECK whether two variables have the same characteristics Explanation: is_same() function is USED to check whether two variables have the same characteristics or not. |
|
| 97. |
Which of the following is correct syntax of making heap from a vector v?(a) make_heap(v.elements);(b) make_heap(v);(c) make_heap(v.end(), v.begin());(d) make_heap(v.begin(), v.end());This question was posed to me during an interview.My question is from STL in portion Class Hierarchies, Library & Containers of C++ |
|
Answer» Correct ANSWER is (d) make_heap(v.begin(), v.end()); |
|
| 98. |
What is the use of front() function in heap?(a) Returns the element closest to the median of a sequence(b) Returns the last element of the heap(c) Returns the first element of the heap(d) Returns the element closest to mean of a sequenceThis question was posed to me by my college professor while I was bunking the class.My question comes from STL in division Class Hierarchies, Library & Containers of C++ |
|
Answer» The CORRECT choice is (c) Returns the first element of the heap |
|
| 99. |
Which of the following(s) can be used to access the last element of a vector v?(a) v.end()(b) v.cend()(c) both v.end() and v.cend()(d) vectors do not have a function to access the last elementThe question was posed to me during an internship interview.I want to ask this question from seq_con Vector Class topic in portion Class Hierarchies, Library & Containers of C++ |
|
Answer» Right answer is (d) vectors do not have a function to access the last element |
|
| 100. |
Members of which access specifiers are not inherited?(a) Public(b) Protected(c) Private(d) None of the mentionedThe question was posed to me in an interview for internship.My enquiry is from Access Control topic in portion Class Hierarchies, Library & Containers of C++ |
|
Answer» Right choice is (d) NONE of the mentioned |
|