Question
all for c# QUESTION 1 Examine the code. When will C be assigned 3? (Be careful.) if (A == B); C = 3; when A
all for c#
QUESTION 1
Examine the code. When will C be assigned 3? (Be careful.) if (A == B); C = 3;
when A is equal to B | ||
when A is not equal to B | ||
never | ||
every time the program is executed | ||
not enough information is given |
1.00000 points
QUESTION 2
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 |
1.00000 points
QUESTION 3
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 |
1.00000 points
QUESTION 4
After execution of the following code, what will be the value of inputValue? int inputValue = 0; if (inputValue > 5) inputValue += 5; else if (inputValue > 2) inputValue += 10; else inputValue += 15;
15 | ||
10 | ||
25 | ||
0 | ||
5 |
1.00000 points
QUESTION 5
Given the following segment of code, what will be the output? int x = 5; if (x == 2) Write("Brown, brown, run aground. "); else Write("Blue, blue, sail on through. "); Write("Green, green, nice and clean.");
Brown, brown, run aground. | ||
Blue, blue, sail on through. | ||
Brown, brown, run aground. Blue, blue, sail on through. | ||
Blue, blue, sail on through. Green, green, nice and clean. | ||
none of the above |
1.00000 points
QUESTION 6
If aValue and bValue are both defined as integers, the result of the expression if (aValue == bValue) is:
aValue | ||
10 | ||
an integer value | ||
true or false | ||
determined by an input statement |
1.00000 points
QUESTION 7
The single equal symbol (=) is:
the operator used to test for equality | ||
used for comparing two items | ||
used as part of an assignment statement | ||
considered a logical compound operator | ||
all of the above |
1.00000 points
QUESTION 8
What is displayed when the following code executes? score = 0; if (score > 95) Write("Congratulations! "); Write("That's a high score! "); Write("This is a test question!");
This is a test question! | ||
Congratulations! That's a high score! This is a test question! | ||
That's a high score! This is a test question! | ||
Congratulations! That's a high score! | ||
none of the above |
1.00000 points
QUESTION 9
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 |
1.00000 points
QUESTION 10
Complete the tables below for Logical And and Or (T and F denote true and false.) P Q P And Q T T T T F F T F F F P Q P Or Q T T T T F F T F F F
4.00000 points
QUESTION 11
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 |
1.00000 points
QUESTION 12
What does the following program segment display? int f = 7, s = 15; f = s % 2; if (f != 1) { f = 0; s = 0; } else if (f == 2) { f = 10; s = 10; } else { f = 1; s = 1; } WriteLine(" " + f + " " + s);
7 15 | ||
0 0 | ||
10 10 | ||
1 1 | ||
none of the above |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started