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. |
Which is used to check the error in the block?(a) try(b) throw(c) catch(d) handlerI have been asked this question during an online exam.I'm obligated to ask this question of Catching Exceptions topic in section Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Right choice is (a) try |
|
| 52. |
Which is used to throw a exception?(a) throw(b) try(c) catch(d) handlerThe question was asked during an interview.I'm obligated to ask this question of Error Handling topic in portion Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» The correct ANSWER is (a) THROW |
|
| 53. |
Which keyword is used to handle the expection?(a) try(b) throw(c) catch(d) handlerThe question was asked during an online interview.Enquiry is from Error Handling in chapter Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Correct ANSWER is (C) catch |
|
| 54. |
What is the Standard Template Library?(a) Set of C++ template classes to provide common programming data structures and functions(b) Set of C++ classes(c) Set of Template functions used for easy data structures implementation(d) Set of Template data structures onlyThe question was posed to me in an interview for internship.My question comes from Standard Template Library in section Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Correct option is (a) Set of C++ template classes to provide common programming data STRUCTURES and functions |
|
| 55. |
What should be the name of the constructor?(a) same as the object(b) same as the member(c) same as the class(d) same as the functionI have been asked this question in an interview.I need to ask this question from Class Hierarchies and Abstract Classes in portion Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» The CORRECT ANSWER is (C) same as the class |
|
| 56. |
Which class is used to design the base class?(a) abstract class(b) derived class(c) base class(d) derived & base classThe question was asked during an interview.I need to ask this question from Abstract Classes topic in portion Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Right OPTION is (a) abstract class |
|
| 57. |
What is the use of RAII in c++ programming?(a) Improve the exception safety(b) Terminate the program(c) Exit from the block(d) Crash the compilerThe question was posed to me in examination.Enquiry is from Error Handling Alternatives topic in portion Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Right OPTION is (a) IMPROVE the exception SAFETY |
|
| 58. |
Which type of program is recommended to include in try block?(a) static memory allocation(b) dynamic memory allocation(c) const reference(d) pointerI had been asked this question in an online interview.The origin of the question is Exceptions That Are Not Errors topic in section Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» The correct ANSWER is (B) dynamic memory allocation |
|
| 59. |
When do we call that resource is leaked?(a) Arise of compile time error(b) It cannot be accessed by any standard mean(c) Arise of runtime error(d) It can be accessed by any standard meanThis question was addressed to me in quiz.Question is taken from Resource Management topic in portion Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» The correct choice is (B) It cannot be ACCESSED by any standard mean |
|
| 60. |
How do define the user-defined exceptions?(a) inheriting and overriding exception class functionality(b) overriding class functionality(c) inheriting class functionality(d) delting and adding class memberI have been asked this question at a job interview.This intriguing question comes from Error Handling in portion Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Right CHOICE is (a) inheriting and overriding exception CLASS functionality |
|
| 61. |
What are Iterators?(a) Iterators are used to iterate over C-like arrays(b) Iterators are used to iterate over pointers(c) Iterators are used to point memory addresses of STL containers(d) Iterators are used to iterate over functionsI got this question in a job interview.Origin of the question is Standard Template Library in section Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» The CORRECT answer is (c) ITERATORS are used to point memory addresses of STL containers |
|
| 62. |
Which is dependant on template parameter?(a) base class(b) abstract class(c) method(d) static classThe question was asked in quiz.This interesting question is from Derivation and Templates in division Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Correct option is (a) base CLASS |
|
| 63. |
How many types of templates are there in c++?(a) 1(b) 2(c) 3(d) 4I got this question during an interview for a job.Question is taken from Simple String Template topic in section Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Correct answer is (b) 2 |
|
| 64. |
How many ways of reusing are there in the class hierarchy?(a) 1(b) 2(c) 3(d) 4This question was addressed to me during an online exam.My doubt is from Design of Class Hierarchies topic in division Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» The CORRECT choice is (B) 2 |
|
| 65. |
An uncaught handler returns to _______________(a) main function(b) its caller(c) its callee(d) waits there for some timeThe question was posed to me during an interview for a job.This intriguing question comes from Exception Handling topic in chapter Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Right ANSWER is (c) its callee |
|
| 66. |
Which of the following is an exception in C++?(a) Divide by zero(b) Semicolon not written(c) Variable not declared(d) An expression is wrongly writtenI had been asked this question in an interview.I would like to ask this question from Exception Handling topic in section Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» CORRECT answer is (a) Divide by ZERO Best explanation: EXCEPTIONS are those which are encountered during run-time of the program. semicolon, variable not declared and the wrong expression are compile-time ERRORS, therefore, they are not exceptions. Divide by zero is the PROBLEM that is encountered during run-time, therefore, it is an exception. |
|
| 67. |
Why we use :: template-template parameter?(a) binding(b) rebinding(c) both binding & rebinding(d) reusingI got this question during a job interview.The origin of the question is Template Arguments to Specify Policy Usage topic in chapter Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» CORRECT option is (c) both binding & rebinding To explain I would SAY: It is USED to adapt a policy into binary ONES. |
|
| 68. |
What are Templates in C++?(a) A feature that allows the programmer to write generic programs(b) A feature that allows the programmer to write specific codes for a problem(c) A feature that allows the programmer to make program modular(d) A feature that does not add any power to the languageI got this question in exam.This intriguing question originated from Function Templates topic in division Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Correct ANSWER is (a) A feature that allows the programmer to WRITE generic programs |
|
| 69. |
How many types of the constructor are there in C++?(a) 1(b) 2(c) 3(d) 4This question was addressed to me in semester exam.I need to ask this question from Class Hierarchies and Abstract Classes topic in portion Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» The CORRECT choice is (c) 3 |
|
| 70. |
What is meant by exception specification?(a) A function is limited to throwing only a specified list of exceptions(b) A catch can catch all types of exceptions(c) A function can throw any type of exceptions(d) A try can catch all types of exceptionsThis question was posed to me during a job interview.This key question is from Exception Specifications topic in section Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Correct choice is (a) A function is LIMITED to THROWING only a SPECIFIED list of EXCEPTIONS |
|
| 71. |
Which statement is used to catch all types of exceptions?(a) catch()(b) catch(Test t)(c) catch(…)(d) catch(Test)I got this question in an interview.The question is from Exceptions That Are Not Errors topic in chapter Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» The correct CHOICE is (C) catch(…) |
|
| 72. |
Where exception are handled?(a) inside the program(b) outside the regular code(c) both inside or outside(d) main programI had been asked this question during an interview.My question comes from Catching Exceptions in chapter Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» CORRECT ANSWER is (b) outside the regular CODE The explanation: Exception are handled outside the regular code. |
|
| 73. |
How many runtime error messages associated with exception?(a) 2(b) 4(c) 5(d) infiniteThis question was posed to me in homework.My question comes from Grouping of Exceptions topic in section Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Right ANSWER is (b) 4 |
|
| 74. |
How to handle error in the destructor?(a) throwing(b) terminate(c) both throwing & terminate(d) tryThis question was addressed to me in a national level competition.My question comes from Exceptions That Are Not Errors topic in chapter Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» CORRECT answer is (b) TERMINATE Best explanation: It will not THROW an exception from the destructor but it will the PROCESS by USING terminate() function. |
|
| 75. |
What are the operators available in C++ for dynamic allocation and de-allocation of memories?(a) new(b) delete(c) compare(d) both new & deleteI have been asked this question in an internship interview.My enquiry is from Resource Management topic in chapter Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Right CHOICE is (d) both new & delete |
|
| 76. |
Which is also called as abstract class?(a) virtual function(b) pure virtual function(c) derived class(d) base classI got this question in an online interview.The doubt is from Abstract Classes in section Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Correct option is (b) pure virtual function |
|
| 77. |
Which of the following is best to include under try block?(a) static values(b) const values(c) dynamic allocations(d) default valuesThis question was addressed to me during an interview.This is a very interesting question from Standard Exceptions topic in section Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» The correct OPTION is (c) dynamic allocations |
|
| 78. |
What are the different types of exceptions?(a) 1(b) 2(c) 3(d) 4I had been asked this question in exam.I'm obligated to ask this question of Exception Handling in portion Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» The correct answer is (B) 2 |
|
| 79. |
What is the difference between error and exception?(a) Both are the same(b) Errors can be handled at the run-time but the exceptions cannot(c) Exceptions can be handled at the run-time but the errors cannot(d) Both can be handled during run-timeI have been asked this question in an interview for internship.I would like to ask this question from Exception Handling in chapter Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» The CORRECT choice is (C) Exceptions can be handled at the run-time but the ERRORS cannot |
|
| 80. |
In how many categories, containers are divided?(a) 1(b) 2(c) 3(d) 4The question was posed to me in semester exam.Enquiry is from Standard Template Library in section Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» RIGHT option is (d) 4 The best I can explain: Containers are divided into 4 categories NAMELY Sequence Containers, Associative Containers, UNORDERED Associative Containers and Container ADAPTORS. |
|
| 81. |
What is meant by template specialization?(a) It will have certain data types to be fixed(b) It will make certain data types to be dynamic(c) Certain data types are invalid(d) It will make all data types to be dynamicI have been asked this question during an interview for a job.This is a very interesting question from Specialization topic in section Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» The CORRECT CHOICE is (a) It will have certain data TYPES to be fixed |
|
| 82. |
How many constructors can present in a class?(a) 1(b) 2(c) 3(d) multipleThe question was posed to me in exam.My question is from Class Hierarchies and Abstract Classes topic in section Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» The CORRECT answer is (d) multiple |
|
| 83. |
What is meant by polymorphism?(a) class having many forms(b) class having only single form(c) class having two forms(d) class having four formsThe question was posed to me in an online interview.My doubt stems from Class Hierarchies and Abstract Classes topic in section Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» The CORRECT ANSWER is (a) CLASS having many forms |
|
| 84. |
Which keyword is used to throw an exception?(a) try(b) throw(c) throws(d) exceptI had been asked this question at a job interview.My query is from Exception Handling topic in chapter Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» CORRECT OPTION is (B) throw The best I can explain: ‘throw’ keyword is USED to throw exceptions if SOMETHING bad happens. |
|
| 85. |
How many Container Adaptors are provided by C++?(a) 2(b) 3(c) 4(d) 5This question was posed to me by my college professor while I was bunking the class.This question is from Standard Template Library topic in division Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Right option is (b) 3 |
|
| 86. |
What are the Associative Containers?(a) Containers that implements data structures which can be accessed sequentially(b) Containers that implements sorted data structures for fast search in O(logn)(c) Containers that implements unsorted(hashed) data structures for quick search in O(1)(d) Containers that implements data structures which can be accessed non-sequentiallyThe question was posed to me in an internship interview.I need to ask this question from Standard Template Library topic in chapter Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» CORRECT answer is (B) Containers that implements SORTED data structures for FAST search in O(LOGN) Explanation: Associative Containers is the subset of Containers that implements sorted data structures for fast search in O(logn). |
|
| 87. |
What does inheritance allow you to do?(a) create a class(b) create a hierarchy of classes(c) access methods(d) create a methodThe question was asked in semester exam.Query is from Design of Class Hierarchies in portion Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» The correct CHOICE is (b) CREATE a hierarchy of CLASSES |
|
| 88. |
What are the containers?(a) Containers store objects and data(b) Containers stores all the algorithms(c) Containers contain overloaded functions(d) Containers contain set of IteratorsThis question was posed to me in final exam.This interesting question is from Standard Template Library in section Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» RIGHT OPTION is (a) Containers STORE objects and data To explain I would SAY: Containers is a component of STL which stores objects and data. |
|
| 89. |
Pick the correct statement.(a) STL is a generalized library(b) Components of STL are parameterized(c) STL uses the concept of templates classes and functions to achieve generalized implementation(d) All of the mentionedThis question was posed to me during an internship interview.The above asked question is from Standard Template Library in division Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Correct OPTION is (d) All of the mentioned |
|
| 90. |
How many types of inheritance are there in c++?(a) 2(b) 3(c) 4(d) 5I have been asked this question in exam.The origin of the question is Class Hierarchies and Abstract Classes in division Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Correct option is (d) 5 |
|
| 91. |
How many types of class are there in c++?(a) 1(b) 2(c) 3(d) 4The question was asked by my school principal while I was bunking the class.The doubt is from Design of Class Hierarchies in division Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» Right option is (c) 3 |
|