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

What is output by the following C# code segment? int temp; temp = 200; if ( temp

ID: 3905414 • Letter: W

Question

What is output by the following C# code segment?

int temp;

temp = 200;

if ( temp > 90 )

   Console.WriteLine( "This porridge is too hot." );

if ( temp < 70 )

   Console.WriteLine( "This porridge is too cold." );

if ( temp == 80 )

        Console.WriteLine( "This porridge is just right!");

---------------------------------------

This porridge is too hot.

This porridge is too cold.

This porridge is just right!

None of the above.

A.

This porridge is too hot.

B.

This porridge is too cold.

C.

This porridge is just right!

D.

None of the above.

Explanation / Answer

Answer: A

As the value of the variable "temp" is 200. If satisfies the first condition, the string "The porridge is too hot" gets printed.

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