Exam 13: File Input and Output

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Which of the following statements will write a line separator?

(Multiple Choice)
4.9/5
(30)

FileSystems is a class that contains ____ methods, which assist in object creation.

(Multiple Choice)
4.8/5
(37)

InputStream and OutputStream are subclasses of the ____ class.

(Multiple Choice)
4.8/5
(41)

Java lets you assign a file to a(n) ____ object so that screen output and file output work in exactly the same manner.

(Multiple Choice)
4.9/5
(39)

A(n) ____________________ is a collection of fields that contain data about an entity.

(Short Answer)
4.9/5
(37)

You can use Java's ____ class to create objects that contain information about files or directories, such as their locations, sizes, creation dates, and whether they even exist.

(Multiple Choice)
4.9/5
(45)

import java.nio.file.*; import java.io.*; public class ReadEmployeeFile {    public static void main(String[] args)    {       Path file =         Paths.get("C:\\Java\\Chapter.13\\Employees.txt");       String s = "";       try       {          InputStream input = new            BufferedInputStream(Files.newInputStream(file));          BufferedReader reader = new            BufferedReader(new InputStreamReader(input));          -----Code here-----          while(s != null)          {              System.out.println(s);              -----Code here-----          }          reader.close();      }      catch(Exception e)      {         System.out.println("Message: " + e);      }    } } The above code represents a program that reads an Employees text file. An InputStream is declared for the file, and a BufferedReader is created using the InputStream . On the indicated lines, write a statement that will read the first line into the String . Likewise, in the while statement, write the statement to display the String and read a new line as long as the readLine() method does not return a null value.

(Short Answer)
4.9/5
(40)

Comma-separated values (CSV) is a file format strictly used for working with Java and databases.

(True/False)
4.9/5
(49)

FileChannel fc = null; Path file = Paths.get("C:\\Java\\Chapter.13\\RandomEmployees.txt"); Given the two declarations above, write a Java statement that creates a ByteChannel that is cast to a FileChannel . The file shoould be open for read and write operations.

(Short Answer)
5.0/5
(32)

A(n) ____________________ object is an avenue for reading and writing a file.

(Short Answer)
4.9/5
(31)

Because the backslash character starts the escape sequence in Java, you must use two ____ in a string that describes a Path in the DOS operating system.

(Multiple Choice)
4.8/5
(35)

Permanent storage is usually called computer memory or random access memory (RAM).

(True/False)
4.9/5
(42)

How can you assign program output to a file, rather than to the standard output device? Explain how this works. Give an example.

(Essay)
4.8/5
(44)

An array of bytes can be wrapped, or encompassed, into a ByteBuffer using the ByteBuffer ____ method.

(Multiple Choice)
4.8/5
(43)

When you perform input and output operations in an application, what is actually occurring with the bytes of information?

(Essay)
4.8/5
(44)

You can create a writeable file by using the Files class ____ method.

(Multiple Choice)
4.9/5
(38)

How can you categorize files by the way they store data?

(Essay)
4.9/5
(38)

How can you write the system's newline character to a file in Java?

(Essay)
4.9/5
(43)

You can store data in variables within a program, but this type of storage is temporary.

(True/False)
4.8/5
(37)

What tasks are typically performed when working with stored files in an application?

(Essay)
5.0/5
(35)
Showing 21 - 40 of 66
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)