← Quiz: Strings in C++: all 10 questions
Quiz: Strings in C++ · Question 3 of 10
What does this print? (code)
What does this print?
#include <iostream>
#include <string>
using namespace std;
int main() {
cout << (string("Mango") < string("apple"));
return 0;
}
- A.0
- B.1
- C.Compile error
- D.Mango
Answer & explanation
Correct answer: 1
'M' (77) has a smaller code than 'a' (97), so "Mango" comes first.
Can you get the rest right without peeking?
Take the timed Quiz: Strings in C++ quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →