Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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")

11. (TCO 4) Which of the following expressions is correct if you want to end a while-loop when the character variable answer is the character 'n' in either upper or lower case? (Points : 5)

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')

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote