Font size
Worksheets3.2 Data Type, Operator & Expression in Java (part 1)
Total questions: 35
Worksheet time: 18mins
Determine whether the following identifier is valid or invalid.
int -d;
True
False
Determine whether the following identifier is valid or invalid.
int _$;
True
False
Determine whether the following identifier is valid or invalid
int this_is_a_detailed_name_for_identifier;
True
False
Determine whether the following identifier is valid or invalid.
int :b;
True
False
Determine whether the following identifier is valid or invalid
int e#;
True
False
Determine whether the following identifier is valid or invalid.
int 7g;
True
False
Determine whether the following identifier is valid or invalid
int _$c;
True
False
Determine whether the following identifier is valid or invalid.
int 2_w;
True
False
Determine whether the following identifier is valid or invalid.
int .f;
True
False
Determine whether the following identifier is valid or invalid.
int _a;
True
False
Name the data type: "true"
boolean
char
String
double
Name the data type: 1.0
double
int
char
boolean
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
Which declaration will throw an error?
double num = 8;
int averageGrade = 89.7;
boolean done = false;
String done = "true";
Name the data type: false
String
boolean
int
None of the above
A computer walks into a bar...
Ouch.
Sorry, we don't server here.
ERROR 404: Does not compute
Great, computers are self-aware now.
How would you declare a variable storing a person's name?
string name = "Elroy";
name String = "Elroy";
String name = Elroy;
String name = "Elroy";
Me llamo Elroy
What data type would you use to store names of students?
String
char
boolean
None of these
blonde
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";
I do hereby declare thee Sir Tax Rate
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";
Trick question - no one passes this class
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")
What is love? Baby dont hurt me. Dont hurt me. No more.
A variable that holds words
String
boolean
int
float
A dictionary
A variable that holds true or false
String
boolean
int
float
Alex Trebek
1.Java (a) keyword is used to declare a variable as a True and False values only.
2.Java (a) keyword is used to declare a variable that can hold an 8-bit data values.
3. Java (a) keyword is used to declare a variable that can hold unsigned 16-bit Unicode characters
4.Java (a) keyword is used to declare a variable that can hold a 64-bit floating-point numbers.
5. Java (a) keyword is used to declare a variable that can hold a 32-bit signed integer.
6.Java (a) keyword is used to declare a variable that can hold a 64-bit integer.
7.Java (a) keyword is used to indicate that a reference does not refer to anything. It removes the garbage value.
8.Java (a) keyword is used to return from a method when its execution is complete.
9.Java (a) keyword is an access modifier. It is used to indicate that an item is accessible anywhere. It has the widest scope among all other modifiers.
10.Java (a) keyword makes classes and interfaces available and accessible to the current source code.
