Object Oriented Programming Mid - II, April - 2012
1.To determine the width and height of an application which of the following method is used?
- 
                                            getWidthHeight()
- 
                                            setWidthHeight()
- 
                                            getSize()
- 
                                            setHeightWidth()
- 
                                            
                                                Answer: C
                                            
                                        2.What are the applet’s lifecycle methods?
- 
                                            init(), start() and destroy()
- 
                                            init(), start() and paint()
- 
                                            init(), start(),paint(), stop() and destroy()
- 
                                            init(), start() and stop()
- 
                                            
                                                Answer: C
                                            
                                        3.The default layout out of a JPanel is
- 
                                            FlowLayout
- 
                                            GridLayout
- 
                                            BorderLayout
- 
                                            default Layout
- 
                                            
                                                Answer: B
                                            
                                        4.You should override the ___________ method to draw things on a Swing component.
- 
                                            repaint()
- 
                                            update()
- 
                                            paintComponent()
- 
                                            init()
- 
                                            
                                                Answer: C
                                            
                                        5.Which method on a condition should you invoke to wake all waiting thread?
- 
                                            condition.wake();
- 
                                            condition.signal();
- 
                                            condition.wakeAll();
- 
                                            condition.signalAll();
- 
                                            
                                                Answer: D
                                            
                                        6.The preferredSize property is ignored in
- 
                                            FlowLayout
- 
                                            GridLayout
- 
                                            BorderLayout
- 
                                            For any layout
- 
                                            
                                                Answer: B
                                            
                                        7.You can use the _______ method to force one thread to wait for another thread to finish.
- 
                                            sleep(long milliseconds)
- 
                                            yield()
- 
                                            stop()
- 
                                            join()
- 
                                            
                                                Answer: D
                                            
                                        8.Which of the following statement is not defined in the Object class?
- 
                                            sleep(long milliseconds)
- 
                                            wait()
- 
                                            notify()
- 
                                            notifyAll()
- 
                                            
                                                Answer: A
                                            
                                        9.Which of the following objects are input to the paint() method?
- 
                                            canvas
- 
                                            graphics
- 
                                            paint
- 
                                            image
- 
                                            
                                                Answer: B
                                            
                                        10.Which cannot directly cause a thread to stop executing?
- 
                                            Calling a yield method
- 
                                            Calling the start method on another thread object
- 
                                            Calling the notify method on object
- 
                                            Calling wait method on an object
- 
                                            
                                                Answer: C
                                            
                                        11.An instance of _______________ are unchecked exceptions.
                                                Answer: runtime exceptions
                                            
                                        12.The ___________ interface should be implemented to listen for a button action event.
                                                Answer: action listener
                                            
                                        13.________________ cannot be shared by a GUI component.
                                                Answer: GUI component
                                            
                                        14.An application responds to an exception by throwing an another exception is called as ___________.
                                                Answer: Chained exceptions
                                            
                                        15.___________ is the region where the code that needs to be executed under circumstances is written.
                                                Answer: Finally
                                            
                                        16._______________ is an independent path of execution in a program.
                                                Answer: Thread
                                            
                                        17.With _________________ many threads share the same object instance.
                                                Answer: Runnable interface
                                            
                                        18.A program that a java enabled browser can download and run is a ____________.
                                                Answer: Applet
                                            
                                        19._____________ method is called on calling the repaint method.
                                                Answer: update
                                            
                                        20.____________ is the process of confining paint operations to a limited area or shape.
                                                Answer: clipping