BlackFriday 2024! 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 7 Question 86 Discussion

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

What will happen when you attempt to compile and run the code below, assuming that you enter the following sequence: true true?

#include

#include

using namespace std;

int main ()

{

bool a,b;

cin>>a>>b;

cout<

return 0;

}

Program will output:

Show Suggested Answer Hide Answer
Suggested Answer: E

Contribute your Thoughts:

Marion
5 months ago
I'm going with C. The program will output '11' because it's going to treat the input 'true true' as two integer values and print them out.
upvoted 0 times
Latricia
4 months ago
C) 11
upvoted 0 times
...
Sunshine
5 months ago
B) falsefalse
upvoted 0 times
...
Graciela
5 months ago
A) truetrue
upvoted 0 times
...
...
Luz
5 months ago
B, easy. The program will output 'falsefalse' because the input 'true true' will be interpreted as two boolean values that are both false.
upvoted 0 times
Delfina
4 months ago
C) 11
upvoted 0 times
...
Matthew
5 months ago
B) falsefalse
upvoted 0 times
...
Gilma
5 months ago
A) truetrue
upvoted 0 times
...
...
Kaycee
5 months ago
I agree with Laurena. Since the input is true true, the program will output truetrue as the values of a and b.
upvoted 0 times
...
Ty
5 months ago
E, definitely E. This code has some serious issues and won't compile at all. Who wrote this, a monkey?
upvoted 0 times
Goldie
5 months ago
Yeah, this code is a mess.
upvoted 0 times
...
Goldie
5 months ago
It won't compile, that's for sure.
upvoted 0 times
...
Goldie
5 months ago
E) none of these
upvoted 0 times
...
...
Gary
5 months ago
D looks good to me. The program will output '00' because the boolean values 'true' and 'true' will be interpreted as 1 and 1, which get printed as '00'.
upvoted 0 times
...
Jessenia
5 months ago
I think the answer is A. The program will output 'truetrue' since the input 'true true' will be read as two boolean values and then printed out.
upvoted 0 times
Vonda
4 months ago
I think it will be 'truetrue' as well. So, A is the correct answer.
upvoted 0 times
...
Vonda
5 months ago
I agree, the answer is A. It will output 'truetrue'.
upvoted 0 times
...
Eugene
5 months ago
I think it will be D. The program will output '00'.
upvoted 0 times
...
Eugene
5 months ago
I agree, the answer is A. The program will output 'truetrue'.
upvoted 0 times
...
Alberta
5 months ago
I think it will be 'truetrue' as well. So, A is the correct answer.
upvoted 0 times
...
Alberta
5 months ago
I agree, the answer is A. It will output 'truetrue'.
upvoted 0 times
...
...
Laurena
6 months ago
I think the program will output truetrue because it will print the values of a and b without any modifications.
upvoted 0 times
...

Save Cancel