New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

C++ Institute CPP Exam - Topic 2 Question 59 Discussion

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

Which lines of the code below contain proper instantiation of queue objects?

#include

#include

#include

#include

#include

using namespace std;

int main()

{

deque mydeck;

list mylist;

vector myvector;

queue first; // line I

queue second(mydeck);// line II

queue third(second);// line III

queue fourth(mylist);// line IV

queue fifth(myvector);// line V

return 0;

}

Show Suggested Answer Hide Answer
Suggested Answer: A, B, C

Contribute your Thoughts:

0/2000 characters
Billy
4 months ago
Really? I thought queues couldn't be instantiated from vectors.
upvoted 0 times
...
Daniela
4 months ago
Line II looks good too, using a deque.
upvoted 0 times
...
Lizbeth
4 months ago
Wait, line IV? That's not right, you can't use a list!
upvoted 0 times
...
Kenny
4 months ago
Totally agree, line I is correct!
upvoted 0 times
...
Sheldon
4 months ago
Line I is a proper instantiation.
upvoted 0 times
...
Cherry
5 months ago
I remember something about queues not being able to take lists or vectors as parameters, so lines IV and V might be wrong.
upvoted 0 times
...
Tiffiny
5 months ago
Line III seems okay because it’s copying another queue, but I can't remember if that's always valid.
upvoted 0 times
...
Rozella
5 months ago
I'm not sure about line II; I feel like you can't initialize a queue with a deque directly.
upvoted 0 times
...
Louis
5 months ago
I think line I is definitely correct since it shows a simple instantiation of a queue.
upvoted 0 times
...
Jamal
5 months ago
Okay, let's see... If I get an RST packet, that means the port is closed, right? Or wait, is it the other way around?
upvoted 0 times
...
Arthur
5 months ago
Alright, I've got this. The odds ratio of 1.142 means the odds of the event are 1.142 times greater for each one thousand dollar increase in salary. So the correct answer is B.
upvoted 0 times
...
Cherelle
5 months ago
This looks like a straightforward URL link question. I'm confident I can identify the correct answer.
upvoted 0 times
...

Save Cancel