wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Java Quiz - 1

Total questions: 15

Worksheet time: 9mins

Name
Class
Date
1.

JDK, JRE and JVM are __________

a)

platform-dependent

b)

platform-independent

2.

public class Program{

    public static void main(String[] args) {

        System.out.println(null);

    }

}

a)

null

b)

compilation error

c)

runtime error

3.

public class Quiz{

    public static void main(String[] args) {

        System.out.println((Object)null);

        System.out.println((String)null);

    }

}

a)

null

null

b)

null

Runtime error

c)

Compilation error

4.

Given the following code, which expression displays the word "Equal"?

a)
  1. s1==s2

b)
  1. s1.matchCase(s2)

c)
  1. s1.equalsIgnoreCase(s2)

d)
  1. s1.equals(s2)

5.

Predict the output ?

a)

Compilation error

b)

abc

c)

411

d)

Runtime error

6.

JVM allocates default values for Instance variables?

a)

true

b)

false

7.

Is it necessary to create objects to access local variables?

a)

Yes

b)

No

8.

Can local variables be used without initialization?

a)

Yes

b)

No

9.

What's the output of the following code?

a)

0

1

b)

else

c)

compilation error

10.

What's the output of the following code?

a)

10

b)

30

c)

31

11.

What's the output of the following code?

a)

default

b)

4

c)

Compilation error

12.

What's the output of the following code?

a)

true

false

ABC

b)

false

ABC

c)

true

ABC

13.

What is the output of the following code?

a)

jZvZquizsAa

b)

javvquizsAa

c)

javaquizsAa

14.

What is the output of the following code?

a)

Compilation error

b)

no ouput

c)

hi

15.

What is the output of the following code?

a)

Compilation error

b)

no output

c)

hi