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.
| 1. |
What is the correct function prototype of () operator overloading?(a) return_type operator(arguments)();(b) return_type operator(arguments);(c) return_type operator()(arguments);(d) return_type operator(Class_name)(arguments);I have been asked this question in quiz.I need to ask this question from Functors topic in chapter Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Right option is (C) return_type operator()(arguments); |
|
| 2. |
Which header file is used to manipulate the allocater?(a) allocater(b) memory(c) object(d) iteratorThis question was posed to me during a job interview.My enquiry is from Allocators topic in division Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The CORRECT option is (b) memory |
|
| 3. |
Which function is used to return the minimum element in the range?(a) min(b) minimum(c) min_element(d) max_elementThe question was posed to me in an online quiz.The query is from Min and Max topic in portion Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Correct choice is (C) min_element |
|
| 4. |
Which value is pointed out first in heap?(a) Lowest value(b) Highest value(c) First value(d) Third valueThis question was addressed to me in homework.This interesting question is from Heaps in portion Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Correct OPTION is (b) Highest value |
|
| 5. |
What kind of execution does sequence point allow?(a) Non-overlap(b) Overlap(c) Concurrent(d) SequenceI got this question during an interview.Origin of the question is Stored Sequences topic in division Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The CORRECT OPTION is (a) Non-overlap |
|
| 6. |
Which of the following is a logical unary functor?(a) logical_or f;(b) logical_and f;(c) logical_not f;(d) negate f;The question was asked during an online exam.Origin of the question is Functors in chapter Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The correct choice is (c) logical_not |
|
| 7. |
What are functors in C++?(a) Objects of a class which are treated as functions(b) Objects that are used to call the function of other classes(c) Functions that are called using pointer objects(d) Functions that are called only once in a programThis question was posed to me during an interview for a job.The origin of the question is Functors topic in portion Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Correct choice is (a) Objects of a class which are treated as functions |
|
| 8. |
Which of the following can serve as random-access iterator?(a) Memory pointer(b) Object pointer(c) Class pointer(d) Memory & Class pointerI got this question by my college director while I was bunking the class.My question comes from Iterators and Sequences topic in division Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The correct answer is (B) Object pointer |
|
| 9. |
What type of algorithm is not available in creating our own STL style algorithms?(a) copy_if()(b) remove_copy_if()(c) sort(d) remove_copy()I had been asked this question in quiz.This intriguing question originated from C Style Algorithms topic in division Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Correct CHOICE is (a) copy_if() |
|
| 10. |
Which of the following is correct?(a) Input Iterators are used for assigning(b) Output Iterators are used for assigning(c) Both Input and Output Iterators are used for accessing(d) Both Input and Output Iterators are used for assigningThe question was asked in unit test.Question is taken from Iterators in chapter Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The correct answer is (B) OUTPUT Iterators are used for ASSIGNING |
|
| 11. |
Which of the following header file is required to use in-bulit functors of C++?(a) (b) (c) (d) The question was posed to me during an internship interview.This interesting question is from Functors topic in portion Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Right choice is (b) |
|
| 12. |
How many parameters are needed for minmax function?(a) 1(b) 2(c) 3(d) All of the mentionedThe question was posed to me in an online interview.This question is from Min and Max in portion Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The correct choice is (d) All of the mentioned |
|
| 13. |
Where are allocators used?(a) Allocation of memory(b) Deallocation of memory(c) Used for pointers(d) Both Allocation & Deallocation of memoryThis question was addressed to me by my college professor while I was bunking the class.My question is from Allocators in portion Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Correct option is (d) Both ALLOCATION & Deallocation of memory |
|
| 14. |
How many ways are there to use functors?(a) 1(b) 2(c) 3(d) 4The question was posed to me in my homework.Asked question is from Functors in division Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The CORRECT option is (b) 2 |
|
| 15. |
What are binary functors?(a) Functors that accepts only one parameter(b) Functors that accepts more than one parameters(c) Functors that accepts two parameters(d) Functors that accepts other than a specific type of parameterI had been asked this question in semester exam.I'm obligated to ask this question of Functors in portion Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The CORRECT choice is (c) FUNCTORS that accepts two parameters |
|
| 16. |
How many categories of iterators are there in c++?(a) 2(b) 4(c) 5(d) 3The question was asked during an interview.This is a very interesting question from Iterators and Sequences topic in section Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» RIGHT OPTION is (c) 5 Easiest EXPLANATION - There are FIVE types of iterators. They are Output, Input, Forward, Random ACCESS and Bi-directional. |
|
| 17. |
Pick out the in correct type of function in header file.(a) Partitions(b) Sort(c) Merge(d) JoinI got this question in an interview for internship.Asked question is from C Style Algorithms topic in portion Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Right answer is (d) Join |
|
| 18. |
Which of the following operators are overloaded for functors?(a) [](b) ()(c) This question was addressed to me in an interview for internship.My question is from Functors in division Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Right ANSWER is (B) () |
|
| 19. |
Which operator is used to deallocate the memory?(a) destroy(b) free(c) empty(d) insertThis question was posed to me in an online interview.I want to ask this question from Allocators topic in chapter Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Right ANSWER is (B) FREE |
|
| 20. |
What is the use of checked iterators?(a) Overwrite the bounds of your container(b) Not allow you to overwrite the bounds of your container(c) It will check the list value(d) Overwrite the bounds of your iteratorsThis question was addressed to me in final exam.My query is from Checked Iterators in section Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The correct OPTION is (b) Not allow you to OVERWRITE the bounds of your CONTAINER |
|
| 21. |
How many types of Iterators are there?(a) 5(b) 2(c) 3(d) 4I got this question in an international level competition.My question is from Iterators topic in section Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The correct OPTION is (a) 5 |
|
| 22. |
Which keyword is used to declare the min and max functions?(a) iostream(b) string(c) algorithm(d) iteratorThe question was posed to me in semester exam.Origin of the question is Min and Max topic in chapter Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» RIGHT ANSWER is (c) algorithm The explanation: Algorithm header FILE contains the supporting files needed for the EXECUTION of these functions. |
|
| 23. |
In sequence point, how will the overloaded operators behave like?(a) Function(b) Objects(c) Instance variable(d) ContainerThe question was asked during an interview.This intriguing question originated from Stored Sequences topic in section Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Correct CHOICE is (a) FUNCTION |
|
| 24. |
In which type of semantics does c++ implements iterator?(a) Memory(b) Size(c) Pointer(d) ValueI have been asked this question during an online exam.The query is from Iterators and Sequences in section Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The CORRECT choice is (c) POINTER |
|
| 25. |
Which of the following is correct about Functors?(a) Functors should not be declared outside the main function(b) Overloaded operator () function is not a member of the class(c) Functors should be declared global(d) Functors have a stateI have been asked this question in unit test.This key question is from Functors in section Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The correct choice is (d) Functors have a state |
|
| 26. |
Which of the following is correct about Input Iterators?(a) They cannot be decremented(b) Cannot be used in multi-pass algorithms(c) Can only be incremented(d) All of the mentionedI had been asked this question during an interview.This intriguing question originated from Iterators in portion Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The CORRECT OPTION is (d) All of the mentioned |
|
| 27. |
How many adaptors support the checked iterators?(a) 1(b) 2(c) 3(d) 4I had been asked this question in exam.I need to ask this question from Checked Iterators in portion Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» RIGHT choice is (B) 2 The BEST I can EXPLAIN: There are two adaptors that SUPPORT checked iterators. They are checked_array_iterator class, Checked_iterator class. |
|
| 28. |
Which operator is used to allocate the memory?(a) =(b) +(c) new(d) freeI have been asked this question in an interview.I need to ask this question from Allocators topic in section Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» CORRECT OPTION is (c) new To EXPLAIN I would say: The default allocator uses operator new to allocate memory. |
|
| 29. |
What is the use of includes function in c++?(a) Compares two ranges of data(b) Compares two sorted ranges of data(c) Includes a new element in the range(d) Includes a new element in the endThis question was posed to me in class test.This interesting question is from C Style Algorithms topic in section Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Right answer is (b) Compares TWO sorted ranges of data |
|
| 30. |
In what form does the STL provides heap?(a) queue(b) list(c) vector(d) priority_queueThis question was posed to me by my school teacher while I was bunking the class.Query is from Heaps topic in section Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The CORRECT choice is (d) priority_queue |
|
| 31. |
What is meant by heap?(a) Used for fast retrieval of elements(b) Used for organising the elements(c) Used for fast retrieval & organising the elements(d) Used for deleting the elementsThis question was posed to me by my school teacher while I was bunking the class.My question is taken from Heaps topic in chapter Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Right OPTION is (c) Used for fast RETRIEVAL & organising the elements |
|
| 32. |
Which of te following is a built-in example of functors in C++?(a) mltiplication f(a1, a2);(b) add f(a1, a2);(c) subtract f(a1, a2);(d) plus f(a1, a2);I had been asked this question in my homework.I'm obligated to ask this question of Functors topic in portion Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» RIGHT choice is (d) PLUS The BEST explanation: plus |
|
| 33. |
Which of the following is correct about Input Iterators?(a) Input iterators can be used with all relational operators(b) Input iterators can work with arithmetic operators(c) No value can be assigned to the location pointed by Input Iterator(d) Input iterators can work with sequence operatorsI had been asked this question in homework.This interesting question is from Iterators topic in portion Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The CORRECT option is (c) No value can be assigned to the location pointed by INPUT Iterator |
|
| 34. |
What does the checked iterator allow you to find?(a) Warnings(b) Compile time error(c) Run time error(d) Warnings & Run time errorThe question was asked in an interview.My query is from Checked Iterators topic in portion Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» RIGHT choice is (C) RUN time ERROR Explanation: Checked iterator allow you to FIND Run time error. |
|
| 35. |
Which function is used increment the iterator by a particular value?(a) next()(b) advance()(c) prev()(d) move()I have been asked this question in an international level competition.This key question is from Iterators topic in section Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Correct OPTION is (b) advance() |
|
| 36. |
What are Iterators?(a) STL component used to point a memory address of a container(b) STL component used for vectors(c) STL component used to call functions efficiently(d) STL component used to define template classesI had been asked this question in semester exam.Query is from Iterators topic in portion Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» CORRECT answer is (a) STL component used to point a MEMORY address of a container The best explanation: ITERATORS are STL components used to point a memory address of a container. They are used to ITERATE over container classes. |
|
| 37. |
What is the use of reference member type in allocator?(a) Point to an element(b) Quantities of element(c) Reference to an element(d) Sequence of an elementThe question was asked in unit test.I want to ask this question from Allocators in chapter Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The CORRECT answer is (c) Reference to an element |
|
| 38. |
What are unary functors?(a) Functors that accepts only one parameter(b) Functors that accepts two parameters(c) Functors that accepts more than one parameters(d) Functors that accepts other than a specific type of parameterThis question was posed to me by my school teacher while I was bunking the class.This interesting question is from Functors topic in division Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Right choice is (a) FUNCTORS that accepts only ONE PARAMETER |
|
| 39. |
What are Bi-directional iterators?(a) Iterator same as Forward Iterator(b) Forward Iterator that can be used in both directions(c) Iterator that can only be used to access the sequence from both sides(d) Iterator that can only be used to assign the sequence from both sidesThe question was asked in unit test.The query is from Iterators topic in division Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Right option is (B) Forward Iterator that can be used in both directions |
|
| 40. |
Pick the correct statement.(a) Input iterator moves sequentially forward(b) Input iterator moves sequentially backward(c) Input iterator moves in both direction(d) Input iterator moves sequentially downwardsThis question was addressed to me during an interview for a job.Origin of the question is Iterators topic in portion Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» RIGHT answer is (a) INPUT iterator moves sequentially FORWARD Explanation: By definition Input ITERATORS moves sequentially forward. |
|
| 41. |
What kind of pattern is iterator pattern?(a) Design pattern(b) Sequence pattern(c) Adapter pattern(d) Star patternThis question was addressed to me during an online interview.I would like to ask this question from Iterators and Sequences in division Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Right CHOICE is (a) Design pattern |
|
| 42. |
What is meant by hash tables in C++?(a) Array data structure(b) Keyed array data structure(c) Data structure(d) Linear probingThis question was addressed to me in examination.My doubt is from C Style Algorithms topic in portion Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Right ANSWER is (b) KEYED ARRAY data structure |
|
| 43. |
What will happen if the iterator is unchecked?(a) Arising of compiler warnings(b) Unchecked behavior on program(c) Nothing will execute(d) Arising of compiler warnings & Unchecked behavior on programThis question was posed to me in exam.Origin of the question is Checked Iterators in portion Algorithms, Objects & Iterators in C++ of C++ |
| Answer» | |
| 44. |
Which operator is used to compare the elements in heap?(a) >>(b) comp(c) |
|
Answer» Correct option is (d) Both comp &< |
|
| 45. |
Where are allocators implemented?(a) Template library(b) Standard library(c) C++ code library(d) String libraryI have been asked this question during an internship interview.My question is from Allocators in chapter Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Right choice is (b) STANDARD library |
|
| 46. |
Which of the following is an advantage of Forward iterator over input and output iterator?(a) Can be used as both accessing and assigning iterator(b) Forward iterator can be incremented or decremented(c) Can be used with relational operators also(d) Can be used with arithmetic operators alsoThis question was posed to me in an interview.The origin of the question is Iterators topic in section Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Correct option is (a) Can be USED as both accessing and assigning ITERATOR |
|
| 47. |
What kind of functions are min and max in c++?(a) Type specific(b) Variable specific(c) Type & Variable specific(d) IteratorI had been asked this question in an internship interview.I'm obligated to ask this question of Min and Max topic in division Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Correct ANSWER is (a) TYPE specific |
|
| 48. |
What do input and output objects support?(a) Terminated sequences(b) Extracted sequences(c) Null-terminated sequences(d) Terminated & Extracted sequencesI got this question in final exam.This interesting question is from Stored Sequences in section Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The correct choice is (C) Null-terminated sequences |
|
| 49. |
How to protect the heap from affecting the memory?(a) Avoid using pointers for associating two data structures(b) Embed pointed child objects into the parent object(c) Allocate objects in chunks(d) All of the mentionedThis question was posed to me in homework.Question is from Heaps in chapter Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» The correct option is (d) All of the mentioned |
|
| 50. |
Pick out the correct statement about sequence point.(a) Sequence point will compile the program(b) Sequence point will resolve all the side effects(c) Sequence point will save the program for execution(d) Sequence point will delete the program for executionI have been asked this question in an online quiz.This intriguing question originated from Stored Sequences topic in division Algorithms, Objects & Iterators in C++ of C++ |
|
Answer» Correct choice is (B) Sequence point will resolve all the side EFFECTS |
|