wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Java Quiz 1: Introduction

Total questions: 10

Worksheet time: 30mins

Name
Class
Date
1.

Which of the following can be used for decimal values?

a)

int

b)

String

c)

long

d)

double

2.

In Java a string is a:

a)

Long strand of thread

b)

A series of objects arranged in a line.

c)

Group of visible symbols contained in "quotes".

d)

A series of objects arranged in a line.

3.

Which of the following is the correct way to create a String in Java?

a)

"Hello, World" = String message;

b)

String message = "Hello, World!";

c)

message = Hello, World!;

d)

String = "Hello, World!"

4.

Which of the following is acceptable as a variable name in Java for int type?

a)

myInt

b)

myint!

c)

4isMyFavoriteInt

d)

my int

5.

What will the following statement display when run?

System.out.println(5+2*4-1);

a)

12

b)

27

c)

5+2*4-1

d)

11

6.

What will the following statements display when run?

String str1="Hello";

String str2="Goodbye";

String str3=str1+str2;

System.out.println(str3+str1);

a)

"str3+str1"

b)

"HelloGoodbyeHello"

c)

"HelloHelloGoodbye"

d)

"Hello GoodBye Hello"

7.

Variable names can start with an underscore.

a)

True

b)

False

8.

Variables are case sensitive.

a)

True

b)

False

9.

Concatenation is the joining of two or more strings in Java.

a)

True

b)

False

10.

In Java variables have to be given a specific type.

a)

True

b)

False