Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Exploring java.lang & java.io-7

Total questions: 184

Worksheet time: 2hrs 32mins

Name
Class
Date
1.
Which of these classes is not included in java.lang?
a)
Byte
b)
Integer
c)
Array
d)
Class
2.
Which of these is a process of converting a simple data type into a class?
a)
type wrapping
b)
type conversion
c)
type casting
d)
none of the Mentioned
3.
Which of these is a super class of wrappers Double & Integer?
a)
Long
b)
Digits
c)
Float
d)
Number
4.
Which of these is a wrapper for simple data type float?
a)
float
b)
double
c)
Float
d)
Double
5.
Which of the following is a method of wrapper Float for converting the value of an object into byte?
a)
bytevalue()
b)
byte byteValue()
c)
Bytevalue()
d)
Byte Bytevalue()
6.
Which of these methods is used to check for infinitely large and small values?
a)
isInfinite()
b)
isNaN()
c)
Isinfinite()
d)
IsNaN()
7.
Which of the following package stores all the simple data types in java?
a)
lang
b)
java
c)
util
d)
java.packages
8.

What will be the output of the following Java code?

Online Java Compiler - Google Chrome (gyazo.com)

a)

0

b)

1

c)

True

d)

False

9.

What will be the output of the following Java code? https://gyazo.com/0120c13ade136806bc2901249739bd4b

a)

0

b)

1

c)

True

d)

False

10.

What will be the output of the following Java code?

Online Java Compiler - Google Chrome (gyazo.com)

a)

1001

b)

10011

c)

11011

d)

10001

11.
Which of these is a wrapper for data type int?
a)
Integer
b)
Long
c)
Byte
d)
Double
12.
Which of the following methods is a method of wrapper Integer for obtaining hash code for the invoking object?
a)
int hash()
b)
int hashcode()
c)
int hashCode()
d)
Integer hashcode()
13.
Which of these is a super class of wrappers Long, Character & Integer?
a)
Long
b)
Digits
c)
Float
d)
Number
14.
Which of these is a wrapper for simple data type char?
a)
Float
b)
Character
c)
String
d)
Integer
15.
Which of the following is method of wrapper Integer for converting the value of an object into int?
a)
bytevalue()
b)
int intValue();
c)
Bytevalue()
d)
Byte Bytevalue()
16.
Which of these methods is used to obtain value of invoking object as a long?
a)
long value()
b)
long longValue()
c)
Long longvalue()
d)
Long Longvalue()
17.

What will be the output of the following Java program?

Online Java Compiler - Google Chrome (gyazo.com)

a)

true false true

b)

false true true

c)

true true false

d)

false false false

18.

What will be the output of the following Java program?

Online Java Compiler - Google Chrome (gyazo.com)

a)

0

b)

1

c)

256

d)

257

19.

What will be the output of the following Java program?

Online Java Compiler - Google Chrome (gyazo.com)

a)

0

b)

1

c)

257

d)

257

20.

What will be the output of the following Java program?

Online Java Compiler - Google Chrome (gyazo.com)

a)

256

b)

256

c)

256

d)

257

21.
Which of these class have only one field ‘TYPE’?
a)
Void
b)
Process
c)
System
d)
Runtime
22.
Which of the following method of Process class can terminate a process?
a)
void kill()
b)
void destroy()
c)
void terminate()
d)
void exit()
23.
Standard output variable ‘out’ is defined in which class?
a)
Void
b)
Process
c)
Runtime
d)
System
24.
Which of these class can encapsulate an entire executing program?
a)
Void
b)
Process
c)
Runtime
d)
System
25.
Which of the following is method of System class is used to find how long a program takes to execute?
a)
currenttime()
b)
currentTime()
c)
currentTimeMillis()
d)
currenttimeMillis()
26.
Which of these class holds a collection of static methods and variables?
a)
Void
b)
Process
c)
Runtime
d)
System
27.

What will be the output of the following Java code?

Online Java Compiler - Google Chrome (gyazo.com)

a)

0

b)

1

c)

1000

d)

System Dependent

28.

What will be the output of the following Java code?

Online Java Compiler - Google Chrome (gyazo.com)

a)

ABCDEF ABCDEF

b)

ABCDEF GHIJKL

c)

GHIJKL ABCDEF

d)

GHIJKL GHIJKL

29.

