Question 1 of 25
Hints left: 3
Q1
What is the purpose of the 'std::sort' function in C++ STL?
Q2
Which container in C++ STL does not allow duplicate elements?
Q3
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"; } }
Q4
What is the purpose of the 'std::set' container in C++ STL?
Q5
Which header file is used to include the vector container in C++ STL?
Q6
Which algorithm in C++ STL is used to remove all occurrences of a value from a container?
Q7
Which container in C++ STL does not preserve the order of elements?
Q8
Which container in C++ STL is implemented as a doubly linked list?
Q9
Which algorithm in C++ STL is used to count the number of occurrences of a value in a range?
Q10
What is the time complexity of searching for an element in a set in C++ STL?
Q11
What is the time complexity of accessing an element in a vector in C++ STL?
Q12
What is the purpose of the 'std::unordered_map' container in C++ STL?
Q13
Which algorithm in C++ STL is used to merge two sorted ranges into a single sorted range?
Q14
What is the time complexity of inserting an element into a set in C++ STL?
Q15
Which algorithm in C++ STL is used to find the maximum element in a range?
Q16
What is the purpose of the 'std::map' container in C++ STL?
Q17
What is the purpose of the 'std::deque' container in C++ STL?
Q18
Which of the following is an exception in C++?
Q19
Which container in C++ STL is typically implemented using a red-black tree?
Q20
What is the difference between error and exception?
Q21
What does the 'std::reverse' algorithm do in C++ STL?
Q22
Which algorithm in C++ STL is used to find the first occurrence of a value in a range?
Q23
What is the purpose of the 'std::priority_queue' container in C++ STL?
Q24
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"; } }
Q25
What does STL stand for in C++?