Question 1 of 25
Hints left: 3
Q1
Which algorithm in C++ STL is used to find the maximum element in a range?
Q2
What is the purpose of the 'std::deque' container in C++ STL?
Q3
Which algorithm in C++ STL is used to find the first occurrence of a value in a range?
Q4
What is the purpose of the 'std::map' container in C++ STL?
Q5
Which container in C++ STL does not preserve the order of elements?
Q6
What is the purpose of the 'std::sort' function in C++ STL?
Q7
What is the time complexity of inserting an element into a set in C++ STL?
Q8
Which algorithm in C++ STL is used to remove all occurrences of a value from a container?
Q9
What is the time complexity of accessing an element in a vector in C++ STL?
Q10
What does STL stand for in C++?
Q11
Which container in C++ STL is typically implemented using a red-black tree?
Q12
Which algorithm in C++ STL is used to merge two sorted ranges into a single sorted range?
Q13
What is the purpose of the 'std::unordered_map' container in C++ STL?
Q14
What is the purpose of the 'std::set' container in C++ STL?
Q15
What is the purpose of the 'std::priority_queue' container in C++ STL?
Q16
Which algorithm in C++ STL is used to count the number of occurrences of a value in a range?
Q17
Which header file is used to include the vector container in C++ STL?
Q18
What does the 'std::reverse' algorithm do in C++ STL?
Q19
Which container in C++ STL does not allow duplicate elements?
Q20
Which container in C++ STL is implemented as a doubly linked list?
Q21
What is the time complexity of searching for an element in a set in C++ STL?
Q22
What is the difference between error and exception?
Q23
What happens when this C++ program is compiled? #include <iostream> #include <string> #include <cstdlib> using namespace std; class A { int a; public: A(){} }; class B: public A { int b; public: B(){} }; void func() { B b; throw b; } int main() { try{ func(); } catch(A a){ cout<<"Caught A Class\n"; } catch(B b){ cout<<"Caught B Class\n"; } }
Q24
What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstdlib> using namespace std; class A { int a; public: A(){} }; class B: public A { int b; public: B(){} }; void func() { B b; throw b; } int main() { try{ func(); } catch(A a){ cout<<"Caught A Class\n"; } catch(B b){ cout<<"Caught B Class\n"; } }
Q25
Which of the following is an exception in C++?