What will be the output of the following Java code?

Online Java Compiler - Google Chrome (gyazo.com)

a)

ABCDEF GHIJKL

b)

ABCDEF GCDEFL

c)

GHIJKL ABCDEF

d)

GCDEFL GHIJKL

30.

What will be the output of the following Java code?

Online Java Compiler - Google Chrome (gyazo.com)

a)

ABCDEF GHIJKL

b)

ABCDEF GCDEFL

c)

GHIJKL ABCDEF

d)

GCDEFL GHIJKL

31.
Which of these class is a superclass of all other classes?
a)
Math
b)
Process
c)
System
d)
Object
32.
Which of these method of Object class can generate duplicate copy of the object on which it is called?
a)
clone()
b)
copy()
c)
duplicate()
d)
dito()
33.
What is the value of double consonant ‘E’ defined in Math class?
a)
approximately 3
b)
approximately 3.14
c)
approximately 2.72
d)
approximately 0
34.
Which of these method is a rounding function of Math class?
a)
max()
b)
min()
c)
abs()
d)
all of the mentioned
35.
Which of these class contains only floating point functions?
a)
Math
b)
Process
c)
System
d)
Object
36.
Which of these class encapsulate the runtime state of an object or an interface?
a)
Class
b)
Object
c)
Runtime
d)
System
37.

What is the value of “d” in the following Java code snippet?

Online Java Compiler - Google Chrome (gyazo.com)

a)

2

b)

3

c)

4

d)

2.5

38.

What will be the output of the following Java program?

Online Java Compiler - Google Chrome (gyazo.com)

a)

0

b)

3

c)

3

d)

3.1

39.

What will be the output of the following Java program?

Online Java Compiler - Google Chrome (gyazo.com)

a)

True

b)

flase

c)

3.1

d)

4.5

40.

What will be the output of the following Java program?

Online Java Compiler - Google Chrome (gyazo.com)

a)

2

b)

4

c)

8

d)

9

41.
Which of these exceptions is thrown by methods of System class?
a)
IOException
b)
SystemException
c)
SecurityException
d)
InputOutputException
42.
Which of these methods initiates garbage collection?
a)
gc()
b)
garbage()
c)
garbagecollection()
d)
Systemgarbagecollection()
43.
Which of these methods loads the specified dynamic library?
a)
load()
b)
library()
c)
loadlib()
d)
loadlibrary()
44.
Which of these method can set the out stream to OutputStream?
a)
setStream()
b)
setosteam()
c)
setOut()
d)
streamtoOstream()
45.
Which of these values are returns under the case of normal termination of a program?
a)
0
b)
1
c)
2
d)
3
46.

What will be the output of the following Java program?

Online Java Compiler - Google Chrome (gyazo.com)

a)

0

b)

1

c)

1000

d)

System Dependent

47.

What will be the output of the following Java program?

Online Java Compiler - Google Chrome (gyazo.com)

a)

ABCDEF ABCDEF

b)

ABCDEF GHIJKL

c)

GHIJKL ABCDEF

d)

GHIJKL GHIJKL

48.

What will be the output of the following Java program?

https://gyazo.com/7ef5bc16b1717be562f5a87d9b5117ef

a)

ABCDEF ABCDEF

b)

ABCDEF GHIJKL

c)

ABCDEF GHIABC

d)

GHIJKL GHIJKL

49.

What will be the output of the following Java program?

https://gyazo.com/d6822d64e782afe0a4b7735619f95167

a)

ABCDEF ABCDEF

b)

ABCDEF GHIJKL

c)

ABCDEF GHIABC

d)

ABCDEF GHICDL

50.

What will be the output of the following Java program?

https://gyazo.com/39c6d2330838443e1bc6e88ce8ae4fee

a)

0

b)

1

c)

4

d)

5

51.
Which of these is a super class of wrappers Double and Float?
a)
Long
b)
Digits
c)
Float
d)
Number
52.
Which of the following methods return the value as a double?
a)
doubleValue()
b)
converDouble()
c)
getDouble()
d)
getDoubleValue()
53.
Which of these methods can be used to check whether the given value is a number or not?
a)
isNaN()
b)
isNumber()
c)
checkNaN()
d)
checkNumber()
54.
Which of these method of Double wrapper can be used to check whether a given value is infinite or not?
a)
Infinite()
b)
isInfinite()
c)
checkInfinite()
d)
None of the mentioned
55.
Which of these exceptions is thrown by compareTo() method defined in a double wrapper?
a)
IOException
b)
SystemException
c)
CastException
d)
ClassCastException
56.

