Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Questions, Please answer all: Question 1: File = InputStream = OutputStream = FileWrite = FileClass = ObjectInputStream = Serializable = ObjectOutputStream = A. An

Java Questions, Please answer all:

Question 1:

File = InputStream = OutputStream = FileWrite = FileClass = ObjectInputStream = Serializable = ObjectOutputStream =

A. An abstract class that defines methods for performing input.

B. An abstract class that defines methods for performing output.

C. A tagging interface that allows objects of a class to be used with object streams.

D. Used to read objects from a stream

E. Used by programs to obtain information about a file or directory

F. Group of related records

G. Objects of this class write characters to a file

H. Used to write objects to a stream

Question 2: A good programming practice for I/O in Java is a. have objects do their own I/O b. design a single class to do all I/O for the program c. avoid file I/O since it is inefficient d. never append to a file

Question 3: Every program that does file I/O a. must include the line "include io.java" somewhere in the program b. can do input from a file or output to a file but not both c. must be designed specifically for the operating system in which it will run d. must include the line "import java.io.*" near the beginning

Question 4: If a new output text file cannot be created

a. a FileNotCreatedException will be thrown b. a FileNotFoundException will be thrown c. The program will stop executing with an error message d. the program will continue executing and might produce incorrect results

Qustion 5: If an open file is not closed when the program finishes executing

a. a FileNotClosed exception will be thrown b. the contents of the file will be lost c. Java will close the file but it is better to explicitly close the file d. no other program will be able to open the file

Question 6: If data in a stream flows out of a file then the stream is an output stream.

a. True b. False

Question 7: The preferred way to open a text file is to pass the file name to the constructor for BufferedReader.

a. True c. False

Question 8: When a program tries to read beyond the end of a file, the read method returns the value -1

a. True b. False

Question 9: Opening a text file for writing

a. requires use of the PrintWriter constructor b. requires use of the FileOutputStream constructor c. requires the use of the PrintWriter constructor and the FileOutputStream constructor d. the program will continue executing and might produce incorrect results

Question 10: The classes used to open a binary file for writing are

a. PrintWriter and FileOutputStream b. ObjectOutputStream and FIleOutputStream c. PrintWriter and ObjectOutputStream d. Buffered Writer and ObjectOutputStream

Question 11: Write a sequence of statements that create a file named "fileio.txt" and write a single line consisting "Hello, World!" to that file, then close the file.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

What is the budget for this project?

Answered: 1 week ago

Question

" loop SC 0 2 'GUI' "

Answered: 1 week ago