Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 6 MCQs Exception Handling, Templates and Standard Template Library (STL)

CSE202 — Object Oriented Programming 50 questions. Pick an option to check it.

Read the notes

0 of 50 answered 0 right 0 wrong , 50 left

  1. Question 1 of 50

    What is the primary purpose of exception handling in C++?

  2. Question 2 of 50

    Which keyword is used to raise an exception?

  3. Question 3 of 50

    What happens during 'stack unwinding' in exception handling?

  4. Question 4 of 50

    Which block contains the code that might generate an exception?

  5. Question 5 of 50

    How do you define a catch block that handles all types of exceptions?

  6. Question 6 of 50

    When using multiple catch blocks, how should they be ordered?

  7. Question 7 of 50

    What is the syntax to rethrow an exception currently being handled?

  8. Question 8 of 50

    If an exception is thrown but not caught anywhere in the program, which function is called by default?

  9. Question 9 of 50

    Can a destructor throw an exception safely?

  10. Question 10 of 50

    Which header file is required for standard exception classes like std::exception?

  11. Question 11 of 50

    What is a C++ Template?

  12. Question 12 of 50

    Which keyword is used to declare a template?

  13. Question 13 of 50

    In the syntax template <typename T>, what does T represent?

  14. Question 14 of 50

    Can keywords class and typename be used interchangeably in a template parameter list?

  15. Question 15 of 50

    What is function template overloading?

  16. Question 16 of 50

    When a class template inherits from a non-template class, it is called:

  17. Question 17 of 50

    Which of the following is a valid Non-Type Template Parameter?

  18. Question 18 of 50

    What is 'Template Specialization'?

  19. Question 19 of 50

    What happens at compile time when a template is instantiated?

  20. Question 20 of 50

    Can a template class have static data members?

  21. Question 21 of 50

    What does STL stand for?

  22. Question 22 of 50

    What are the three main components of STL?

  23. Question 23 of 50

    Which component acts as a bridge between containers and algorithms?

  24. Question 24 of 50

    Which of the following is a Sequence Container?

  25. Question 25 of 50

    Which header file is needed to use generic algorithms like sort()?

  26. Question 26 of 50

    What is the underlying data structure of a std::vector?

  27. Question 27 of 50

    What is the underlying data structure of a std::list?

  28. Question 28 of 50

    Which iterator type does std::vector support?

  29. Question 29 of 50

    What is the time complexity for random access in a std::list?

  30. Question 30 of 50

    Which function adds an element to the end of a vector?

  31. Question 31 of 50

    Which function removes the last element of a vector?

  32. Question 32 of 50

    Which of the following operations is faster in std::list compared to std::vector?

  33. Question 33 of 50

    What does the begin() function return?

  34. Question 34 of 50

    What does the end() function return?

  35. Question 35 of 50

    How do you access the element at index 3 in a vector v safely with bounds checking?

  36. Question 36 of 50

    What happens to the capacity of a vector when it gets full?

  37. Question 37 of 50

    Which header file is required to use std::vector?

  38. Question 38 of 50

    Can std::vector store elements of different data types?

  39. Question 39 of 50

    Which operator is used to dereference an iterator to get the value it points to?

  40. Question 40 of 50

    In std::list, what type of iterator is provided?

  41. Question 41 of 50

    What is the result of v.size() on an empty vector v?

  42. Question 42 of 50

    What is the difference between size() and capacity() in a vector?

  43. Question 43 of 50

    How do you check if a container v is empty?

  44. Question 44 of 50

    Which function clears all elements from a vector?

  45. Question 45 of 50

    In a template, what is 'Class Template Inheritance'?

  46. Question 46 of 50

    What keyword allows an iterator to move to the next element?

  47. Question 47 of 50

    Does std::list support the [] operator?

  48. Question 48 of 50

    In exception handling, which logic applies to derived/base class catches?

  49. Question 49 of 50

    Which method inserts elements into a vector at a specific position?

  50. Question 50 of 50

    What is the return type of the bad_alloc exception?

That's unit 6

Answer a few questions and your score shows up here.