What will be the output of the following Java code?

https://gyazo.com/82c48cf6c8a5a6767f452ab4b133d134

a)

True

b)

false

c)

1

d)

0

57.

What will be the output of the following Java code?

https://gyazo.com/08d9e0ee5f3bcc95df0687cd8f9598f4

a)

0

b)

1

c)

256

d)

257

58.

What will be the output of the following Java code?

https://gyazo.com/a75a7dda0066b47dd80970cb6ec45cd0

a)

0

b)

257

c)

257.57812

d)

257.578123456789

59.

What will be the output of the following Java code?

https://gyazo.com/34ee48c245b011dd3fa4255cdea94d81

a)

0

b)

1

c)

Exception

d)

None of the mentioned

60.
Which of these packages contain classes and interfaces used for input & output operations of a program?
a)
java.util
b)
java.lang
c)
java.io
d)
all of the mentioned
61.
Which of these class is not a member class of java.io package?
a)
String
b)
StringReader
c)
Writer
d)
File
62.
Which of these interface is not a member of java.io package?
a)
DataInput
b)
ObjectInput
c)
ObjectFilter
d)
FileFilter
63.
Which of these class is not related to input and output stream in terms of functioning?
a)
File
b)
Writer
c)
InputStream
d)
Reader
64.
Which of these is specified by a File object?
a)
a file in disk
b)
directory path
c)
directory in disk
d)
none of the mentioned
65.
Which of these is method for testing whether the specified element is a file or a directory?
a)
IsFile()
b)
isFile()
c)
Isfile()
d)
isfile()
66.

What will be the output of the following Java code?

https://gyazo.com/9a2ba7a6168f1eb1e72f63b37aeef1a1

a)

java

b)

system

c)

java/system

d)

/java/system

67.

What will be the output of the following Java program? https://gyazo.com/e35295583fda3bf6996cd14384109fe4

a)

java

b)

system

c)

java/system

d)

/java/system

68.

What will be the output of the following Java program?

https://gyazo.com/bd5205cda722a122c40a5a56a6f2fd6b

a)

true false

b)

false true

c)

true true

d)

false false

69.

What will be the output of the following Java program?

https://gyazo.com/28faa836c68d1bdf44880e8eb3a6d42a

a)

java true

b)

java false

c)

\java false

d)

\java true

70.
Which of these classes is used for input and output operation when working with bytes?
a)
InputStream
b)
Reader
c)
Writer
d)
All of the mentioned
71.
Which of these class is used to read and write bytes in a file?
a)
FileReader
b)
FileWriter
c)
FileInputStream
d)
InputStreamReader
72.
Which of these method of InputStream is used to read integer representation of next available byte input?
a)
read()
b)
scanf()
c)
get()
d)
getInteger()
73.
Which of these data type is returned by every method of OutputStream?
a)
int
b)
float
c)
byte
d)
none of the mentioned
74.
Which of these is a method to clear all the data present in output buffers?
a)
clear()
b)
flush()
c)
fflush()
d)
close()
75.
Which of these method(s) is/are used for writing bytes to an outputstream?
a)
put()
b)
print() and write()
c)
printf()
d)
write() and read()
76.

What will be the output of the following Java program?

https://gyazo.com/d8381d0d09f65eeb30de0e9016fe92c1

a)

True

b)

False

c)

prints number of bytes in file

d)

prints number of characters in the file

77.

What will be the output of the following Java program?

https://gyazo.com/726a066cea244295f3e6ca80ef6f1080

a)

abc

b)

ABC

c)

ab

d)

AB

78.

What will be the output of the following Java program?

https://gyazo.com/bb2eb65905ac5c5d199f83918bb4ee11

a)

abc

b)

ABC

c)

ab

d)

AB

79.

What will be the output of the following Java program?https://gyazo.com/f903e364362af652ffe1cefd31e9bfbb

a)

AaBaCa

b)

ABCaaa

c)

AaaBaaCaa

d)

) AaBaaCaaa

