Questions and Answers
- How many items are there in sequence container?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
There are five items in sequence container. They are array, vector, list, forward_list and dequeue.
- What is the output of this program?
#include <iostream>
#include <deque>
using namespace std;
int main ()
{
deque<int> DequeData (6);
deque<int>::reverse_iterator RevIter = DequeData.rbegin();
int k = 0;
for (RevIter = DequeData.rbegin(); RevIter != DequeData.rend(); ++RevIter)
*RevIter = ++k;
for (deque<int> :: iterator iter = DequeData.begin();
iter != DequeData.end(); ++iter)
cout << ' ' << *iter;
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
In this program, We used the operation of rbegin and rend on dequeue and produced the result.
- Which of the following will return the new element at the end of container?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
back
- Which of the following class template are based on arrays?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Class template vector and class template dequeue both are based on arrays.
- Pick out the correct statement about vector.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
The syntax for declaring the vector element is vector<type> variable_name (number_of_elements);