Exam 13: File Input and Output
Exam 1: Creating Java Programs68 Questions
Exam 2: Using Data74 Questions
Exam 3: Using Methods, Classes, and Objects68 Questions
Exam 4: More Object Concepts67 Questions
Exam 5: Making Decisions70 Questions
Exam 6: Looping72 Questions
Exam 7: Characters, Strings, and the Stringbuilder73 Questions
Exam 8: Arrays74 Questions
Exam 9: Advanced Array Concepts74 Questions
Exam 10: Introduction to Inheritance70 Questions
Exam 11: Advanced Inheritance Concepts70 Questions
Exam 12: Exception Handling65 Questions
Exam 13: File Input and Output74 Questions
Exam 14: Introduction to Swing Components74 Questions
Exam 15: Advanced Gui Topics69 Questions
Exam 16: Graphics74 Questions
Exam 17: Applets, Images, and Sound72 Questions
Select questions type
When you use the BufferedReader class, you must import the ____ package into your program.
(Multiple Choice)
4.8/5
(37)
Which of the following statements will write a line separator?
(Multiple Choice)
4.9/5
(38)
An array of bytes can be wrapped, or encompassed, into a ByteBuffer using the ByteBuffer ____ method.
(Multiple Choice)
4.9/5
(32)
The value you store in memory is lost when the program ends or the computer loses power. This type of storage device is called ____________________.
(Short Answer)
4.8/5
(38)
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));
__________________________
while(s != null)
{
System.out.println(s);
____________________________
}
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. In the blank lines provided, 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.
(Essay)
4.8/5
(40)
You can store data in variables within a program, but this type of storage is temporary.
(True/False)
4.8/5
(43)
FileSystems is a class that contains ____ methods, which assist in object creation.
(Multiple Choice)
4.8/5
(39)
writer.write(names, 0, names.length());
The above code represents a write() method of the BufferedWriter class. Describe the purpose of the method and how it accepts the String characters.
(Essay)
4.9/5
(38)
Placing a file in the ____ directory of your storage device is equivalent to tossing a loose document into a drawer.
(Multiple Choice)
4.7/5
(46)
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.9/5
(45)
A(n) ____ field is the field in a record that makes the record unique from all others.
(Multiple Choice)
5.0/5
(36)
import java.nio.file.*;
import java.nio.file.attribute.*;
import java.io.IOException;
public class PathDemo5
{
public static void main(String[] args)
{
Path myPath = Paths.get("C: \\Java\\Input.Output\\MyData.txt");
try
{
_______________________________________
System.out.println("Creation time " + attr.creationTime());
System.out.println("Last modified time " + attr.lastModifiedTime());
System.out.println("Size " + attr.size());
}
catch(IOException e)
{
System.out.println("IO Exception");
}
}
}
Using the above code, create a statement in the blank line provided that uses the readAttributes() method of the Files class that takes two arguments-the Path object created in the code and a BasicFileAttributes.class-and returns an instance of the BasicFileAttributes class named attr.
(Essay)
4.9/5
(37)
In random access files, records can be retrieved directly in any order.
(True/False)
4.8/5
(35)
You can use Java's ____ class to create your own random access files.
(Multiple Choice)
4.8/5
(45)
You can create a writeable file by using the Files class ____ method.
(Multiple Choice)
4.9/5
(37)
The String class ____ method accepts an argument that identifies the field delimiter and returns an array of Strings.
(Multiple Choice)
4.8/5
(39)
Match each term with the correct statement below.
-Functions as a pipeline or channel between a Java program and an input device
(Multiple Choice)
5.0/5
(36)
Showing 21 - 40 of 74
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)