Font size
WorksheetsJava Training Final Assessment
Total questions: 40
Worksheet time: 27mins
What is the output of this program?
Welcome to the packages
nothing will print
compile time error
none
Which of the following statement is correct about packages in Java?
java package is a group of similar types of classes, interfaces, Exceptions, Enumerations, Error, Annotations, and sub packages.
Packages will prevent naming conflicts.
java.mypack.* is a built-in package in Java
Package in java can be categorized in two form, built-in package and user-defined package
What is the output of this program?
compile time error
welcome to packages
nothing will print
none
What is the output of this program?
10
5
0
5
5
10
10
10
What is the output of the this program?
10
10
10
5
5
10
0
10
What is the output of this program?
10
5
20
10
5
10
10
10
10
compile time error
What is the output of this program?
0
10
compile time error
nothing will be printed
What is the output of this program?
10
First
5
First
5
10
What is the output of this program?
10
5
10
20
20
5
20
10
What is the output of this program?
static1
static
20
15
static
10
static1
20
static
15
20
static1
static
static1
15
20
What is the output of this program?s
static
first
static
static
block
nothing will be printed
what is the output of this program?
first
block
static
static
first
block
static
block
first
static
What is the output of this program?
20
0
10
compile time error
What is the output of this program?
10
20
compile time error
5
What is the output of this program?
10
15
20
5
What is the output of this program?
10
15
5
15
10
5
15
5
5
15
What is the output of this program?
10
10
20
10
20
5
5
5
5
5
10
20
What is the output of this program?
5
20
10
5
10
20
5
5
5
20
5
10
5
20
5
5
what is the output of this program?
10
5
10
2
5
2
5
5
What is the output of this program?
5
5
2
10
5
10
2
5
What is the output of this program?
5
5
2
10
5
10
2
5
Compile error at line 1 (static x must be only accessed inside static methods)
Compile error at line 2 (constructors can't be static)
Compile error at line 3 (static methods can't invoke this)
Compile error at line 4 (invalid argument type for method main)
What is the output?
r1 r4 pre b1 b2 post
r1 r4 pre b1 b2 r3 r2 post
pre r1 r4 b1 b2 r2 r3 post
r1 r4 pre b1 b2 post r3 r2
What is the output?
one two 1
one two 10
one two 0
compile time error
Which of these following statements are correct
In Pascal case, If the Identifier is the combination of multiple words then every word first letter should be capital.
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.
InputStreamReader is in camel case
nextInt() is in camel case
What is the output?
10
10
20
10
10
10
10
20
10
compilation error
What is the output of this program?
15
myMethod
20
myMethod
20
15
20
myMethod
15
20
15
myMethod
What is the output of this program?
10
myMethod
5
0
myMethod
5
10
myMethod
-5
10
myMethod
0
what is the output of this program?
block
main
static
const
static
main
block
const
const
block
static
main
static
main
const
block
Which of these following are class level variables?
static variables
non-static / instance variables
local variables
constants
What is the output?
5
compilation error
0
10
Fill the blank to print the static variable value
a
this.a
obj.a
First.a
What is the output?
myMethod
Nothing will print
compilation error
none
What is the output?
20
10
30
10
20
30
20
30
10
compilation error
What is the output?
myMethod
myMethod2
myMethod1
myMethod2
myMethod1
myMehod
myMethod1
myMethod2
myMethod
compilation error
What is the output of this program
10
20
20 10
20
20
10 10
10
10
20 20
20
10
10 20
What is the output?
20
10
30
10
30
20
30
20
10
10
20
30
What is the output?
5
5
5
10
5
0
compilation error
What is the output?
10
10
15
15
error: static variable a cannot be access from non-static context
10
15
What is the output?
10
0
error: non - static variable this cannot be referenced from a static context
none
