OOP BITS








 1. To determine the width and height of an application which of the following method is used?
                                                                                                                                         [   ]
         a)       getWidthHeight() b) setWidthHeight() c) getSize() d) setHeightWidth()
 2. What are the applet’s lifecycle methods?                                                                         [  ]
      a) init(), start() and destroy() b) init(), start() and paint()
       c) init(), start(),paint(), stop() and destroy() d) init(), start() and stop()
 3. The default layout out of a JPanel is                                                                                       [ ]
   a) FlowLayout b) GridLayout c) BorderLayout d) default Layout
 4. You should override the ___________ method to draw things on a Swing component.            [  ]
a) repaint() b) update() c) paintComponent() d) init()
5. Which method on a condition should you invoke to wake all waiting thread?                              [   ]
a) condition.wake(); b) condition.signal(); c) condition.signalAll();d) condition.wakeAll();
6.Which of the following statement is not defined in the Object class?                                           [  ]
a) sleep(long milliseconds) b) wait() c) notify() d) notifyAll()
7.  Which of the following objects are input to the paint() method?                                                [  ]
a) canvas b) graphics c) paint d) image
8. Which cannot directly cause a thread to stop executing?                                                             [  ]
a) Calling a yield method b) Calling the start method on another thread object
c) Calling the notify method on object d) Calling wait method on an object
9. A thread is also called as ___________.                                                                                       [  ]
a. heavyweight process b. lightweight process c. interface d. event
10.  Which of the following method doesn’t belong to Thread.                                                       [  ]
   a. is alive b. join c. wake    d. sleep
11. Which listener interface is needed in handling TextField?                                                         [  ]
 a. ActionListener b. ItemListener c. TextListener d. InputListener
12.  BorderLayout manager divides window in to _____ areas.                                                       [  ]
 a.2 b.3 c.5 d.4
13.  __________ is a protocol that sends independent packets of data, called datagrams from one computer to another with no guarantees about arrival.                                                                     [  ]
a. TCP b. UDP c. HTTP d. FTP
14. Which is a checked Runtime Exception?                                                                                    [  ]
 a. NullPointerException b. InterruptedException
c. ArithematicException d. ArrayIndexOutOfBoundsException
15.  _____________ is a single sequential flow of control within a program. [ ]
a. thread b. event c. window d. interface




16. The ____________ class provides a compact, multiple-choice, scrolling selection list.              [  ]
a. choice b. list c. checkbox d. button
17. You can use the _ _ _ _ _ _ _ _ method to force one thread to wait for another thread to finish.[  ]
a. sleep(long milliseconds) b. yield() c. stop() d. join()
18. Which of the following classes are not in the java.awt package?                                                 [  ]
a. Color b. Font c. Component d. Jframe
19. A Java exception is an instance of _ _ _ _ _ _ _ _ _ _ .                                                                 [  ]
a. Runtime Exception b. Exception c. Error d. Throwable
20. The interface _ _ _ _ _ _ _ _ _ _ should be implemented to listen for a button action event.       [  ]
a. MouseListener b. ActionListener c. FocusListener d. WindowListener
21.  Which of the following properties are in JApplet?                                                                       [  ]
a. contentPane b. iconImage c. resizable d. title
22. A JMenu is a not subclass of _ _ _ _ _ _ _ _ .                                                                                [  ]
a. JMenuItem b. AbstractButton c. JComponent d. JButton
23. The keyword to synchronize methods in Java is ________________                                          [  ]
a. synchronize b. synchronizing c. synchronized d. Synchronized
24. Program statements that are to be monitored for exceptions are contained within _____ block. [  ]
a. try b. catch c. throw d. throws
25. Frames, Panels and objects that can contain other GUI objects are known as _______               [  ]
a. Container b. Tab c. Dialog d. Layout
26.  Swing components that don't rely on native GUI are referred to as_________________ .         [  ]
a. lightweight components b. heavyweight components
c. GUI components d. Non-GUI components
27. Which block following will execute whether or not an exception is thrown?                               [  ]
a. Try b. Catch c. Throw d. Finally
28.  A ___________ provides a scrollable view of a component.                                                       [  ]
a. JScrollPane b. Jcheckbox c. JComboBox d. JPopupMenu
29.  ___________ returns a string that represent the hostname associated with the InetAddress Address object.                                                                                                                                     [  ]
a. getAddress() b. getString() c. getHostName() d. getHost()
30. Java provides a class library called ____________ for GUI programming                                  [ ]
a.swing b.lang c.AWT d.util
















 ANSWERS:




1)C
2)C
3)A
4)C
5)C
6)A
7)B
8)C
9)B
10)C
11)A
12)C
13)B
14)B
15)A
16)B
17)D
18)D
19)D
20)B
21)A
22)D
23)C
24)A
25)A
26)A
27)D
28)D
29)C
30)c


No comments:

Post a Comment