Top 250+ Solved Java Programming MCQ Questions Answer
Q. An Applet has its Layout Manager set to the default of FlowLayout. What code would bethe correct to change to another Layout Manager?
a. setLayoutManager(new GridLayout());
b. setLayout(new GridLayout(2,2));
c. setGridLayout(2,2);
d. setBorderLayout();
Q. The default layout manager of an Applet is
a. Flowlayout
b. Gridlayout
c. BorderLayout
d. BoxLayout
Q. The processes that participate in supporting remote method invocation are
a. Client
b. Server
c. Object Registry
d. All of the above
Q. Through the design mode of a builder tool, we use ___ or ____ to customize the bean.
a. Property sheet
b. Bean customizer
c. Either (a) or (c)
d. None of the above
Q. Swing is a ___________ framework
a. connection-based
b. component-based
c. platform-based
d. None of the above
Q. Which method is used to enable an event for a particular object?
a. enableEvent()
b. enable()
c. enableObject()
d. enableEvents()
Q. How would you detect a keypress in a JComboBox?
a. Add a KeyListener to the JComboBox
b. Add a KeyListener to the JComboBox’s editor component
c. Either (a) or (b)
d. None of the above
Q. Which Swing methods are thread-safe?
a. repaint()
b. revalidate()
c. invalidate()
d. all of the above
Q. Which of the following is not true?
a. The Frame class extends Window
b. The CheckboxMenuItem class extends the MenuItem class
c. JComponent is a subclass of Container
d. None of the above
Q. What is the correct way to write a JavaScript array?
a. var txt = new Array:1=("tim")2=("kim")3=("jim")
b. var txt = new Array(1:"tim",2:"kim",3:"jim")
c. var txt = new Array="tim","kim","jim")
d. var txt = new Array("tim","kim","jim")
Q. What is the correct JavaScript syntax to insert a comment that has more than one line?
a. <!--This comment has more than one line-->
b. /*This comment has more than one line*/
c. //This comment has more than one line//
d. <//This comment has more than one line//>
Q. What is Remote method invocation (RMI)?
a. RMI allows us to invoke a method of java object that executes on another machine.
b. RMI allows us to invoke a method of java object that executes on another Thread in multithreaded programming.
c. RMI allows us to invoke a method of java object that executes parallely in same machine.
d. None of the mentioned
Q. Which of this package is used for remote method invocation?
a. javapplet
b. java.rmi
c. java.lang.rmi
d. java.lang.reflect
Q. Which of these methods are member of Remote class?
a. checkIP()
b. addLocation()
c. AddServer()
d. None of the mentioned