Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Java Basics

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Which one is a Java valid variable name?

a)

Sum Grades

b)

static

c)

public

d)

FindAverage

2.

Static methods refer to methds that:

a)

are private and no one can see them

b)

can be only accessed by an object of same class

c)

return data of type static

d)

can be written as ClassName.methodName(arguments)

3.

we could pass a whole array to a method as a value

a)

True

b)

False

4.

which statement is correct?

a)

int Var

b)

boolean 15;

c)

double var123;

d)

int min=0

5.

int [] array2= array1;

a)

array2 references to array1 and points to array1's elements

b)

array2 will be created and has the same elements as array1

c)

nothing will happen

6.

The output of the following code is:

int[] array = {2,4,6,8,10};

for (int i=0; i < array.length;i++){

System.out.println(array[2]);

}

a)

2

4

6

8

10

b)

2,4,6,8,10

c)

6

6

6

6

6

d)

Nothing

7.

method signature is

a)

method name + parameter list

b)

same as method head

c)

same as method body

d)

a cool signature :)

8.

3 + 6 / 2 * 3 - 1 + 2 =

a)

14.5

b)

13

c)

5

9.

num= 2;

x=num++;

++num;

After performing the above statements, the values of x and num are

a)

x= 2

num= 3

b)

x = 3

num = 4

c)

x= 2

num = 4

d)

x= 3

num= 3

10.

nextInt() is used to read user's numerical input

a)

True

b)

False