javadesktop

¡Supera tus tareas y exámenes ahora con Quizwiz!

. Which will contain the body of the thread? A. run(); B. start(); C. stop(); D. main();

a

13) Which of the package is used to enable interaction with garbage collector? a. java.lang.ref b. java.lang.reflect c. java.lang d. java.awt

a

15) Where are these five keywords try, catch, finally, throw, and throws used in? a. Exception Handling b. String Handling c. Event Handling d. None of the above

a

16) The life cycle of the thread is controlled by ? a. JVM b. JDK c. JRE d. None of the above

a

20) The wrapper classes are part of the which package, that is imported by default into all Java programs? a. java.lang b. java.awt c. java.io d. java.util

a

4) How many layers are available in Hibernate architecture? a. 3 b. 4 c. 5 d. 2

a

6. Which statement is true? A. The notifyAll() method must be called from a synchronized context. B. To call wait(), an object must own the lock on the thread. C. The notify() method is defined in class java.lang.Thread. D. The notify() method causes a thread to immediately release its locks.

a

6. Which two of the following methods are defined in class Thread? start() wait() notify() run() terminate() A. 1 and 4 B. 2 and 3 C. 3 and 4 D. 2 and 4

a

8. Which of the following will directly stop the execution of a Thread? A. wait() B. notify() C. notifyall() D. exits synchronized code

a

Multithreading helps ______________(choose 2) a.programs have more fault tolerance capability. b. increase performance of single-processor sustems c. double speed of the systems d. reduce the CPU idle time.

a

The_______method wakes u all threads that are waiting for a monitor. a.notifuAll() b.wait() c.notify() d.join()

a

The______method causes a thread to release the lock or monitor of the object, allowing another thread to access it. a.wait() b.notifyAll() c.finalize() d.notify()

a

A syschronised block is a _______ or a ________ qualified by synchronized keyword(select 2) a. method b. class c. function d. block of code

a,d

1. Which statement is true? A. A static method cannot be synchronized. B. If a class has synchronized code, multiple threads can still access the nonsynchronized code. C. Variables can be protected from concurrent access problems by marking them with the synchronized keyword. D. When a thread sleeps, it releases its locks.

b

10) Which specification that provides runtime environment in which java byte code can be executed? a. JDK b. JVM c. JRE d. None of the above

b

14) The clone() method is defined in? a. Abstract class b. Object Class c. ArrayList class d. None of the above

b

17) In which the access modifier means that the field can be accessed by all classes in your application? a. private b. Public c. Package d. Protected

b

18) java.applet defines how many interfaces? a. 2 b. 3 c. 4 d. 5

b

2) Which result set generally does not show changes to the underlying database that are made while it is open. The membership, order, and column values of rows are typically fixed when the result set is created? a. TYPE_FORWARD_ONLY b. TYPE_SCROLL_INSENSITIVE c. TYPE_SCROLL_SENSITIVE d. ALL MENTIONED ABOVE

b

3. Which statement is true? A. If only one thread is blocked in the wait method of an object, and another thread executes the modify on that same object, then the first thread immediately resumes execution. B. If a thread is blocked in the wait method of an object, and another thread executes the notify method on the same object, it is still possible that the first thread might never resume execution. C. If a thread is blocked in the wait method of an object, and another thread executes the notify method on the same object, then the first thread definitely resumes execution as a direct and sole consequence of the notify call. D. If two threads are blocked in the wait method of one object, and another thread executes the notify method on the same object, then the first thread that executed the wait call first definitely resumes execution as a direct and sole consequence of the notify call.

b

9) Which is a perfect example of runtime polymorphism? a. Method overloading b. Method overriding c. Constructor overloading d. None of the above

b

9. Which method must be defined by a class implementing the java.lang.Runnable interface? A. void run() B. public void run() C. public void start() D. void run(int priority)

b

The deadlock situation allows normal execution of the program after few minutes. Select one: a.True b.False

b

The isAlive() method sends a query to inquire, whether the thread is block or not. a. True b. False

b

The_______method returns true if the thread is user thread. a.getDaemon() b.isDaemon() c.verifyDaemon() d.setDaemon()

b

What is the name of the method used to start a thread execution? A. init(); B. start(); C. run(); D. resume();

b

11) Which is commonly used method of ByteArrayOutputStream class? a. ByteArrayOutputStream() b. ByteArrayOutputStream(int size) c. public synchronized void writeTo(OutputStream out) throws IOException d. Both A & B

c

2. Which two can be used to create a new Thread? Extend java.lang.Thread and override the run() method. Extend java.lang.Runnable and override the start() method. Implement java.lang.Thread and implement the run() method. Implement java.lang.Runnable and implement the run() method. Implement java.lang.Thread and implement the start() method. A. 1 and 2 B. 2 and 3 C. 1 and 4 D. 3 and 4

c

4. Which two statements are true? Deadlock will not occur if wait()/notify() is used A thread will resume execution as soon as its sleep duration expires. Synchronization can prevent two objects from being accessed by the same thread. The wait() method is overloaded to accept a duration. The notify() method is overloaded to accept a duration. Both wait() and notify() must be called from a synchronized context. A. 1 and 2 B. 3 and 5 C. 4 and 6 D. 1 and 3

c

5) In which technology Struts 2 provides various types of tags such as UI tags, Data tags, control tags etc. to ease the development of struts 2 application? a. Various Result support b. Integration Support c. Various Tag support d. Theme and Template support

c

5. The following block of code creates a Thread using a Runnable target: Runnable target = new MyRunnable(); Thread myThread = new Thread(target); Which of the following classes can be used to create the target, so that the preceding code compiles correctly? A. public class MyRunnable extends Runnable{public void run(){}} B. public class MyRunnable extends Object{public void run(){}} C. public class MyRunnable implements Runnable{public void run(){}} D. public class MyRunnable implements Runnable{void run(){}}

c

The _______ condition describes a situation where two or more thread a blocked forever, waiting for each other. a. syschronization b. blocking c. deadlock d. race

c

Which two are valid constructors for Thread? Thread(Runnable r, String name) Thread() Thread(int priority) Thread(Runnable r, ThreadGroup g) Thread(Runnable r, int priority) A. 1 and 3 B. 2 and 4 C. 1 and 2 D. 2 and 5

c

public class MyRunnable implements Runnable { public void run() { // some code here } } which of these will create and start this thread? A. new Runnable(MyRunnable).start(); B. new Thread(MyRunnable).run(); C. new Thread(new MyRunnable()).start(); D. new MyRunnable().start();

c

The_________method with the argument as true will convert the user thread to a daemon thread. a. isDaemon() b. SetDaemon() c. convertToDaemon() d. setDaemon()

d


Conjuntos de estudio relacionados

(The Great Gatsby) Chapter 4 Study Questions:

View Set

Blaw3201(15), Blaw Chapter 15, Business Law Chapter 15 3

View Set

Chapter 23: Assessing the Abdomen PREP U

View Set