80.
Which of these stream contains the classes which can work on character stream?
a)
InputStream
b)
OutputStream
c)
Character Stream
d)
All of the mentioned
81.
Which of these class is used to read characters in a file?
a)
FileReader
b)
FileWriter
c)
FileInputStream
d)
InputStreamReader
82.
Which of these method of FileReader class is used to read characters from a file?
a)
read()
b)
scanf()
c)
get()
d)
getInteger()
83.
Which of these class can be used to implement the input stream that uses a character array as the source?
a)
BufferedReader
b)
FileReader
c)
CharArrayReader
d)
FileArrayReader
84.
Which of these classes can return more than one character to be returned to input stream?
a)
BufferedReader
b)
Bufferedwriter
c)
PushbachReader
d)
CharArrayReader
85.

What will be the output of the following Java program?https://gyazo.com/c9a811f9d4a37805cbd7e91253fc5744

a)

abc

b)

abcd

c)

abcde

d)

abcdef

86.

What will be the output of the following Java program?https://gyazo.com/db8bcd4da712ec961f2eb008beafadb7

a)

abc

b)

abcd

c)

abcde

d)

abcdef

87.

What will be the output of the following Java program?https://gyazo.com/2dd376d924b90c01a1ec7653bb047f07

a)

abc

b)

abcd

c)

abcde

d)

none of the mentioned

88.
Which of the following is not a segment of memory in java?
a)
Stack Segment
b)
Heap Segment
c)
Code Segment
d)
Register Segment
89.
Does code Segment loads the java code?
a)
True
b)
False
90.
What is JVM?
a)
Bootstrap
b)
Interpreter
c)
Extension
d)
Compiler
91.
Which one of the following is a class loader?
a)
Bootstrap
b)
Compiler
c)
Heap
d)
Interpreter
92.
Which class loader loads jar files from JDK directory?
a)
Bootstrap
b)
Extension
c)
System
d)
Heap
93.
Which of the following is not a memory classification in java?
a)
Young
b)
Old
c)
Permanent
d)
Temporary
94.
What is the Java 8 update of PermGen?
a)
Code Cache
b)
Tenured Space
c)
Metaspace
d)
Eden space
95.
Classes and Methods are stored in which space?
a)
Eden space
b)
Survivor space
c)
Tenured space
d)
Permanent space
96.
Where is String Pool stored?
a)
Java Stack
b)
Java Heap
c)
Permanent Generation
d)
Metaspace
97.
The same import package/class be called twice in java?
a)
True
b)
False
98.
Which of these exceptions handles the situations when an illegal argument is used to invoke a method?
a)
IllegalException
b)
Argument Exception
c)
IllegalArgumentException
d)
IllegalMethodArgumentExcepetion
99.
Which of these exceptions will be thrown if we declare an array with negative size?
a)
IllegalArrayException
b)
IllegalArraySizeExeption
c)
NegativeArrayException
d)
NegativeArraySizeExeption
100.
Which of these packages contain all the Java’s built in exceptions?
a)
java.io
b)
java.util
c)
java.lang
d)
java.net
101.
Which of these exceptions will be thrown if we use null reference for an arithmetic operation?
a)
ArithmeticException
b)
NullPointerException
c)
IllegalAccessException
d)
IllegalOperationException
102.
Which of these class is used to create user defined exception?
a)
java.lang
b)
Exception
c)
RunTime
d)
System
103.

What will be the output of the following Java program?https://gyazo.com/c8922de79a7e6b94a16ca8c9836f6214

a)

12345

b)

123450

c)

1234500

d)

Compilation Error

104.

What will be the output of the following Java program?https://gyazo.com/94914c8122922b3116ddccac396e3c60

a)

12345

b)

12345A

c)

12345B

d)

Compilation Error

105.

What will be the output of the following Java program?https://gyazo.com/ec2bc07dde1343bbf9016d34cca6a0b4

a)

A

b)

0

c)

0A

d)

Exception

106.

What will be the output of the following Java program?https://gyazo.com/c37bd0cdbc8253eec3d5f776d16b622a

a)

A

b)

B

c)

AB

d)

BA

107.

What will be the output of the following Java program? https://gyazo.com/eb688dab8e9542dc2ae57806c4ee67a9

a)

TypeA

b)

TypeB

c)

0TypeA

d)

0TypeB

