Exam 13: File Input and Output

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

import java.nio.file.*; public class PathDemo {     public static void main(String[] args)     {         Path filePath = Paths.get("C:\\Java\\Input.Output\\LessonInfo.txt");         int count = filePath.getNameCount();         System.out.println("Path is " + filePath.toString());         System.out.println("File name is " +           filePath.getFileName());         System.out.println("There are " + count +           " elements in the file path");         for(int x = 0; x < count; ++x)             System.out.println("Element " + x + " is " +             filePath.getName(x));     } } The above code demonstrates the creation of a Path and its method. Describe the output that will display when the code is executed.

(Essay)
4.9/5
(41)

____ is an abstract class for reading character streams.

(Multiple Choice)
4.7/5
(34)

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.7/5
(38)

You can direct System.err to a new location, such as a disk file or printer, but you cannot direct System.out to a new location.

(True/False)
4.9/5
(38)

A(n) ____ is a holding place for bytes that are waiting to be read or written.

(Multiple Choice)
4.8/5
(38)
Match each term with the correct statement below.
Premises:
A complete path
Responses:
System.getProperty("line.separator")
data file
flushing
Correct Answer:
Verified
Premises:
Responses:
A complete path
System.getProperty("line.separator")
(Matching)
4.8/5
(34)

You can use Java's ____ class to create your own random access files.

(Multiple Choice)
4.9/5
(38)
Match each term with the correct statement below.
Premises:
The memory location where bytes are held after they are logically output but before they are sent to the output device
Responses:
seekable
static import feature
absolute path
Correct Answer:
Verified
Premises:
Responses:
The memory location where bytes are held after they are logically output but before they are sent to the output device
seekable
(Matching)
4.8/5
(32)

If you simply want to display records in order based on their key field, you need to create a random access file.

(True/False)
4.9/5
(41)

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

(Essay)
5.0/5
(41)

Provide an example of batch processing.

(Essay)
4.8/5
(32)
Match each term with the correct statement below.
Premises:
Allows you to use static constants without their class name
Responses:
close the files
data file
System.getProperty("line.separator")
Correct Answer:
Verified
Premises:
Responses:
Allows you to use static constants without their class name
close the files
(Matching)
4.9/5
(35)

InputStream is a child of FileInputStream .

(True/False)
4.9/5
(37)

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)
4.9/5
(37)

A ____ is a group of characters that has some meaning.

(Multiple Choice)
4.7/5
(31)
Match each term with the correct statement below.
Premises:
Returns the default line separator for a system
Responses:
flushing
buffer
root
Correct Answer:
Verified
Premises:
Responses:
Returns the default line separator for a system
flushing
(Matching)
4.9/5
(42)
Match each term with the correct statement below.
Premises:
A collection of related records
Responses:
stream
wrapped
root
Correct Answer:
Verified
Premises:
Responses:
A collection of related records
stream
(Matching)
4.9/5
(35)

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

(Multiple Choice)
4.9/5
(33)
Showing 61 - 78 of 78
close modal

Filters

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