Exam 13: File Input and Output
Exam 1: Creating Java Programs61 Questions
Exam 2: Using Data67 Questions
Exam 3: Using Methods Classes and Objects66 Questions
Exam 4: More Object Concepts66 Questions
Exam 5: Making Decisions66 Questions
Exam 6: Looping66 Questions
Exam 7: Characters Strings and the Stringbuilder68 Questions
Exam 8: Arrays66 Questions
Exam 9: Advanced Array Concepts66 Questions
Exam 10: Introduction to Inheritance66 Questions
Exam 11: Advanced Inheritance Concepts66 Questions
Exam 12: Exception Handling66 Questions
Exam 13: File Input and Output66 Questions
Exam 14: Introduction to Swing Components66 Questions
Exam 15: Advanced Gui Topics66 Questions
Exam 16: Graphics66 Questions
Select questions type
____ applications require that a record be accessed immediately while a client is waiting.
(Multiple Choice)
4.9/5
(82)
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
(78)
A file channel is ____, meaning you can search for a specific file location and operations can start at any specified position.
(Multiple Choice)
4.8/5
(83)
import java.nio.file.*;
import java.io.*;
import java.nio.channels.FileChannel;
import java.nio.ByteBuffer;
import static java.nio.file.StandardOpenOption.*;
public class CreateOneRandomAccessRecord
{
public static void main(String[] args)
{
Path file =
Paths.get("C:\\Java\\Chapter.13\\RandomEmployees.txt");
String s = "002,Newmann,12.25" +
System.getProperty("line.separator");
--------- Code here -------------
byte[] data = s.getBytes();
ByteBuffer buffer = ByteBuffer.wrap(data);
FileChannel fc = null;
try
{
fc = (FileChannel)Files.newByteChannel(file, READ, WRITE);
fc.position(2 * RECSIZE);
fc.write(buffer);
fc.close();
}
catch (Exception e)
{
System.out.println("Error message: " + e);
}
}
}
The above program creates a single employee record for employee number 002 with a last name of Newmann and a pay rate of 12.25. In the indicated space, create a statement that assigns the length of the string to RECSIZE .
(Short Answer)
4.8/5
(78)
A data file can be used as a(n) ____ file when each record is accessed one after another in the order in which it was stored.
(Multiple Choice)
4.8/5
(82)
Match each term with the correct statement below.
Correct Answer:
Premises:
Responses:
(Matching)
4.8/5
(69)
Showing 61 - 66 of 66
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)