Cyber Monday 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
6 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
5 months ago
C) 11
upvoted 0 times
...
Sunshine
5 months ago
B) falsefalse
upvoted 0 times
...
Graciela
6 months ago
A) truetrue
upvoted 0 times
...
...
Luz
6 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
5 months ago
C) 11
upvoted 0 times
...
Matthew
6 months ago
B) falsefalse
upvoted 0 times
...
Gilma
6 months ago
A) truetrue
upvoted 0 times
...
...
Kaycee
6 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
6 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
6 months ago
Yeah, this code is a mess.
upvoted 0 times
...
Goldie
6 months ago
It won't compile, that's for sure.
upvoted 0 times
...
Goldie
6 months ago
E) none of these
upvoted 0 times
...
...
Gary
6 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
6 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
5 months ago
I think it will be 'truetrue' as well. So, A is the correct answer.
upvoted 0 times
...
Vonda
6 months ago
I agree, the answer is A. It will output 'truetrue'.
upvoted 0 times
...
Eugene
6 months ago
I think it will be D. The program will output '00'.
upvoted 0 times
...
Eugene
6 months ago
I agree, the answer is A. The program will output 'truetrue'.
upvoted 0 times
...
Alberta
6 months ago
I think it will be 'truetrue' as well. So, A is the correct answer.
upvoted 0 times
...
Alberta
6 months ago
I agree, the answer is A. It will output 'truetrue'.
upvoted 0 times
...
...
Laurena
7 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
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