Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Java Refresher

Total questions: 11

Worksheet time: 6mins

Name
Class
Date
1.
Which of these statements would print the line "Hello World" to standard output?
a)
system.out.println("Hello World");
b)
System.out.println("Hello World")
c)
System.out.println("Hello World");
d)
system.out.println(Hello World);
2.
Which of these is NOT an acceptable variable name?
a)
fourWheels
b)
_fourWheels
c)
4wheels
d)
$wheels
3.
Which of these is the correct way to declare a variable age and make it equal to 18?
a)
int age = 18;
b)
int age = 18
c)
Integer age = 18;
d)
age = 18;
4.
Which variable type would you use if you want to use decimals?
a)
char
b)
int
c)
double
d)
String
5.
Which of these is the correct way to declare a variable hello and make it equal to "Hello World"?
a)
char hello = "Hello World";
b)
String hello = "Hello World";
c)
String hello = Hello World;
d)
char[] hello = "Hello World";
6.
What is the output of the following java program? 
a)
7 35
b)
Error
c)
35 7
7.
Which of these variable types is NOT primitive?
a)
int
b)
char
c)
boolean
d)
String
8.
What is the output of the following program?
a)
[126, 167, 95]
b)
[252, 334, 190]
c)
[0, 0, 0]
d)
Error
9.
Which is NOT a comparitive operator?
a)
!
b)
>
c)
<
d)
==
10.
Which is NOT a logical operator?
a)
&&
b)
||
c)
!
d)
?
11.
Which is the correct way for comparing two Strings objects in Java?
a)
name <= "Maryam"
b)
name=="Maryam"
c)
name.equals("Maryam")
d)
name == ("Maryam")