Advanced Java

Advanced Java topics including networking (InetAddress, Socket, DatagramPacket), AWT components and events, graphics, and applets

16 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of the following methods of InetAddress class returns a string that represents the host address associated with the InetAddress object?

  1. getaddress()
  2. getHostAddress()
  3. getHostName()
  4. hashCode()
  5. toString()
Question 2 Multiple Choice (Single Answer)

Which of the following methods of Applet class is used to return a string that describes the applet?

  1. getAppletContext()
  2. getAppletInfo()
  3. getCodeBase()
  4. getDocumentBase()
  5. destroy()
Question 3 Multiple Choice (Single Answer)

Which of the following event classes of java.awt.event package is generated when a check box or list item is clicked?

  1. ActionEvent
  2. AdjustmentEvent
  3. ItemEvent
  4. ComponentEvent
  5. FocusEvent
Question 4 Multiple Choice (Single Answer)

Which of the following event classes of java.awt.event package is generated when input is received from the keyboard?

  1. KeyEvent
  2. MouseEvent
  3. TextEvent
  4. WindowEvent
  5. InputEvent
Question 5 Multiple Choice (Single Answer)

Which of the following methods of Socket class in java returns the local port to which Socket object is connected?

  1. getInetAddress()
  2. getPort()
  3. getLocalPort()
  4. Socket()
  5. getInputStream()
Question 6 Multiple Choice (Single Answer)

Which of the following methods is used in java to format an HTML page to send back to web clients, who make requests that cannot be completed?

  1. toBytes()
  2. getRawRequest()
  3. writeString()
  4. error()
  5. writeUCE()
Question 7 Multiple Choice (Single Answer)

Which of the following events requires adjustment events when used in the Applet?

  1. Button
  2. Checkbox
  3. List
  4. Scrollbar
  5. Choice
Question 8 Multiple Choice (Single Answer)

Which of the following classes is used to display any components in a two-dimensional grid?

  1. List
  2. GridLayout
  3. MenuBar
  4. Image
  5. MenuComponents
Question 9 Multiple Choice (Single Answer)

Which of the following methods of Font class is used to return the logical name of the invoking font?

  1. getName()
  2. getSize()
  3. getStyle()
  4. isBold()
  5. getFontName()
Question 10 Multiple Choice (Single Answer)

Which of the following event listener interfaces defines one method to recognize when a text value changes?

  1. KeyListener
  2. ItemListener
  3. TextListener
  4. FocusListener
  5. ActionListener
Question 11 Multiple Choice (Single Answer)

Which of the following classes in Java encapsulates various information related to a font, which helps a user to display text in a window?

  1. Frame
  2. Graphics
  3. FontMetrics
  4. Font
  5. Event
Question 12 Multiple Choice (Single Answer)

Which of the following classes is used to create a window from which a file can be selected?

  1. Color
  2. Dialog
  3. FileDialog
  4. Dimension
  5. Checkbox
Question 13 Multiple Choice (Single Answer)

Which of the following flags of ImageObserver interface is used to show a complete frame that is part of a multiframe image?

  1. SOMEBITS
  2. FRAMEBITS
  3. ALLBITS
  4. ERROR
  5. WIDTH
Question 14 Multiple Choice (Single Answer)

Which of the following methods of AppletContext interface returns an audio clip object that encapsulates the audio clip found at the location specified as URL in the method?

  1. getApplets()
  2. getImage()
  3. showDocument()
  4. getAudioClip()
  5. showStatus()
Question 15 Multiple Choice (Single Answer)

Which of the following methods of DatagramPacket is used to return the byte array of data contained in the datagram?

  1. getAddress()
  2. getPort()
  3. getData()
  4. getLength()
  5. close()
Question 16 Multiple Choice (Single Answer)

Which of the following methods of Applet class is used to to verify whether an applet is started or not?

  1. isActive()
  2. init()
  3. start()
  4. stop()
  5. getImage()