Code
After running the following loop inside a C# program, what will be the output? for (int i = 0; i < 3; i++) { Console.Write($"{i} "); //output in one line }
0 1 2
After running the following loop inside a C# program, what will be the output if the variable "number" equals 1? while (number <= 3) { Console.Write($"{number++} "); //output in one line }
1 2 3
After running the following loop inside a C# program, what will be the output if the variable "number" equals 1? while (number <= 3) { Console.Write($"{++number}, "); //output in one line }
2 3 4
After running the following loop inside a C# program, what will be the output? for (int i = 3; i > 0; i--) { Console.Write($"{i} "); //output in one line }
3 2 1
Which answer properly displays a sentence, "How are you doing today?"
Console.WriteLine("How are you doing today?");
double Score= 21; double wins = 7; Based on these two variables, to compose a quick headline for OU's last football game, which line correctly concatenates the variables as output?
Console.WriteLine("OU won game " + wins + " by " + Score + " points!");
Which format specifier transforms the variable (named pi) to have only two decimal places (i.e, 3.14) in the output?
Console.WriteLine(pi.ToString("N2"));
What is the format specifier and precision specifier that changes a number to a percent with three decimal places? (i.e. 75.841%)
P3
After running the following loop inside a C# program, what will be the output if the variable "number" equals 1? while (number <= 3) { Console.WriteLine("Congrats"); number++; }
Three lines of "Congrats" will be shown
The following DO-WHILE loop will NOT run the code in the brackets until the condition is FALSE. do{ } while (true);
false
The following FOR-loop will stop if the "i < length" condition is met. for (int i = 0; i < length; i++){}
false
What variable type(s) can be used to store mathematical numbers?
float
Which of the following is to create a variable named ID that stores the number 10 as an integer?
int ID = 10;
What variable type is used to store user input from Console.ReadLine();
string
To convert a number variable (called cash) into a string variable (called MyMoney), we should use ____
string MyMoney = cash.ToString;
The IF statement in general is more versatile and powerful than ternary operator.
true
The following WHILE loop will only run the code inside the brackets if the condition is true. while (true){ }
true
for (int i = 0; i < 3; i++) { Console.Write("{i} "); //output in one line }
{i} {i} {i}