1 2 3 4 5 6 7 |
|
Which of the following is equivalent to the above piece of a C++ code?
A
1 2 3 |
|
B
1 2 3 |
|
C
1 2 3 |
|
D
1 2 3 |
|
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The second line of the code can only be reached if the first line was true, and the first line states that checkA has to be true. Therefore, the condition !checkA in the second line will never be true, which leaves the entire statement to be true only when checkB is true. Summing these two conditions, the line "return true" will only be executed when both checkA and checkB are true, giving A as our answer.