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.

Which of the following applet tags is legal to embed an applet class named Test into a Web page?

  < applet
class = Test width = 200 height = 100>

  < applet>
code = Test.class width = 200 height = 100>

  < applet
code = Test.class width = 200 height = 100

  < applet
code = Test.class width = 200 height = 100>

  < applet
param = Test.class width = 200 height = 100>

  Half-n-half Clue
 

2.

Which are the valid ways to create DataInputStream streams?

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

  new DataInputStream("in.dat")

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

  new DataInputStream();

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

  Half-n-half Clue
 

3.

When we invoke repaint() for a java.awt.Component object, the AWT invokes the method:

  show()

  draw()

  paint()

  update()

  Half-n-half Clue
 

4.

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) & (D)

  (B), (D) & (E)

  (B), (C) & (E)

  (B) & (C)

  Half-n-half Clue
 

5.

Which of the following strings can be used as mode strings for creating a RandomAccessFile object?
(A) "r"
(B) "w"
(C) "rw"
(D) "wr"
(E) "0"

  (B), (D) & (E)

  (A), (B), (C) & (E)

  (A), (B) & (C)

  (C) & (D)

  (A) & (C)

  Half-n-half Clue
 

6.

DataInput is

  an interface that defines methods to open files.

  a class we can use to read primitive data types.

  an abstract class defined in java.io.

  an interface that defines methods to read primitive data types.

  Half-n-half Clue
 

7.

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
 


 
12 more pages in Java Programming


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