wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Java Training Final Assessment

Total questions: 40

Worksheet time: 27mins

Name
Class
Date
1.

What is the output of this program?

a)

Welcome to the packages

b)

nothing will print

c)

compile time error

d)

none

2.

Which of the following statement is correct about packages in Java?

a)

java package is a group of similar types of classes, interfaces, Exceptions, Enumerations, Error, Annotations, and sub packages.

b)

Packages will prevent naming conflicts.

c)

java.mypack.* is a built-in package in Java

d)

Package in java can be categorized in two form, built-in package and user-defined package

3.

What is the output of this program?

a)

compile time error

b)

welcome to packages

c)

nothing will print

d)

none

4.

What is the output of this program?

a)

10

5

b)

0

5

c)

5

10

d)

10

10

5.

What is the output of the this program?

a)

10

10

b)

10

5

c)

5

10

d)

0

10

6.

What is the output of this program?

a)

10

5

20

b)

10

5

10

c)

10

10

10

d)

compile time error

7.

What is the output of this program?

a)

0

b)

10

c)

compile time error

d)

nothing will be printed

8.

What is the output of this program?

a)

10

First

b)

5

First

c)

5

d)

10

9.

What is the output of this program?

a)

10

5

b)

10

20

c)

20

5

d)

20

10

10.

What is the output of this program?

a)

static1

static

20

15

b)

static

10

static1

20

c)

static

15

20

static1

d)

static

static1

15

20

11.

What is the output of this program?s

a)

static

first

b)

static

c)

static

block

d)

nothing will be printed

12.

what is the output of this program?

a)

first

block

static

b)

static

first

block

c)

static

block

first

d)

static

13.

What is the output of this program?

a)

20

b)

0

c)

10

d)

compile time error

14.

What is the output of this program?

a)

10

b)

20

c)

compile time error

d)

5

15.

What is the output of this program?

a)

10

b)

15

c)

20

d)

5

16.

What is the output of this program?

a)

10

15

b)

5

15

c)

10

5

15

d)

5

5

15

17.

What is the output of this program?

a)

10

10

20

b)

10

20

5

c)

5

5

5

d)

5

10

20

18.

What is the output of this program?

a)

5

20

10

5

b)

10

20

5

5

c)

5

20

5

10

d)

5

20

5

5

19.

what is the output of this program?

a)

10

5

b)

10

2

c)

5

2

d)

5

5

20.

What is the output of this program?

a)

5

5

b)

2

10

c)

5

10

d)

2

5

21.

What is the output of this program?

a)

5

5

b)

2

10

c)

5

10

d)

2

5

22.
a)

Compile error at line 1 (static x must be only accessed inside static methods)

b)

Compile error at line 2 (constructors can't be static)

c)

Compile error at line 3 (static methods can't invoke this)

d)

Compile error at line 4 (invalid argument type for method main)

23.

What is the output?

a)

r1 r4 pre b1 b2 post

b)

r1 r4 pre b1 b2 r3 r2 post

c)

pre r1 r4 b1 b2 r2 r3 post

d)

r1 r4 pre b1 b2 post r3 r2

24.

What is the output?

a)

one two 1

b)

one two 10

c)

one two 0

d)

compile time error

25.

Which of these following statements are correct

a)

In Pascal case, If the Identifier is the combination of multiple words then every word first letter should be capital.

b)

In pascal case If the Identifier is the combination of multiple words then all the letters in the first word should be small after that every word first letter should be capital.

c)

InputStreamReader is in camel case

d)

nextInt() is in camel case

26.

What is the output?

a)

10

10

20

b)

10

10

10

c)

10

20

10

d)

compilation error

27.

What is the output of this program?

a)

15

myMethod

20

b)

myMethod

20

15

c)

20

myMethod

15

d)

20

15

myMethod

28.

What is the output of this program?

a)

10

myMethod

5

b)

0

myMethod

5

c)

10

myMethod

-5

d)

10

myMethod

0

29.

what is the output of this program?

a)

block

main

static

const

b)

static

main

block

const

c)

const

block

static

main

d)

static

main

const

block

30.

Which of these following are class level variables?

a)

static variables

b)

non-static / instance variables

c)

local variables

d)

constants

31.

What is the output?

a)

5

b)

compilation error

c)

0

d)

10

32.

Fill the blank to print the static variable value

a)

a

b)

this.a

c)

obj.a

d)

First.a

33.

What is the output?

a)

myMethod

b)

Nothing will print

c)

compilation error

d)

none

34.

What is the output?

a)

20

10

30

b)

10

20

30

c)

20

30

10

d)

compilation error

35.

What is the output?

a)

myMethod

myMethod2

myMethod1

b)

myMethod2

myMethod1

myMehod

c)

myMethod1

myMethod2

myMethod

d)

compilation error

36.

What is the output of this program

a)

10

20

20 10

b)

20

20

10 10

c)

10

10

20 20

d)

20

10

10 20

37.

What is the output?

a)

20

10

30

b)

10

30

20

c)

30

20

10

d)

10

20

30

38.

What is the output?

a)

5

5

b)

5

10

c)

5

0

d)

compilation error

39.

What is the output?

a)

10

10

b)

15

15

c)

error: static variable a cannot be access from non-static context

d)

10

15

40.

What is the output?

a)

10

b)

0

c)

error: non - static variable this cannot be referenced from a static context

d)

none