CPP

CPP

Sequence Adapters has 9 Questions

What do container adapter provide to interface?

Restricted interface
More interface
No interface
None of the mentioned
What does the sequence adaptor provide?

Insertion
Deletion
Interface to sequence container
None of the mentioned
Which are presented in the container adaptors?

stack
queue
priority_queue
All of the mentioned
What is the output of this program?
  1.     #include 
  2.     #include   
  3.     using namespace std;
  4.     int main ()
  5.     {
  6.         queue<int> myqueue;
  7.         myqueue.push(12);
  8.         myqueue.push(75);  
  9.         myqueue.back() -= myqueue.front();
  10.         cout << myqueue.back() << endl;
  11.         return 0;
  12.     }

12
75
63
None of the mentioned
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     using namespace std;
  4.     int main ()
  5.     {
  6.         priority_queue<int> mypq;
  7.         mypq.push(30);
  8.         mypq.push(100);
  9.         mypq.push(25);
  10.         mypq.push(40);
  11.         while (!mypq.empty())
  12.         {
  13.             cout << " " << mypq.top();
  14.             mypq.pop();
  15.         }
  16.         cout << endl;
  17.         return 0;
  18.     }

100 40 30 25
100 40 30
100 40
None of the mentioned
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     using namespace std;
  4.     int main ()
  5.     {
  6.         stack<int> myints;
  7.         cout  << (int) myints.size();
  8.         for (int i = 0; i < 5; i++) myints.push(i);
  9.         cout  << (int) myints.size() << endl;
  10.         return 0;
  11.     }

05
15
24
102
In which context does the stack operates?

FIFO
LIFO
Both a & b
None of the mentioned
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     using namespace std;
  4.     int main ()
  5.     {
  6.         stack<int> mystack;
  7.         mystack.push(10);
  8.         mystack.push(20);
  9.         mystack.top() -= 5;
  10.         cout << mystack.top() << endl;
  11.         return 0;
  12.     }

10
20
13
15
Which operator is used in priority queue?

operator<
operator>
operator)
None of the mentioned