C++ Institute C++ Certified Professional Programmer CPP Question # 51 Topic 6 Discussion

C++ Institute C++ Certified Professional Programmer CPP Question # 51 Topic 6 Discussion

CPP Exam Topic 6 Question 51 Discussion:
Question #: 51
Topic #: 6

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

#include

#include

#include

using namespace std;

template void print(T start, T end) {

while (start != end) {

std::cout << *start << " "; start++;

}

}

int main(){

vectorv;

set s;

for(int i=10; i>0; i??) {

v.push_back(i);

s.push_back(i);

}

print(v.begin(), v.end()); print(s.begin(), s.end());cout<

return 0;

}

The output will be:


A.

10 9 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8 9 10


B.

10 9 8 7 6 5 4 3 2 1 10 9 8 7 6 5 4 3 2 1


C.

10 9 8 7 6 5 4 3 2 1 and unpredictable sequence of number range 1 to 10


D.

compilation error


Get Premium CPP Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.