108.
Which of these class provides various types of rounding functions?
a)
Math
b)
Process
c)
System
d)
Object
109.
Which of these methods return a smallest whole number greater than or equal to variable X?
a)
double ceil(double X)
b)
double floor(double X)
c)
double max(double X)
d)
double min(double X)
110.
Which of these method returns a largest whole number less than or equal to variable X?
a)
double ceil(double X)
b)
double floor(double X)
c)
double max(double X)
d)
double min(double X)
111.
Which of function return absolute value of a variable?
a)
abs()
b)
absolute()
c)
absolutevariable()
d)
none of the mentioned
112.

What will be the output of the following Java code?https://gyazo.com/1d8ca4cbbba5e3d7f93711e463c51a84

a)

1 2 0 0

b)

1 2 1 2

c)

0 0 0 0

d)

System Dependent

113.

What will be the output of the following Java code? https://gyazo.com/94a1764582a2be26c585b77860486aa5

a)

0

b)

3

c)

3

d)

3.1

114.

What will be the output of the following Java code?https://gyazo.com/fe135a025c50a2896899adf9f268d31c

a)

0

b)

3

c)

3

d)

4

115.

What will be the output of the following Java code?https://gyazo.com/ff1e5167c03bebab2e92acc90a453e03

a)

0

b)

3

c)

3

d)

4

116.
Which of these methods of Byte wrapper can be used to obtain Byte object from a string?
a)
toString()
b)
getString()
c)
decode()
d)
encode()
117.
Which of the following methods Byte wrapper return the value as a double?
a)
doubleValue()
b)
converDouble()
c)
getDouble()
d)
getDoubleValue()
118.
Which of these is a super class of wrappers Byte and short wrappers?
a)
Long
b)
Digits
c)
Float
d)
Number
119.
Which of these methods is not defined in both Byte and Short wrappers?
a)
intValue()
b)
isInfinite()
c)
toString()
d)
hashCode()
120.

What will be the output of the following Java code?https://gyazo.com/d92c429a31a3e8ab0c725fa2997a1ccc

a)

0

b)

1.7976931348623157E308

c)

1.79769313486231e+30

d)

None of the mentioned

121.

What will be the output of the following Java program?https://gyazo.com/836951562de3433ae316384f1e1fd62d

a)

0

b)

4.9E-324

c)

1.7976931348623157E308

d)

None of the mentioned

122.

What will be the output of the following Java program?https://gyazo.com/94c3a90876a8dfeb17a51bf50f7ee6e7

a)

0

b)

257

c)

257.57812

d)

257.578123456789

123.
Which of these methods of Character wrapper can be used to obtain the char value contained in Character object.
a)
get()
b)
getVhar()
c)
charValue()
d)
getCharacter()
124.
Which of the following constant are defined in Character wrapper?
a)
MAX_RADIX
b)
MAX_VALUE
c)
TYPE
d)
All of the mentioned
125.
Which of these is a super class of Character wrapper?
a)
Long
b)
Digits
c)
Float
d)
Number
126.
Which of these methods is used to know whether a given Character object is part of Java’s Identifiers?
a)
isIdentifier()
b)
isJavaIdentifier()
c)
isJavaIdentifierPart()
d)
none of the mentioned
127.
Which of these coding techniques is used by method isDefined()?
a)
Latin
b)
ASCII
c)
ANSI
d)
UNICODE
128.

What will be the output of the following Java program?https://gyazo.com/657bad99d6815dfff8bc9313e7eea86e

a)

<

b)

>

c)

?

d)

$

129.

What will be the output of the following Java program?https://gyazo.com/82704bac564956db7bd2d8918a698fbd

a)

<

b)

!

c)

@

d)

space

130.

What will be the output of the following Java program?https://gyazo.com/96cadda2ba9440117c1c8d0673e3cd67

a)

true false true

b)

false true true

c)

true true false

d)

false false false

131.

What will be the output of the following Java program?https://gyazo.com/48664df7a3714f79e7a1f9aac2fa9ed3

a)

b

b)

c

c)

B

d)

C

132.

What will be the output of the following Java program?https://gyazo.com/5b85d96596050eacc4d715526b78e516

a)

True

b)

False

c)

@

d)

B

