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
1 months 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
1 months 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
Thaddeus
4 days ago
B) 0 1
upvoted 0 times
...
Altha
7 days ago
A) 0 0
upvoted 0 times
...
...
Lizbeth
1 months 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
1 months 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
7 days ago
No, the output will be 1 0 because 't1' (ert) is present in the sorted string 's' (eqrty) but 't2' (ERT) is not.
upvoted 0 times
...
Goldie
17 days ago
C) 1 0
upvoted 0 times
...
...
Jade
1 months 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
9 days ago
Characters in 't2' (ERT) are all present in the sorted string 's' (eqrty), but characters in 't1' (ert) are not all present in 's'.
upvoted 0 times
...
Martina
12 days ago
The 'includes' function checks if all elements in the second range are present in the first range.
upvoted 0 times
...
Martina
28 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
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