6. What is displayed when the following code executes? score = 0; if (score > 95
ID: 3674343 • Letter: 6
Question
6. What is displayed when the following code executes?
score = 0; if (score > 95)
Console.Write(“Congratulations! “);
Console.Write(“That’s a high score! “);
Console.Write(“This is a test question!”);
a. This is a test question!
b. Congratulations! That’s a high score! This is a test question!
c. That’s a high score! This is a test question!
d. Congratulations! That’s a high score!
e. None of the above
7. 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?
a. if code is equal to C Console.WriteLine(“This is a check”);
b. if(code = “C”) Console.WriteLine(“This is a check”);
c. if(code == ‘C’) Console.WriteLine(“This is a check”);
d. if(code == C) Console.WriteLine(“This is a check”);
e. None of the above
8. If you intend to place a block of statements within an if statement, you must use around the block:
a. Parentheses
b. Square brackets
c. Quotation marks
d. Curly braces
e. None of the above
9. What is the result of the following conditional expression when aValue = 100 and bValue = 7?
a. 0
b. 1000
c. 2000
d. 7
e. None of the above
10. When used with a while statement, which jump statement causes execution to halt inside a loop body and immediately transfers control to the conditional expression?
a. break
b. goto
c. return
d. continue
e. None of the above
Explanation / Answer
6) Given score =0
0>95 is false so first statement is not printed.
Result: That’s a high score! This is a test question!
7) e. None of the above
Reason:Option a- syntactically not supported
Option b:if statement should contain boolean expresssion not assignment.
Option c:Check if code is equal to C and not contains C
Option d:Syntactically Wrong
8) If you intend to place a block of statements within an if statement, you must use around the block:
d. Curly braces
a) Paranthesis can contain the condition expression
b. Square brackets for indices
c. Quotation marks for Strings
10. When used with a while statement, which jump statement causes execution to halt inside a loop
body and immediately transfers control to the conditional expression?
d. continue (continue skips the current execution and transfer control to while)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.