NEW
Font size
WorksheetsJava Basics (Data Types and Variables)
Total questions: 16
Worksheet time: 8mins
Name the data type: "true"
boolean
char
String
double
Name the data type: 1.0
double
int
char
boolean
Name the data type: '3'
int
char
String
None of the above
Name the data type: false
String
boolean
int
None of the above
What data type would you use for storing the number of students in a class?
boolean
String
double
int
What data type would you use for storing the average test score in a class?
double
String
int
char
What data type would you use for storing letter grades (without - or +) for students in a class?
String
char
int
boolean
What data type would you use to store names of students?
String
char
boolean
None of these
How would you declare a variable storing a person's name?
string name = "Jeff";
name String = "Jeff";
String name = Jeff;
String name = "Jeff";
How would you declare a variable storing the tax rate?
int taxRate = 5.1;
taxRate = "5.1";
double taxRate = 5.1;
double taxRate = "5.1";
How would you declare a variable that tells you that someone passed a class?
boolean passed = 'true';
boolean passed = true;
passed = true;
String passed = "true";
Which expression evaluates to true?
false == false
true != true
4 < 4
true == true != true
Which expression evaluates to false?
15 % 3 < 2
3 * 3 % 2 <= 0
false == false
false == false == false == false
Which declaration with throw an error?
String name = "1 1233 141";
double num = 1;
int bigNumber = 1234567890;
char random = '7';
Which declaration will throw an error?
double num = 8;
int averageGrade = 89.7;
boolean done = false;
String done = "true";
What prints out "I love Java" successfully?
System.out.println(I love Java);
Systemoutprintln("I love Java);
System.out.println("I love" + " Java");
System.out.println("I love Java")
