wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Basics of Java

Total questions: 20

Worksheet time: 42mins

Name
Class
Date
1.

Attributes of an object are also known as

a)

methods

b)

properties

c)

classes

d)

functions

2.

The "method" is another name for

a)

an object

b)

a class

c)

a function

d)

a variable

3.
A variable that holds words
a)
String
b)
boolean
c)
int
d)
float
4.
What is at the end of a line of code?
a)
#
b)
;
c)
)
d)
>
5.
How do I insert a multi-line comment?
a)
/* Comment */
b)
? Comment ?
c)
Comment **
d)
-Java Comment-
6.

When programming, you have to use Data Types. Which of the following refers to interfaces, classes, and arrays?

a)

Primitive

b)

Non-Primitive

c)

Arrays

d)

Boolean

7.

Java Tokens help the compiler. Which of the following is a type of Java Token?

a)

Identifiers

b)

Keywords

c)

Operators

d)

All of the answers.

8.

Java programs are _____________

a)

Translated

b)

Compiled

c)

Interpreted

d)

Understood

9.

________ & _________ are two types of java programs

a)

Application

b)

Applets

c)

Operating System

d)

System Software

10.

(a)   java package supports scanner classes

11.

(a)   java package supports math functions

12.

Who developed Java?

a)

James Gosling

b)

Bjarne Stroustrup

c)

Robert James

d)

None

13.

(a)   is the smallest individual unit of a program that holds a meaning for the compiler.

14.

(a)   are particular words which acts as a key to a code. These are predefined words by Java so it cannot be used as a variable or object name.

15.

(a)   are non graphic characters, which are used as commands to direct the cursor while printing.

16.

(a)   is conversion of one datatype to another with users intervention.

17.

What is the default value of a Boolean variable?

a)

True

b)

true

c)

False

d)

false

18.

Conversion of one data type to the other without user intervention is known as

(a)  

19.

Consider the following code segment:


int var = 12;

var = var % 7;

var = var - 1;

System.out.println(var);


What is printed as a result of executing the code segment?

a)

0

b)

1

c)

2

d)

4

e)

5

20.

Assume that a, b, and c have been declared and initialized with int values. The expression


!(a > b || b <= c)


is equivalent to which of the following?

a)

a > b && b <= c

b)

a <= b || b > c

c)

a <= b && b > c

d)

a < b || b >= c

e)

a < b && b >= c