133.
Which of these methods of Boolean wrapper returns boolean equivalent of an object.
a)
getBool()
b)
booleanValue()
c)
getbooleanValue()
d)
getboolValue()
134.
Which of the following constant are defined in Boolean wrapper?
a)
True
b)
False
c)
TYPE
d)
All of the mentioned
135.
Which of these methods return string equivalent of Boolean object?
a)
getString()
b)
toString()
c)
converString()
d)
getStringObject()
136.
Which of these methods is used to know whether a string contains “true”?
a)
valueOf()
b)
valueOfString()
c)
getString()
d)
none of the mentioned
137.
Which of these class have only one field?
a)
Character
b)
Boolean
c)
Byte
d)
void
138.

What will be the output of the following Java program?https://gyazo.com/02adf15bc80c375211398dbe27e6a1de

a)

True

b)

False

c)

Compilation Error

d)

Runtime Error

139.

What will be the output of the following Java program?https://gyazo.com/105c0f762fd1990d7f83c40d70ca5db1

a)

True

b)

False

c)

Compilation Error

d)

Runtime Error

140.

What will be the output of the following Java program?https://gyazo.com/79dc4de571bfc95e1147d8b3123b6032

a)

True

b)

False

c)

Compilation Error

d)

Runtime Error

141.

What will be the output of the following Java program?https://gyazo.com/4125d44335503592cd0c865964a84336

a)

True

b)

False

c)

System Dependent

d)

Compilation Error

142.
Which of these class contains all the methods present in Math class?
a)
SystemMath
b)
StrictMath
c)
Compiler
d)
ClassLoader
143.
Which of these method return a pseudorandom number?
a)
rand()
b)
random()
c)
randomNumber()
d)
randGenerator()
144.
Which of these method returns the remainder of dividend / divisor?
a)
remainder()
b)
getRemainder()
c)
CSIremainder()
d)
CSIremainder()
145.
Which of these method converts radians to degrees?
a)
toRadian()
b)
toDegree()
c)
convertRadian()
d)
converDegree()
146.
toRadian() and toDegree() methods were added by which version of Java?
a)
Java 1.0
b)
Java 1.5
c)
Java 2.0
d)
Java 3.0
147.
Which of these method returns a smallest whole number greater than or equal to variable X?
a)
double ciel(double X)
b)
double floor(double X)
c)
double max(double X)
d)
double min(double X)
148.

What will be the output of the following Java program?https://gyazo.com/1123973ceacd58429f93a397fabd833e

a)

0

b)

179

c)

180

d)

360

149.

What will be the output of the following Java program?https://gyazo.com/73778bb805cf60b15c4194b1d1169a2a

a)

0

b)

3

c)

3

d)

3.1

150.

What will be the output of the following Java program?https://gyazo.com/a3ab85000ca764edc33b69a6be480b9f

a)

0

b)

1

c)

2

d)

3

151.

Will this Java program generate same output is executed again?https://gyazo.com/696372ee04bbc8959eb2b6f94cf47b53

a)

Yes

b)

No

c)

Compiler Dependent

d)

Operating System Dependent

152.
Which of these classes encapsulate runtime environment?
a)
Class
b)
System
c)
Runtime
d)
ClassLoader
153.
Which of the following exceptions is thrown by every method of Runtime class?
a)
IOException
b)
SystemException
c)
SecurityException
d)
RuntimeException
154.
Which of these methods returns the total number of bytes of memory available to the program?
a)
getMemory()
b)
TotalMemory()
c)
SystemMemory()
d)
getProcessMemory()
155.
Which of these Exceptions is thrown by loadClass() method of ClassLoader class?
a)
IOException
b)
SystemException
c)
ClassFormatError
d)
ClassNotFoundException
156.

What will be the output of the following Java program?https://gyazo.com/5274e217b8f752ca1b97eba2d71588c2

a)

X

b)

Y

c)

class X

d)

class Y

157.

What will be the output of the following Java program?https://gyazo.com/3a1eddd4e03a4ce7dc07956a0aeaaade

a)

0

b)

1

c)

True

d)

false

158.
Which of these classes encapsulate runtime state of an object?
a)
Class
b)
System
c)
Runtime
d)
Cache
159.
Which of these methods returns the class of an object?
a)
getClass()
b)
Class()
c)
WhoseClass()
d)
WhoseObject()
160.
Which of these methods return a class object given its name?
a)
getClass()
b)
findClass()
c)
getSystemClass()
d)
findSystemClass()
161.
Which of these class defines how the classes are loaded?
a)
Class
b)
System
c)
Runtime
d)
ClassLoader
162.

