Question: QUESTION 5 What will be displayed from executing the following segment of code? You may assume testScore has a value of 90. int testScore; if

QUESTION 5 What will be displayed from executing the following segment of code? You may assume testScore has a value of 90. int testScore; if (testScore < 60); // Note the semicolon. Write("You failed the test! "); if (testScore > 60) Write("You passed the test! "); else Write("You need to study for the next test!");" + You failed the test! You passed the test! You failed the test! You passed the test! You failed the test! You need to study for the next test! none of the above

QUESTION 6 Which statement in C# allows you to do the following: Properly check the variable code to determine whether it contains the character C, and if it does, display This is a check and then advance to a new line? if code is equal to C WriteLine("This is a check"); if (code = "C") WriteLine("This is a check"); if (code == 'C') WriteLine("This is a check"); if (code == C) WriteLine("This is a check"); none of the above

QUESTION 7 Incorrect use of spacing with an if statement: detracts from its readability causes a syntax error message can change the program logic causes a logic error message all of the above

QUESTION 8 Consider the following if statement, which is syntactically correct, but uses poor style and indentation: if (x >= y) if (y > 0) x = x * y; else if (y < 4) x = x y; Assume that x and y are int variables containing the values 9 and 3, respectively, before execution of the preceding statement. After execution of the statement, what value does x contain? 9 1 6 27 none of the above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!