0% found this document useful (0 votes)
223 views6 pages

Unit-4 MCQ

1. The document contains questions about Java threads and related concepts like synchronization, wait/notify methods, thread states etc. 2. It provides multiple choice questions with one right answer for each. 3. The questions cover core thread concepts like thread priorities, thread states, synchronization, wait/notify methods and exceptions related to threading.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
223 views6 pages

Unit-4 MCQ

1. The document contains questions about Java threads and related concepts like synchronization, wait/notify methods, thread states etc. 2. It provides multiple choice questions with one right answer for each. 3. The questions cover core thread concepts like thread priorities, thread states, synchronization, wait/notify methods and exceptions related to threading.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Sl.

Bloom E
No levels Question A B C D Ans
.
REMEMB Thread is a Heavy weight Light weight Medium None B
1 ERING process process weight
process
REMEMB Thread Runnable() Running() Waiting() Stop() D
ERING termination
2
can be done
by
REMEMB If the Start Runnable Running Waiting C
ERING processor is
3 available then
thread enters
into
REMEMB If the thread Start Runnable Running Waiting B
ERING is ready for
4 execution
then it enters
into
REMEMB Sleep() seconds milliseconds microseconds nanoseconds B
5 ERING method takes
time in
REMEMB What state New Runnable Running Waiting A
ERING does Thread
enter in when
6 it has been
created and
started?
REMEMB Which of run() Alive() isAlive() join() C
ERING these method
is used to
7 find out that a
thread is still
running or
not?
REMEMB Which of sleep() stop() isAlive() join() D
ERING these method
8 waits for the
thread to
terminate?
REMEMB Which of Thread execution of Same All D
ERING these is valid behaviour is Threads threading
about threads unpredictable depends on program may
in java Thread produce
scheduler different
9
output in
subsequent
executions
even on same
platform
10 REMEMB Which of set() make() setPriority() makePriority() C
ERING these method
is used to
explicitly set
the priority of
a thread?
REMEMB Which of stop() stopThread() runThread() run()
ERING these method
is used to
11 D
implement
Runnable
interface?
REMEMB Which of Runnable Set Connections MapConnectio
ERING these ns
interface is
12 A
implemented
by Thread
class?
REMEMB Which of get() Priority() ThreadPriorit getPriority() D
ERING these method y()
of Thread
class is used
13 to find out
the priority
given to a
thread?

REMEMB Which of sleep() Suspend() terminate() Stop() A


ERING these method
of Thread
class is used
14
to Suspend a
thread for a
period of
time?
REMEMB Which of Process based Thread based Both None C
ERING these are
15
types of
multitasking?
REMEMB Which of java.io java.util java.lang java.net C
ERING these
packages
16 contain all
the Java’s
built in
exceptions?
REMEMB Thread int Float double Long A
17 ERING priority in
Java is?
REMEMB What is the 0 1 5 10 C
ERING default value
18
of priority of
a thread?
19
REMEMB What is the 0 1 5 10 B
ERING
minimum
value of
priority of a
thread?
REMEMB What will Any one will Both will be It is None C
ERING happen if two be executed executed dependent on
thread of first lexo - simultaneousl the OS
same priority graphically y
20
are called to
be processed
simultaneousl
y?
REMEMB Which Volatile Synchronized Native static B
ERING keyword
applied on a
method that
21 only one
Thread
execute
method at a
time
REMEMB What is the 0 1 5 10 D
ERING maximum
22 value of
priority of a
thread?
REMEMB Which of FileStream FileInputStrea FileOutputStr FileBufferStrea C
ERING these class m eam m
contains the
23
methods used
to write in a
file?
REMEMB Which of FileStream FileInputStrea FileOutputStr FileBufferStrea B
ERING these class m eam m
contains the
24
methods used
to read from
a file?
REMEMB Which of 0 1 -1 Null C
ERING these
values is
returned
by read ()
25
method is
end of file
(EOF) is
encountere
d?
26 REMEMB Which of IOException FileException FileNotFound FileIOExceptio A
ERING these Exception n
exception
is thrown
by close ()
and read()
methods?
REMEMB Which of write Skip Flush close B
ERING the
following
method(s)
27
not
included in
InputStrea
m class
REMEMB Which of Java.util Java.io Java.lang Java.pack B
ERING these
packages
contain
classes and
28
interfaces
used for input
& output
operations of
a program?
REMEMB setName() Int Char String chars C
29 ERING takes as
argument of
REMEMB getName() Thread-0 Thread-1 Thread-First Thread-None A
ERING will return
30
for first
thread is
REMEMB Run() run() runnable() start() running() C
ERING method
31
implicitly
called by
REMEMB If thread is locked state unlocked state Any None A
ERING executed
under the
32
synchronizati
on then it is
in
REMEMB Synchroniz block method Program None B
ERING ed
33
keyword is
applied for
REMEMB Synchroniz block method Program None A
ERING ed block
34
is applied
for
REMEMB Synchroniz block method Program None B
ERING ed static
35
block is
applied for
36 REMEMB public wait forever wait wait exact for All A
ERING final void until get sometime for get
wait() notification get notification
Throws notification
Interrupted
Exception
REMEMB public wait forever wait wait exact for All B
ERING final native until get sometime for get
void notification get notification
wait(long notification
37
ms)
Throws
Interrupted
Exception
REMEMB public wait forever wait wait exact for All C
ERING final void until get sometime for get
wait(long notification get notification
38 ms, int ns) notification
Throws
Interrupted
Exception
REMEMB Producer full empty Half None A
ERING can’t add
items into
39
buffer if
the buffer
is
REMEMB Consumer full empty Half None B
ERING won’t take
items from
40
buffer if
the buffer
is
REMEMB Byte 8-bit unicode 16-bit unicode 32-bit unicode 64-bit unicode A
ERING streams
41 can be
performed
on
REMEMB Character 8-bit unicode 16-bit unicode 32-bit unicode 64-bit unicode B
ERING streams
42 can be
performed
on
REMEMB skip() FileInputStrea FileoutputStre FileReader FileWriter A
43 ERING method is m am
used in
REMEMB close() FileInputStrea FileoutputStre Both None B
44 ERING method is m am
used in
REMEMB When a beginning of ending of Depends on None A
ERING file is the file the file mode
opened,
45
the file
pointer
sets at the
REMEMB Wait(), Java.lang Java.io Java.util None A
46 ERING notify(),
notifyAll()
available in
---------packa
ge
REMEMB While 1 2 4 8 C
ERING reading an
int value,
the JVM
47
reads ---
no of bytes
from the
file pointer
REMEMB RandomAc reading writing Append Both A
ERING cessFile
raf = new
RandomAc
48
cessFile(“t
est.dat”,”r”
); is used
for
REMEMB RandomAcce reading writing Append Both D
ERING ssFile raf =
new
49 RandomAcce
ssFile(“test.d
at”,”rw”); is
used for
REMEMB Synchroniz block method Program None A
ERING ed block
50
is applied
for

You might also like