☑ MCQ PRACTICE

Object Oriented Programming through Java Unit 3

Practice objective questions for quick revision and examination preparation. Try answering each question before revealing the answer.

📚 Object Oriented Programming through Java
📖 Unit 3
🎯 MCQs

Object Oriented Programming through Java - Unit-3

1
When does Exceptions in Java arises in code sequence?
ARun Time
BCompilation Time
CCan Occur Any Time
DNone of the mentioned
Correct Answer Run Time
2
Which of these keywords is not a part of exception handling?
Atry
Bfinally
Cthrown
Dcatch
Correct Answer thrown
3
Which of these keywords must be used to monitor for exceptions?
Atry
Bfinally
Cthrow
Dcatch
Correct Answer try
4
Which of these keywords must be used to handle the exception thrown by try block in some rational manner?
Atry
Bfinally
Cthrow
Dcatch
Correct Answer catch
5
Which of these keywords is used to manually throw an exception?
Atry
Bfinally
Cthrow
Dcatch
Correct Answer throw
6
When does Exceptions in Java arises in code sequence?
ARun Time
BCompilation Time
CCan Occur Any Time
DNone of the mentioned
Correct Answer Run Time
7
Which of these keywords is not a part of exception handling?
Atry
Bfinally
Cthrown
Dcatch
Correct Answer thrown
8
Which of these keywords must be used to monitor for exceptions?
Atry
Bfinally
Cthrow
Dcatch
Correct Answer try
9
Which of these keywords must be used to handle the exception thrown by try block in some rational manner?
Atry
Bfinally
Cthrow
Dcatch
Correct Answer catch
10
Which of these is a super class of all errors and exceptions in the Java language?
ACatchable
BThrowable
CRunTimeExceptions
DNone of the above
Correct Answer Throwable
11
In which of the following package Exception class exist?
Ajava.file
Bjava.lang
Cjava.io
Djava.util
Correct Answer java.lang
12
Which exception is thrown when divide by zero statement executes?
ANumberFormatException
BNullPointerException
CArithmeticException
DNone of these
Correct Answer ArithmeticException
13
What is multithreaded programming?
AIt's a process in which two different processes run simultaneously
BIt's a process in which two or more parts of same process run simultaneously
CIt's a process in which many different process are able to access same information
DIt's a process in which a single process can access information from many sources
Correct Answer It's a process in which two or more parts of same process run simultaneously
14
Which of these are types of multitasking?
AProcess based
BThread based
CProcess and Thread based
DNone of the mentioned
Correct Answer Process and Thread based
15
Thread priority in Java is?
AInteger
BFloat
Cdouble
Dlong
Correct Answer Integer
16
What will happen if two thread of the same priority are called to be processed simultaneously?
AAnyone will be executed first lexographically
BBoth of them will be executed simultaneously
CNone of them will be executed
DIt is dependent on the operating system
Correct Answer It is dependent on the operating system
17
Which of these statements is incorrect?
ABy multithreading CPU idle time is minimized, and we can take maximum use of it
BBy multitasking CPU idle time is minimized, and we can take maximum use of it
CTwo thread in Java can have the same priority
DA thread can exist only in two states, running and blocked
Correct Answer A thread can exist only in two states, running and blocked
18
Which of these keywords are used to implement synchronization?
Asynchronize
Bsyn
Csynch
Dsynchronized
Correct Answer synchronized
19
Which of this method is used to avoid polling in Java?
Await()
Bnotify()
CnotifyAll()
Dall of the mentioned
Correct Answer all of the mentioned
20
Which of these method is used to tell the calling thread to give up a monitor and go to sleep until some other thread enters the same monitor?
Await()
Bnotify()
CnotifyAll()
Dsleep()
Correct Answer wait()
21
Which of these method wakes up the first thread that called wait()?
Awake()
Bnotify()
Cstart()
DnotifyAll()
Correct Answer notify()
22
Which of these method wakes up all the threads?
AwakeAll()
Bnotify()
Cstart()
DnotifyAll()
Correct Answer notifyAll()
23
What is synchronization in reference to a thread?
AIt's a process of handling situations when two or more threads need access to a shared resource
BIt's a process by which many thread are able to access same shared resource simultaneously
CIt's a process by which a method is able to access many different threads simultaneously
DIt's a method that allow too many threads to access any information the require
Correct Answer It's a process of handling situations when two or more threads need access to a shared resource
24
Which of these keywords are used to implement synchronization?
Asynchronize
Bsyn
Csynch
Dsynchronized
Correct Answer synchronized
25
Which of these method is used to tell the calling thread to give up a monitor and go to sleep until some other thread enters the same monitor?
Await()
Bnotify()
CnotifyAll()
Dsleep()
Correct Answer wait()
26
How can synchronization be achieved in Java threads?
AUsing the synchronized keyword.
BUsing the volatile keyword.
CUsing the final keyword.
DUsing the static keyword.
Correct Answer Using the synchronized keyword.
27
What is a thread in Java?
AA lightweight process that executes a sequence of instructions.
BA memory allocation unit in Java.
CA Java keyword to define a loop construct.
DA data structure to store multiple values.
Correct Answer A lightweight process that executes a sequence of instructions.
28
Which class is used to create a thread in Java?
AThread
BRunnable
CProcess
DExecutor
Correct Answer Thread
29
What is the purpose of the wait() method in Java threads?
ATo pause the execution of a thread.
BTo terminate a thread.
CTo notify other threads to resume execution.
DTo release the lock held by the thread.
Correct Answer To pause the execution of a thread.
30
Which method is used to start the execution of a thread?
Aexecute()
Brun()
Cstart()
Dbegin()
Correct Answer start()
← Back to All MCQs