Java Programing laungage

Java Input Output Projects

Java I/O Project 1

Java Input Output Examples

Java Input Output Examples

IO Objective Questions And Answers
More interview questions and answers

When we invoke repaint() for a java.awt.Component object, the AWT invokes the method: (a)update() (b)draw() (c)show() (d)paint()

(a)Update

What does the following line of code do? Textfield text = new Textfield(10); (a)Creates text object that can hold 10 rows of text. (b)Creates the object text and initializes it with the value 10. (c)The code is illegal. (d)Creates text object that can hold 10 columns of text.

Creates text object that can hold 10 columns of text.

Which of the following applet tags is legal to embed an applet class named Test into a Web page? (a)< applet class = Test width = 200 height = 100> (b)< applet> code = Test.class width = 200 height = 100> (c) < applet code = Test.class width = 200 height = 100 (d) < applet code = Test.class width = 200 height = 100> (e) < applet param = Test.class width = 200 height = 100>

(c)

Which of the following methods can be used to draw the outline of a square within a java.awt.Component object? (A) fillRect() (B) drawLine() (C) drawRect() (D) drawString() (E) drawPolygon() (a)(A), (B), (C) & (E) (b)(A), (B) & (C) (c)(C), (D) & (E) (d)(B), (C) & (E) (e)(B) & (C)

(d)

Which of the following methods can be used to change the size of a java.awt.Component object? (A) dimension() (B) setSize() (C) area() (D) size() (E) resize() (a)(A), (B), (C) & (E) (b)(A), (B) & (E) (c)(B), (D) & (E) (d)(D) & (E) (e)(B) & (E)

(e)

Which of the following methods can be used to remove a java.awt.Component object from the display? (a)delete() (b)hide() (c)remove() (d)disappear() (e)move()

(b)

The setBackground() method is part of the following class in java.awt package: (a)Graphics (b)Applet (c)Component (d)Container (e)Object

(c)

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" (a)(A), (B), (C) & (E) (b)(A), (B) & (C) (c)(A) & (C) (d)(B), (D) & (E) (e)(C) & (D)

(c)

DataInput is (a)an interface that defines methods to read primitive data types. (b)an abstract class defined in java.io. (c)a class we can use to read primitive data types. (d)an interface that defines methods to open files.

an interface that defines methods to read primitive data types.

Which of the following statements are true? (A) Unicode characters are all 16 bits. (B) UTF characters are all 24 bits. (C) Reader class has methods that can read integers and floats. (D) File class may be used to rename a file. (E) DataOutputStream objects are used to write primitive data to a file. (a) (A), (C), (D) & (E) (b)(A), (B) & (D) (c)(B), (D) & (E) (d)(A) & (D) (e)(A), (D) & (E)

(A), (D) & (E)

Which are the valid ways to create DataInputStream streams? (a) new DataInputStream(new FileInputStream("in.dat"); (b)new DataInputStream(); (c)new DataInputStream("in.dat", "r"); (d)new DataInputStream("in.dat") (e)new DataInputStream(new File("in.dat"));

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

Which exception is thrown by the read() method of InputStream class? (a)IOException (b)Exception (c)FileNotFoundException (d)ReadException (e)None of these

IOException

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? (a)number = getParameter(99) (b)< number = 99 > (c)< param = radius value = 99 > (d)< param name = number value = 99 > (e)< param number = 99 >

< param name = number value = 99 >

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)(A), (B), (D) & (E) (b)(B), (C) & (D) (c)(B), (C) & (E) (d)(B), (D) & (E) (e)(B) & (C)

(B), (C) & (E)