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

Posted by Arminda on Dec 08, 2022 at 12:37 AM

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;

}

Suggested Answer: A, B, C

Get Premium CPP Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
12 comments · newest first
BI
Billy 11 months ago
Really? I thought queues couldn't be instantiated from vectors.
DA
Daniela 11 months ago
Line II looks good too, using a deque.
LI
Lizbeth 12 months ago
Wait, line IV? That's not right, you can't use a list!
KE
Kenny 12 months ago
Totally agree, line I is correct!
SH
Sheldon 12 months ago
Line I is a proper instantiation.
CH
Cherry 1 year ago
I remember something about queues not being able to take lists or vectors as parameters, so lines IV and V might be wrong.
TI
Tiffiny 1 year ago
Line III seems okay because it’s copying another queue, but I can't remember if that's always valid.
RO
Rozella 1 year ago
I'm not sure about line II; I feel like you can't initialize a queue with a deque directly.
LO
Louis 1 year ago
I think line I is definitely correct since it shows a simple instantiation of a queue.
JA
Jamal 1 year 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?
AR
Arthur 1 year 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.
CH
Cherelle 1 year ago
This looks like a straightforward URL link question. I'm confident I can identify the correct answer.
0/2000 characters

Save Cancel