Syvum Home Page

Home > Quiz Games > Java Programming >

Java Programming : java.awt and java.io : Multiple Choice


Learn about java.awt and java.io packages.

Formats Info Page Worksheet / Test Paper Quiz Review
Multiple choice

Your Performance  

1.

What does the following line of code do?
Textfield text = new Textfield(10);

  Creates the object text and initializes it with the value 10.

  The code is illegal.

  Creates text object that can hold 10 rows of text.

  Creates text object that can hold 10 columns of text.

  Half-n-half Clue
 

2.

If you want to assign a value of 99 to the variable year, then which of the following lines can be used within an tag?

  < number = 99 >

  number = getParameter(99)

  < param number = 99 >

  < param name = number value = 99 >

  < param = radius value = 99 >

  Half-n-half Clue
 

3.

Which of the following methods can be used to remove a java.awt.Component object from the display?

  delete()

  disappear()

  hide()

  remove()

  move()

  Half-n-half Clue
 

4.

Which are the valid ways to create DataInputStream streams?

  new DataInputStream();

  new DataInputStream("in.dat")

  new DataInputStream(new File("in.dat"));

  new DataInputStream("in.dat", "r");

  new DataInputStream(new FileInputStream("in.dat");

  Half-n-half Clue
 

5.

The setBackground() method is part of the following class in java.awt package:

  Graphics

  Applet

  Component

  Object

  Container

  Half-n-half Clue
 

6.

Which exception is thrown by the read() method of InputStream class?

  Exception

  None of these

  FileNotFoundException

  IOException

  ReadException

  Half-n-half Clue
 

7.

Given file is a File object, which of the following are legal statements to create a new file?
(A) file.create();
(B) FileOutputStream fos = new FileOutputStream(file);
(C) FileWrter out = new FileWriter(file);
(D) FileInputStream fis = new FileInputStream(file);
(E) RandomAccessFile raf = new RandomAccessFile(file);

  (A), (B), (D) & (E)

  (B) & (C)

  (B), (D) & (E)

  (B), (C) & (D)

  (B), (C) & (E)

  Half-n-half Clue
 


 
12 more pages in Java Programming


Contact Info © 1999-2019 Syvum Technologies Inc. Privacy Policy Disclaimer and Copyright
Previous
-
Next
-