C++ Institute C++ Certified Professional Programmer CPP Question # 35 Topic 4 Discussion

C++ Institute C++ Certified Professional Programmer CPP Question # 35 Topic 4 Discussion

CPP Exam Topic 4 Question 35 Discussion:
Question #: 35
Topic #: 4

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

#include

#include

#include

using namespace std;

template

int calculate(T start, T end)

{

int s = 0;

while (start != end)

s+= *start; start++;return s;

}

int main ()

{

int t[] = {1, 2 ,3 ,4 ,5, 6 , 7, 8 , 9, 10};

vectorv1(t, t+5);

dequed1(t+5, t+10);

cout<

cout<

cout<

cout<

cout<

return 0;

}


A.

compilation error


B.

runtime exception


C.

program outputs 55 5 17 55


D.

program outputs 55 5 17 0


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.