Question 1
What does the function empty() return when called on a C++ STL stack?
The number of elements in the stack
The top element of the stack
true if the stack is empty, otherwise false
It removes the top element
Question 2
What is the underlying container used by std:: stack by default?
std:: vector
std:: deque
std:: list
std:: array
Question 3
Which of the following is used to insert an element into a std::queue in C++ STL?
insert()
push()
add()
enqueue()
Question 4
Which functions are used to access elements in a queue?
front() and top()
front() and back()
begin() and end()
peek() and tail()
Question 5
What is the default behavior of std::priority_queue in C++?
Smallest element has the highest priority.
Random order
First inserted element has the highest priority
Largest element has the highest priority
Question 6
To create a min-heap using std::priority_queue, which of the following is correct?
priority_queue<int,vector<int>,greater<int>>pq;
priority_queue<int>pq;
priority_queue<int,list<int>,less<int>>pq;
priority_queue<int,set<int>>pq;
There are 6 questions to complete.