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 6 Question 98 Discussion

Actual exam question for C++ Institute's CPP - C++ Certified Professional Programmer Exam exam
Question #: 98
Topic #: 6
[All CPP - C++ Certified Professional Programmer Exam Questions]

What happens when you attempt to compile and run the following code?

#include

#include

#include

#include

#include

using namespace std;

int main()

{

deque mydeck;list mylist; vector myvector;

queue first; queue second(mydeck);

queue third(second); queue > fourth(mylist);

fourth.push(10);fourth.push(11);fourth.push(12);

queue > fifth(myvector);

fifth.push(10);fifth.push(11);fifth.push(12); // Line I

while(!fifth.empty())

{

cout<

fifth.pop(); // Line III

}

while (!fourth.empty())

{

cout << fourth.front() << " ";

fourth.pop(); // Line IV

}

return 0;

}

Show Suggested Answer Hide Answer
Suggested Answer: D

Contribute your Thoughts:

Keshia
7 days ago
I'm not sure, but I think there might be a compilation error in line III.
upvoted 0 times
...
Arlene
10 days ago
Hmm, I'm pretty sure there won't be any compilation errors in this code. It looks like a straightforward queue manipulation exercise to me.
upvoted 0 times
...
Christiane
13 days ago
Haha, this question is a real head-scratcher. I bet the instructor is just trying to trick us with some obscure C++ syntax we've never seen before.
upvoted 0 times
Marquetta
1 days ago
User 2
upvoted 0 times
...
Quentin
4 days ago
User 1
upvoted 0 times
...
...
Shelia
17 days ago
I agree with Loise, there shouldn't be any compilation errors in this code.
upvoted 0 times
...
Novella
21 days ago
Wait, are we allowed to use `queue>` and `queue>` in C++? I thought only the default `queue` was available.
upvoted 0 times
Leonor
2 days ago
Yes, you can use `queue>` and `queue>` in C++.
upvoted 0 times
...
...
Anissa
26 days ago
The program should output 10 11 12 10 11 12, as it creates two queues, one with a vector and one with a list, and then prints the elements of both queues.
upvoted 0 times
Cristy
19 days ago
The program is correct, it creates two queues and prints the elements of both.
upvoted 0 times
...
Cristy
21 days ago
A) program outputs: 10 11 12 10 11 12
upvoted 0 times
...
...
Loise
27 days ago
I think the program will output: 10 11 12 10 11 12.
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