Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

C++ Institute Exam CPP Topic 2 Question 77 Discussion

Actual exam question for C++ Institute's CPP exam
Question #: 77
Topic #: 2
[All CPP Questions]

Which are NOT valid instantiations of priority_queue object:

#include

#include

#include

#include

#include

using namespace std;

int main()

{

deque mydeck;list mylist; vector myvector;

priority_queue first;//line I

priority_queue > second;//line II

priority_queue third(first);//line III

priority_queue > fourth(third);//line IV

priority_queue > fifth(myvector.begin(), myvector.end());//line V

return 0;

}

Show Suggested Answer Hide Answer
Suggested Answer: E

Contribute your Thoughts:

Cyril
22 hours ago
Haha, it's funny how they try to trick us with a list. Who uses a list for a priority queue? That's like trying to use a toaster to dry your hair!
upvoted 0 times
...
Carissa
13 days ago
I believe line V is also not valid because it is trying to initialize a priority_queue with iterators from a vector.
upvoted 0 times
...
Lauran
14 days ago
I agree with Van, line I is incorrect because it is missing the container type.
upvoted 0 times
...
Van
15 days ago
I think line I is not a valid instantiation.
upvoted 0 times
...
Maynard
16 days ago
I agree with Mabel. The list is not a valid container for a priority_queue, so line IV is not a valid instantiation.
upvoted 0 times
...
Carmela
16 days ago
I believe line V is also not valid because it is trying to initialize a priority_queue with iterators from a vector.
upvoted 0 times
...
Darrin
17 days ago
I agree with Willetta, line I is incorrect because it is missing the container type.
upvoted 0 times
...
Mabel
18 days ago
The correct answer is line IV. A priority_queue can only be instantiated with a deque or a vector as the underlying container, not a list.
upvoted 0 times
...
Willetta
18 days ago
I think line I is not a valid instantiation.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77