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.
| 151. |
Indexing of bitset variables starts from ___________(a) leftmost bit(b) rightmost bit(c) same as in an array(d) frontThis question was addressed to me in an online interview.Question is taken from Bitset topic in division Class Hierarchies, Library & Containers of C++ |
|
Answer» RIGHT OPTION is (B) rightmost bit The explanation: The indexing of bitset variable starts from rightmost bit i.e. if you have b = 1100 as your bitset then b[0] = 0, not 1. |
|
| 152. |
What is vptr?(a) A hidden pointer in a class that points to a virtual table of that class(b) A hidden pointer in a class that points to virtual functions of that class(c) A hidden pointer in a class that points to virtual members of the class of that class(d) A pointer in a class that points to other classI got this question in quiz.My question is taken from vtable and vptr topic in section Class Hierarchies, Library & Containers of C++ |
|
Answer» Correct ANSWER is (a) A hidden POINTER in a CLASS that points to a virtual table of that class |
|
| 153. |
Which function is used to get the argument of a complex number?(a) abs()(b) norm()(c) arg()(d) argu()This question was posed to me by my school teacher while I was bunking the class.My doubt stems from Complex Library in chapter Class Hierarchies, Library & Containers of C++ |
|
Answer» RIGHT answer is (c) ARG() The BEST I can explain: The argument of a complex is calculated using the arg() function of the |
|
| 154. |
Which of the following function is used to get the actual number of elements stored in vector?(a) v.size()(b) v.capacity()(c) v.max_size()(d) v.no_of_elements()The question was asked by my college director while I was bunking the class.Origin of the question is seq_con Vector Class topic in portion Class Hierarchies, Library & Containers of C++ |
|
Answer» The correct answer is (a) V.size() |
|
| 155. |
What is Pseudo-random number engines?(a) Uses user input for random number generation(b) Uses an algorithm that does not require any initial seed to generate random numbers(c) Uses initial seed based algorithm to generate random numbers(d) Random number generates depends on the programThis question was posed to me in an interview.Enquiry is from Generators in section Class Hierarchies, Library & Containers of C++ |
|
Answer» CORRECT option is (c) Uses initial SEED based algorithm to generate random numbers To explain I would say: Pseudo-random NUMBER engines are used to generate random numbers based on an initial seed provided to them. |
|
| 156. |
Which is best for coding the standard library for c++?(a) no trailing underscores on names(b) complex objects are returned by value(c) have a member-swap()(d) all of the mentionedI had been asked this question at a job interview.My enquiry is from Standard Library Design topic in division Class Hierarchies, Library & Containers of C++ |
|
Answer» RIGHT choice is (d) all of the mentioned The best explanation: Best coding for the standard LIBRARY for c++ is: -> No trailing UNDERSCORES on names -> Complex OBJECTS are returned by VALUE -> It should have a member-swap(). |
|
| 157. |
What is the full form of vtable?(a) V type table(b) Vector table(c) Virtual table(d) Virtual-vector tableThe question was asked in quiz.Query is from vtable and vptr topic in portion Class Hierarchies, Library & Containers of C++ |
|
Answer» Right ANSWER is (C) VIRTUAL table |
|
| 158. |
Which operator is used to create the user-defined streams in c++?(a) >>(b) & |
|
Answer» Correct OPTION is (d) Both >> & << |
|
| 159. |
Which function is used to check whether a given sequence is heap or not?(a) sort_heap()(b) is_heap()(c) is_heap_until()(d) check_heap()The question was posed to me in semester exam.I need to ask this question from STL topic in division Class Hierarchies, Library & Containers of C++ |
|
Answer» The CORRECT answer is (b) is_heap() |
|
| 160. |
Elements in STL heap are removed in ________________________(a) decreasing order(b) increasing order(c) alternate i.e. once max element then min element(d) input orderI had been asked this question in an internship interview.Query is from STL topic in chapter Class Hierarchies, Library & Containers of C++ |
|
Answer» Right choice is (a) decreasing order |
|
| 161. |
Which of the following(s) can be used to access the first element of a vector v?(a) v.begin()(b) v.cbegin()(c) v[0](d) all of the mentionedI got this question in a job interview.Query is from seq_con Vector Class in portion Class Hierarchies, Library & Containers of C++ |
|
Answer» Correct option is (d) all of the mentioned |
|
| 162. |
Which of the following class template are based on arrays?(a) vector(b) list(c) dequeue(d) both vector & dequeueThe question was asked in semester exam.I would like to ask this question from Sequences in division Class Hierarchies, Library & Containers of C++ |
|
Answer» CORRECT choice is (d) both vector & DEQUEUE To explain: Class template vector and class template dequeue both are BASED on arrays. |
|
| 163. |
Which interface in the container is required for storage management?(a) Memory management(b) Allocator interface(c) Memory interface(d) Storage interfaceThis question was posed to me in homework.My question comes from Container Design in portion Class Hierarchies, Library & Containers of C++ |
|
Answer» CORRECT answer is (b) ALLOCATOR interface Explanation: Allocator interface in the CONTAINER is REQUIRED for storage management. |
|