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 CPP Exam - Topic 2 Question 59 Discussion

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 Iqueue second(mydeck);// line IIqueue third(second);// line IIIqueue fourth(mylist);// line IVqueue fifth(myvector);// line Vreturn 0;}
A) line I and B) line II and C) line III
D) line IV
E) line V

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
10 months ago
Really? I thought queues couldn't be instantiated from vectors.
upvoted 0 times
...
Daniela
10 months ago
Line II looks good too, using a deque.
upvoted 0 times
...
Lizbeth
10 months ago
Wait, line IV? That's not right, you can't use a list!
upvoted 0 times
...
Kenny
10 months ago
Totally agree, line I is correct!
upvoted 0 times
...
Sheldon
11 months ago
Line I is a proper instantiation.
upvoted 0 times
...
Cherry
11 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
11 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
11 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
11 months ago
I think line I is definitely correct since it shows a simple instantiation of a queue.
upvoted 0 times
...
Jamal
11 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
11 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
11 months ago
This looks like a straightforward URL link question. I'm confident I can identify the correct answer.
upvoted 0 times
...

Save Cancel