Variables
Write the Code
Fix the Error
Mr. Tocci Trivia
100

If I asked the user to enter their favorite song what type of variable would I store it as?

String

100

Write the code that will display the words (spelling and punctuation matter):

Hello Class

System.out.println("Hello Class");

100

What is the mistake in the following lines?

int x = 24;
System.out.println("The total is " + x )

Missing semicolon on the print line

100

What is my favorite food?

Chicken Pot Pie

200

If I asked the user to enter the most amount bottles of water they have drank in a day (to the near whole slice), what type of variable would I store it as

int

200

Write the code that creates a variable called myNumber of type int and store the value 7

int myNumber = 7;

200



value = 70;
System.out.println("The value is " + value );

didn't specify the type of variable value.
200

What is my class room number? I want the number and letter.

For example 

A 103

 C 201

300

If I asked the user to enter in their latest test score (can have decimals), what type of variable would I store it as?

double

300

Write a line of code that asks the user to enter if they did their homework last night?

boolean didHomework = readBoolean("did you do your homework last night?");

300

What is the mistake?

boolean x = (int) 5.6;

The variable type should be int not boolean

300

True or False: Mr. Tocci is a junior

True

400

What type of variable would I use to store the value 3.1415

double

400

Write the code that asks the user for their name and displays Hello +whatever name they entered.

String name = readLine("Enter your name:");

System.out.println("Hello "+ name);

400

What is the mistake?

double x = readdouble("Enter a value:");

System.out.println(x);

The second D in readDouble should be capitalized.

400

How old is Mr. Tocci?

26

500

What variable type would I used to store the value "N0tMyP4assword"

String

500

Write the code that asks the user to enter two test scores (can have decimals) and calculate the average. You need to round this to the near whole number as well.

double score1 = readDouble("Enter score:");

double score2 = readDouble("Enter score:");

int rounded = (int) (((score1+score2)/2)+0.5);

System.out.println(rounded);

500

What is the mistake?

String name = readString("Enter your name");

System.out.println(name);

It is readLine not readString

500

What school did Mr. Tocci go to for college?

UMass Dartmouth