What will be the output of the following Java program?https://gyazo.com/3d070cfa79f41e51d3d70a0b7fba3279

a)

X

b)

Y

c)

a

d)

b

163.

What will be the output of the following Java program?https://gyazo.com/f2bde67e97f1da164763e94b19001a34

a)

X

b)

Y

c)

class X

d)

class Y

164.

What will be the output of the following Java program?https://gyazo.com/47276d2e1182d8a3cf7c941c1daed941

a)

0

b)

1

c)

True

d)

False

165.
Which of the interface contains all the methods used for handling thread related operations in Java?
a)
Runnable interface
b)
Math interface
c)
System interface
d)
ThreadHandling interface
166.
Which of these class is used to make a thread?
a)
String
b)
System
c)
Thread
d)
Runnable
167.
Which of this interface is implemented by Thread class?
a)
Runnable
b)
Connections
c)
Set
d)
MapConnections
168.
Which of these methods of a Thread class is used to suspend a thread for a period of time?
a)
sleep()
b)
terminate()
c)
suspend()
d)
stop()
169.

What will be the output of the following Java program?https://gyazo.com/f40aba6e9aa0a97f3f4164093f188e7e

a)

True

b)

False

c)

truetrue

d)

falsefalse

170.

What will be the output of the following Java program?https://gyazo.com/6a4488a2aea7c2f4828fdc4c31dd13d9

a)

Thread[New Thread,0,main]

b)

Thread[New Thread,1,main]

c)

Thread[New Thread,5,main]

d)

Thread[New Thread,10,main]

171.

What will be the output of the following Java program?https://gyazo.com/7327a768259f066174abac0674607e84

a)

My Thread

b)

Thread[My Thread,5,main]

c)

Compilation Error

d)

Runtime Error

172.

What will be the output of the following Java program?https://gyazo.com/26e6b9593ce654563d7eb6770936469e

a)

My Thread

b)

Thread[My Thread,5,main]

c)

Compilation Error

d)

Runtime Error

173.

What will be the output of the following Java program?https://gyazo.com/0df8a13e5ced262d28cd33e2bf20a28a

a)

My Thread

b)

Thread[My Thread,5,main]

c)

Compilation Error

d)

Runtime Error

174.
Which object Java application uses to create a new process?
a)
Process
b)
Builder
c)
ProcessBuilder
d)
CreateBuilder
175.
Which of the following is true about Java system properties?
a)
Java system properties are accessible by any process
b)
Java system properties are accessible by processes they are added to
c)
Java system properties are retrieved by System.getenv()
d)
Java system properties are set by System.setenv()
176.
Java system properties can be set at runtime.
a)
True
b)
False
177.
Which system property stores installation directory of JRE?
a)
user.home
b)
java.class.path
c)
java.home
d)
user.dir
178.
What does System.getProperty(“variable”) return?
a)
compilation error
b)
value stored in variable
c)
runtime error
d)
null
179.
What is true about the setProperties method?
a)
setProperties method changes the set of Java Properties which are persistent
b)
Changing the system properties within an application will affect future invocations
c)
setProperties method changes the set of Java Properties which are not persistent
d)
setProperties writes the values directly into the file which stores all the properties
180.
How to use environment properties in the class?
a)
@Environment
b)
@Variable
c)
@Property
d)
@Autowired
181.
How to assign values to variable using property?
a)
Value("${my.property}") private String prop;
b)
Property("${my.property}")
c)
Environment("${my.property}")
d)
Env("${my.property}")
182.
Which environment variable is used to set java path?
a)
JAVA
b)
JAVA_HOME
c)
CLASSPATH
d)
MAVEN_HOME
183.
How to read a classpath file?
a)
InputStream in = this.getClass().getResource(“SomeTextFile.txt”);
b)
InputStream in = this.getClass().getResourceClasspath(“SomeTextFile.txt”);
c)
InputStream in = this.getClass().getResourceAsStream(“SomeTextFile.txt”);
d)
InputStream in = this.getClass().getResource(“classpath:/SomeTextFile.txt”);
184.

What will be the output of the following Java code?

Online Java Compiler - Google Chrome (gyazo.com)

a)

0

b)

1

c)

True

d)

False