6. (TCO 3) What is the output of the following code snippet? int a = 9, b = 4, c
ID: 3557827 • Letter: 6
Question
6. (TCO 3) What is the output of the following code snippet? int a = 9, b = 4, c = -1; if (a > b || (c = a) > 0) { cout << "TRUE" << a << b << c; } else { cout << "FALSE" << a << b << c; } (Points : 5)
FALSE 9 4 9
TRUE 9 4 -1
TRUE 9 4 1
None of the above
7. (TCO 3) What is the value of beta after the following code executes if the input is 1? int beta; cin >> beta; switch(beta) { case 3: beta += 3; break; case 1: beta++; case 4: beta += 4; break; case 5: beta += 5; } (Points : 5)
2
6
11
1
while(answer != "n" && answer != "N")
while(answer != 'n' && answer != 'N')
while(answer != 'n' || answer != 'N')
while(answer != "n" || answer != "N")
Explanation / Answer
6. TRUE 9 4 -1 (the problem says if a>b, as 9>4 or c=a>0, this is not true however a>b, so we will have cout>>a>>b>>c i.e. TRUE 9 4 -1)
7. 2 (since switch command is used, it takes the case where beta = case n i.e. case 1, we increased beta by 1 i.e. beta = beta +1)
11. while(answer != 'n' || answer != 'N')
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.