Deck 9: Java Multithreading and Exception Handling
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/25
Play
Full screen (f)
Deck 9: Java Multithreading and Exception Handling
1
What is multithreaded programming?
A)It's a process in which two different processes run simultaneously.
B)Its a process in which two or more parts of same process run simultaneously.
C)Its a process in which many different process are able to access same information.
D)Its a process in which a single process can access information from many sources.
A)It's a process in which two different processes run simultaneously.
B)Its a process in which two or more parts of same process run simultaneously.
C)Its a process in which many different process are able to access same information.
D)Its a process in which a single process can access information from many sources.
Its a process in which two or more parts of same process run simultaneously.
2
Which of these are types of multitasking?
A)Process based multitasking
B)Thread based multitasking
C)Both a & b
D)None of the mentioned
A)Process based multitasking
B)Thread based multitasking
C)Both a & b
D)None of the mentioned
None of the mentioned
3
Which of these packages contain all the Java's built in exceptions?
A)java.io
B)java.util
C)java.lang
D)java.net
A)java.io
B)java.util
C)java.lang
D)java.net
java.lang
4
Thread priority in Java is?
A)Integer
B)Float
C)Double
D)Long
A)Integer
B)Float
C)Double
D)Long
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
5
What will happen if two thread of same priority are called to be processed simultaneously?
A)Any one will be executed first lexographically
B)Both of them will be executed simultaneously
C)None of them will be executed
D)It is dependent on the operating system.
A)Any one will be executed first lexographically
B)Both of them will be executed simultaneously
C)None of them will be executed
D)It is dependent on the operating system.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
6
Which of these statements is incorrect?
A)By multithreading CPU's idle time is minimized, and we can take maximum use of it.
B)By multitasking CPU's idle time is minimized, and we can take maximum use of it.
C)Two thread in Java can have same priority
D)A thread can exist only in two states, running and blocked.
A)By multithreading CPU's idle time is minimized, and we can take maximum use of it.
B)By multitasking CPU's idle time is minimized, and we can take maximum use of it.
C)Two thread in Java can have same priority
D)A thread can exist only in two states, running and blocked.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
7
Which method executes only once
A)start() method
B)init() method
C)stop() method
D)destroy() method
A)start() method
B)init() method
C)stop() method
D)destroy() method
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
8
Thread class is available in
A)java.io package
B)java.lang package
C)java.awt package
D)java.util package
A)java.io package
B)java.lang package
C)java.awt package
D)java.util package
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
9
Minimum threads in a program are
A)1
B)2
C)5
D)Many
A)1
B)2
C)5
D)Many
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
10
Interfaces helps in which type of inheritance
A)Multiple inheritance
B)Multilevel inheritance
C)Hierarchical inheritance
D)None of above
A)Multiple inheritance
B)Multilevel inheritance
C)Hierarchical inheritance
D)None of above
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
11
Which of these values is returned by read () method is end of file (EOF) is encountered?
A)0
B)1
C)-1
D)Null
A)0
B)1
C)-1
D)Null
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
12
Which of these exception is thrown by close () and read () methods?
A)IOException
B)FileException
C)FileNotFoundException
D)FileInputOutputException
A)IOException
B)FileException
C)FileNotFoundException
D)FileInputOutputException
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
13
Which exception is thrown by the read ( ) method of input stream class?
A)Exception
B)ClassNotFoundException
C)read Exception
D)IOException
A)Exception
B)ClassNotFoundException
C)read Exception
D)IOException
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
14
What garbage collection in the context of java?
A)The operating system periodically deletes all of the java files available on the system.
B)Any package imported in a program and not used in automatically deleted.
C)When all references to an object are gone, the memory used by the object is automatically reclaim
A)The operating system periodically deletes all of the java files available on the system.
B)Any package imported in a program and not used in automatically deleted.
C)When all references to an object are gone, the memory used by the object is automatically reclaim
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
15
In order for a source code file, containing the public class test, to successfully compile, which of the following must be true?
A)It must have a package statement
B)It must be named test.java
C)It must import java.lang
D)It must declare a public class named test.
A)It must have a package statement
B)It must be named test.java
C)It must import java.lang
D)It must declare a public class named test.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
16
Which of the following are true about the Error and Exception classes?
A)Both classes extend throwable
B)The error class is final and exception class is not.
C)The Exception class is final and the Error is not.
D)Both classes implement Throwable
A)Both classes extend throwable
B)The error class is final and exception class is not.
C)The Exception class is final and the Error is not.
D)Both classes implement Throwable
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
17
Which of the following are true?
A)The void class extends the class class
B)The float class extends double class
C)The system class extends the runtime class
D)The integer class extends the number class
A)The void class extends the class class
B)The float class extends double class
C)The system class extends the runtime class
D)The integer class extends the number class
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
18
How do you create a Reader object from an InputStream object?
A)Use the static createReader() method of InputStream class
B)Use the static createReader() method of Reader class
C)Create an InputStreamReader object passing the InputStream object and an argument to the InputStreamReader constructor.
D)Create an OutputStreamReader object, passing the InputStream object as an argument to the OutputStreamReader constructor.
A)Use the static createReader() method of InputStream class
B)Use the static createReader() method of Reader class
C)Create an InputStreamReader object passing the InputStream object and an argument to the InputStreamReader constructor.
D)Create an OutputStreamReader object, passing the InputStream object as an argument to the OutputStreamReader constructor.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
19
Which of the following is true?
A)The event inheritance model has replaced the event delegation model
B)The event inheritance model is more efficient than event delegation model
C)The event delegation model uses event listeners to define the methods of event handling classes.
D)The event delegation model uses the handleEvent() method to support event handling.
A)The event inheritance model has replaced the event delegation model
B)The event inheritance model is more efficient than event delegation model
C)The event delegation model uses event listeners to define the methods of event handling classes.
D)The event delegation model uses the handleEvent() method to support event handling.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
20
Which of the following is the highest class in the event delegation model?
A)java.util.EventListner
B)java.util.EventObject
C)java.util.AWTEvent
D)java.util.event.AWTEvent
A)java.util.EventListner
B)java.util.EventObject
C)java.util.AWTEvent
D)java.util.event.AWTEvent
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
21
When two or more objects are added as listeners for the same event, which listener is first invoked to handle the event?
A)The first object that was added as listner.
B)The last object that was added as listner
C)There is no way to determine which listener will be invoked first.
D)It is impossible to have more than one listener for a given event.
A)The first object that was added as listner.
B)The last object that was added as listner
C)There is no way to determine which listener will be invoked first.
D)It is impossible to have more than one listener for a given event.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
22
Suppose that you want to have an object eh handle the TextEvent of TextArea object t. How should you add eh as the event handler for?
A)t.addTextListener(eh);
B)eh.addTextListner(t);
C)addTextListner(eh.t);
D)addTextListner(t,eh);
A)t.addTextListener(eh);
B)eh.addTextListner(t);
C)addTextListner(eh.t);
D)addTextListner(t,eh);
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
23
Which is true about an anonymous inner class?
A)It can extend exactly one class and implement exactly one interface.
B)It can extend exactly one class and can implement multiple interfaces.
C)It can extend exactly one class or implement exactly one interface.
D)It can implement multiple interfaces regardless of whether it also extends a class.
A)It can extend exactly one class and implement exactly one interface.
B)It can extend exactly one class and can implement multiple interfaces.
C)It can extend exactly one class or implement exactly one interface.
D)It can implement multiple interfaces regardless of whether it also extends a class.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
24
Which is true about a method-local inner class?
A)It must be marked final.
B)It can be marked abstract.
C)It can be marked public.
D)It can be marked static.
A)It must be marked final.
B)It can be marked abstract.
C)It can be marked public.
D)It can be marked static.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
25
Which statement is true about a static nested class?
A)You must have a reference to an instance of the enclosing class in order to instantiate it.
B)It does not have access to nonstatic members of the enclosing class.
C)It's variables and methods must be static.
D)It must extend the enclosing class.
A)You must have a reference to an instance of the enclosing class in order to instantiate it.
B)It does not have access to nonstatic members of the enclosing class.
C)It's variables and methods must be static.
D)It must extend the enclosing class.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck