Java AWT, Swing & Fundamentals

Questions covering Java AWT components, Swing UI elements, event handling, graphics, and core Java language concepts.

15 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

How many constructors are there for Layout manager FlowLayout?

  1. 5
  2. 4
  3. 3
  4. 2
  5. 1
Question 2 Multiple Choice (Single Answer)

Which of the following methods is/are valid in Java for event handling?

  1. mouseEnetered()
  2. keyReleased()
  3. mouseDragged()
  4. Both 1 & 2
  5. All of these
Question 3 Multiple Choice (Single Answer)

Which of the following methods is not defined in the Graphics class in java?

  1. fillRect()
  2. fillCircle()
  3. fillOval()
  4. fillArc()
  5. None of these
Question 4 Multiple Choice (Single Answer)

How many constructors are present of BorderLayout in java?

  1. 5
  2. 4
  3. 3
  4. 2
  5. 1
Question 5 Multiple Choice (Single Answer)

Which of the following statements about the given statement is correct?
Color c1 = new Color(284,60,189);

  1. A new color will be created.
  2. runtime Exception
  3. Parameters are not enough
  4. Compile time error : cannot find method color
  5. Compile time error : Color is Abstract cannot xreate an object.
Question 6 Multiple Choice (Single Answer)

How many parameters are passed to the constructor of the Font class in java?

  1. 4
  2. 3
  3. 2
  4. 1
  5. None of these
Question 7 Multiple Choice (Single Answer)

How many primitive data types are available in java?

  1. 9
  2. 6
  3. 8
  4. 7
  5. 5
Question 8 Multiple Choice (Single Answer)

Which of the following source objects does not generate the ActionEvent?

  1. JRadioButton
  2. JCheckBox
  3. JComboBox
  4. JList
  5. JTextField
Question 9 Multiple Choice (Single Answer)

Which of following layout managers is/are present in java awt?

  1. Gridlayout
  2. Flowlayout
  3. Cardlayout
  4. Both 1 and 2
  5. 1, 2 and 3
Question 10 Multiple Choice (Single Answer)

Which of the following methods cannot be invoked from the instance of Frame class in AWT?

  1. setLocation(int ,int)
  2. setVisible(Boolean)
  3. setSize(int , int)
  4. setDefaultCloseOperation(int)
  5. Pack()
Question 11 Multiple Choice (Single Answer)

Which of the following event types is/are invalid in java?

  1. FocusEvent
  2. ComponentEvent
  3. AdjustmentEvent
  4. Both 2 and 3
  5. None of these
Question 12 Multiple Choice (Single Answer)

Which of the following methods is not necessary to define for a class if it implements the windowListener Interface?

  1. windowMoved()
  2. windowClosing()
  3. windowIconified()
  4. windowActivated()
  5. windowDeiconified()
Question 13 Multiple Choice (Single Answer)

Which of the following methods is/are used by a web browser to control the applet?

  1. Wait()
  2. Destroy()
  3. Dead()
  4. Both 1 and 3
  5. Both 1 and 2
Question 14 Multiple Choice (Single Answer)

Which of the following is the subclasses of RuntimeException?

  1. IllegalArgumentException
  2. NullPointerException
  3. IOException
  4. IndexOutOfBoundException
  5. ArithmeticException
Question 15 Multiple Choice (Single Answer)

Which of the following is not the method of the scanner class object in java?

  1. Next()
  2. nextLine()
  3. nextInt()
  4. nextChar()
  5. nextLong()