Top 250+ Solved Java Programming MCQ Questions Answer

From 226 to 240 of 285

Q. Which of these methods in KeyEvent class can be used to know which key is pressed?

a. getKeyCode()

b. getModifier()

c. getActionKey()

d. getActionEvent()

  • a. getKeyCode()

Q. Which of these interfaces define a method actionPerformed()?

a. ComponentListener

b. ContainerListener

c. ActionListener

d. InputListener

  • c. ActionListener

Q. Which of these interfaces define a method itemStateChanged()?

a. ComponentListener

b. ContainerListener

c. ActionListener

d. ItemListener

  • d. ItemListener

Q. What are the sequences of method executed when an Applet starts execution?

a. init(),start(),stop(),destroy()

b. load(),start(),stop(),unload()

c. init(),activate(),deactivate(),destroy()

d. start(),init(),destroy(),stop()

  • a. init(),start(),stop(),destroy()

Q. The default layout manager of an Applet is

a. Flowlayout

b. Gridlayout

c. BorderLayout

d. BoxLayout

  • a. Flowlayout

Q. The default layout manager of a Frame is

a. Flowlayout

b. Gridlayout

c. BorderLayout

d. BoxLayout

  • c. BorderLayout

Q. Which package consist an applet class?a) jav

a. applet

b. java.awt

c. java.awt.applet

d. java.event

  • a. applet

Q. How do you position a component using FlowLayout?

a. North, South, East, West

b. Assign a row/column grid reference

c. Pass a X/Y percentage parameter to the add method

d. Do nothing, the FlowLayout will position the component

  • d. Do nothing, the FlowLayout will position the component

Q. How do you change the current layout manager for a container

a. Use the setLayout() method

b. Once created you cannot change the current layout manager of a component

c. Use the setLayoutManager() method

d. Use the updateLayout() method

  • a. Use the setLayout() method

Q. The AWT component used to display a single line of read-only text

a. A checkbox

b. A Label

c. A button

d. A TextField

  • b. A Label

Q. The method to get the text of a Label

a. getLabel()

b. getText()

c. getString()

d. getData()

  • b. getText()

Q. The AWT component used for taking input from user.

a. A TextBox

b. A Label

c. A button

d. A TextField

  • d. A TextField

Q. The method to set the text of Textfield.

a. setLabel()

b. setString()

c. setText()

d. setData()

  • c. setText()

Q. The class used to create a Radio button in awt is

a. Checkbox

b. RadioButton

c. OptionButton

d. CheckboxGroup

  • d. CheckboxGroup

Q. A ------------ is an object that the user can see on the screen and-in most cases-interact with.

a. an Event

b. a window

c. a Component

d. a Listener

  • c. a Component
Subscribe Now

Get All Updates & News