Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

ambot para asa ni

Total questions: 20

Worksheet time: 14mins

Name
Class
Date
1.

What is a correct syntax to output "Hello World" in Java?

a)

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

b)

echo("Hello World")

c)

print ("Hello World");

d)

Console.WriteLine("Hello World");

2.

Java is short for "JavaScript"

a)

FALSE

b)

TRUE

3.

Which data type is used to create a variable that should store text?

a)

String    

b)

string

c)

Txt

d)

myString

4.

How do you create a variable with the numeric value 5?

a)

int x = 5;

b)

num x = 5

c)

float x = 5;

d)

x = 5;

5.

How do you create a variable with the floating number 2.8?

a)

float x = 2.8f;   

b)

byte x = 2.8f

c)

int x = 2.8f;

d)

x = 2.8f;

6.

The value of a string variable can be surrounded by single quotes.

a)

True  

b)

False    

7.

Which operator can be used to compare two values?

a)

><

b)

==

c)

=

d)

<>

8.

To declare an array in Java, define the variable type with:

a)

[]

b)

{}

c)

()

9.

Which keyword is used to import a package from the Java API library?

a)

import

b)

lib

c)

package

d)

getlib

10.

How do you start writing an if statement in Java?

a)

if (x > y)    

b)

if x > y:

c)

if x > y then:

11.

Which statement is used to stop a loop?

a)

tama kana accla

b)

exit

c)

stop

d)

break

12.

single line comment

(a)  

13.

multi-line comment

(a)  

14.

Create a variable named carName and assign the value Volvo to it.

(a)  

15.

If you forget to put a closing quotation mark on a string, what kind error will be raised?

(a)  

16.

What is the Java source filename extension

(a)  

17.

Java byte code filename extension

(a)  

18.

perform mathematical computations and display the result

(a)  

19.

Which of the following identifiers are valid?

a)

miles

b)

class

c)

Test

d)

apps

20.

Assign 1.0 to variable radius

(a)