Output and Input
Syntax
Can you fix it?
Coding Math
What's the Output?
100

You want to write a message (output) to the console, but want the cursor to move to a new line. You should use what statement?

Console.WriteLine();

100

For both a CWL and a CW, what character must be at the end of the statement to indicate termination?

semi-colon

100
CWL("My favorite food is " + favFood);

string favFood = "seafood";


What is wrong?

the variable should be declared and initialized before trying to use the value in output. swap the order.

100

What is the expected output of...

Console.WriteLine(4 * 2);

8

100

Console.WriteLine("Hello, World");

Hello, World

200

You want to write a message to the console, but want the cursor to remain on the same line. You can use what statement?

Console.Write();

200
string name = "Matt";

CWL("Hi, " ___ name ____ "!");


What is missing for concatenation?

plus sign (+)

200

string firstName;

CWL("Enter your first name.");

Console.ReadLine();

Need to be able to capture and store the user input and assign it to a variable. Should be firstName = CRL

200

double pennyWeight = 3.11;

The user has a total of 100 pennies. Write a formula to calculate the total weight of pennies within a Console.WriteLine(); without creating a new variable.



CWL("Total weight: " + pennyWeight * 100);

200

string pixarMovie = "Up";

CWL(pixarMovie);

Up

300

I have a simple program that prompts the user for their name and then greets them. I want to hide the ending (behind-the-scenes) information from the user and leave the console open until the user hits any key. What can I use?

Console.ReadKey();

300

I am storing a user-entered number as an integer. What is the correct syntax for reading the input and converting it to an integer value?

Convert._____32(Console.ReadLine());

Fill in the blank

ToInt

300

Console.Write("2 + 2 = ");

Console.WriteLine(2 * 2);

What is wrong?

Should be the addition operator and not multiplication in the CWL.

300

Console.WriteLine(0 / 100);

What is the output?

0

300

string favoriteActionMovie = "John Wick";

CWL(favoriteActionMovie);

favoriteActionMovie = "Violent Night";

CWL(favoriteActionMovie);

John Wick

Violent Night

400

I am prompting the user to enter their age as text. What method should I use to store their answer (input)?

Console.ReadLine();

400

double bodyTemp;

CWL("Enter body temperature.");

bodyTemp = Convert.ToDouble(_______);

What should be in the parentheses?

Console.ReadLine()

400

string firstName = "Mary";

string lastName = Poppins;

CWL("Hi, " + firstName + " " + lastName + ".");

What is wrong?

Poppins should be in double quotes since it is text (string)

400

Console.WriteLine(100 / 0);


What is wrong with the following mathematical operation?

You can not divide by zero.

400

Console.Write("My name is");

Console.WriteLine("Matt");

My name isMatt

500

string firstName = "John";

string lastName = "Smith";

Fill in the blank.

string fullName = _________________

firstName + " " + lastName

500

string fruit1 = "apple";

This is an example of declaring and initializing. Fill in the blank of what is needed to only declare the next variable.

string fruit2_

; semi-colon

500

I want to update the value of the stored int variable from one value to another. The first CWL should display the first value and the second CWL the new value.

int num = 5;

CWL(num);

CWL(num);

num = 2;

num = 2 should be moved before the second Console.WriteLine();

500

This program has 5 different test scores. Correct the code to figure out and display the average test score.

int test1 = 100;

int test2 = 75;

int test3 = 90;

int test4 = 95;

int test5 = 80;

int avgTestScore = (test1 * test2 * test3 * test4 * test5) / 10;

What is wrong? Two things.

Should add each test together instead of multiply. Should divide by 5 (the number of tests) instead of 10

500

//scores

Console.WriteLine("Scores:\t100\t75\t50");

Scores:     100     75      50

M
e
n
u