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 4 Question 88 Discussion

Actual exam question for C++ Institute's CPP exam
Question #: 88
Topic #: 4
[All CPP Questions]

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

#include

#include

#include

#include

using namespace std;

templatestruct Out {

ostream & out;

Out(ostream & o): out(o){}

void operator() (const T & val ) { out<

};

bool Compare(char a, char b) { return tolower(a) < tolower(b);}

int main() {

char s[]={"qwerty"};

char t1[]={"ert"};

char t2[]={"ERT"};

sort(s, s+6);

cout<

return 0;

}

Program outputs:

Show Suggested Answer Hide Answer
Suggested Answer: E

Contribute your Thoughts:

Evangelina
15 days ago
Wait, wait, wait... the 'includes' function is case-sensitive? I thought it was case-insensitive! I guess I need to re-read the C++ documentation more carefully. *facepalm*
upvoted 0 times
...
Magnolia
16 days ago
The output will be 1 0, because the 'includes' function is case-sensitive, and 't1' (ert) is present in the sorted string 's' (eqrty), but 't2' (ERT) is not, since the comparison is case-sensitive.
upvoted 0 times
...
Lizbeth
18 days ago
Hmm, this looks like a tricky one. I'll have to double-check the 'includes' function and the 'Compare' function to be sure, but my guess is that the output will be 0 1.
upvoted 0 times
...
Gerald
24 days ago
I think the output will be 1 1, because the 'includes' function checks if all the elements in the second range are present in the first range, and both 't1' (ert) and 't2' (ERT) are present in the sorted string 's' (eqrty).
upvoted 0 times
Goldie
2 days ago
C) 1 0
upvoted 0 times
...
...
Jade
27 days ago
The output of the program will be 0 1, as the 'includes' function checks if all the elements in the second range are present in the first range, and the characters in 't2' (ERT) are all present in the sorted string 's' (eqrty), but the characters in 't1' (ert) are not all present in 's'.
upvoted 0 times
Martina
13 days ago
B) 0 1
upvoted 0 times
...
...
Rickie
2 months ago
Why do you think it's C) 1 0?
upvoted 0 times
...
Skye
2 months ago
I disagree, I believe the correct answer is C) 1 0.
upvoted 0 times
...
Rickie
2 months ago
I think the answer is B) 0 1.
upvoted 0 times
...

Save Cancel