Exam 20: Streams and Binary Inputoutput

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

You use _________ and FileOutputStream objects to write data to a disk file in text or binary form respectively.

Free
(Multiple Choice)
4.9/5
(30)
Correct Answer:
Verified

B

Which line completes this code fragment to define a text file named txtfile for reading? ____________________________________________________ String line = scan.nextLine();

Free
(Multiple Choice)
4.8/5
(37)
Correct Answer:
Verified

D

The FileInputStream read method reads binary data. What type is actually returned from a call to read?

Free
(Multiple Choice)
5.0/5
(40)
Correct Answer:
Verified

A

Which of the following cannot be serialized? I ArrayList<String> II String III Integer

(Multiple Choice)
4.7/5
(41)

Which file storage method is in human-readable form?

(Multiple Choice)
4.8/5
(41)

Assume we have a RandomAccessFile object, file, which stores a set of records of class MyData. The size of each record is MyData.RECORD_SIZE. Assume MyData has read and write methods, both of which take a RandomAccessFile as an argument. Method write writes the object at the current location. Method read reads the record from current location of the file into the object. If we are currently at the beginning of the 25th record, which code correctly modifies the 25th record by changing its color to Color.yellow through the setColor method?

(Multiple Choice)
4.9/5
(40)

The ____ class is used when writing text files.

(Multiple Choice)
4.8/5
(34)

What is the highest value for a signed (negative and positive) byte?

(Multiple Choice)
4.8/5
(44)

How many bytes does the read method in the FileInputStream class actually get from the file?

(Multiple Choice)
4.9/5
(37)

Based on the code below, the statement that would move the file pointer to byte n counted from the beginning of the file is ___________________. RandomAccessFile test = new RandomAccessFile("record.bat", "r");

(Multiple Choice)
5.0/5
(39)

Caesar cipher uses a shift of each character by a key with a value between 1 and 255. An a with a shift equal to 3 becomes a d. For the decrypt method below, select the correct body. Assume the key shift property is accessible to the method. public int decrypt(int B) { ________ }

(Multiple Choice)
4.8/5
(44)

Which of the following reads binary data from a disk file?

(Multiple Choice)
4.9/5
(35)

If serializing object obj requires 12 bytes, how many bytes are required to serialize obj 3 times?

(Multiple Choice)
4.8/5
(39)

What is the result of the following code? Reader reader = … ; // connect to a file Char ch = reader.read();

(Multiple Choice)
4.8/5
(36)

You cannot read a(n) ____________________ file with a text editor.

(Multiple Choice)
4.8/5
(30)

Which of the following classes are related through inheritance? I InputStream II InputStreamReader III ObjectInputStream

(Multiple Choice)
4.8/5
(46)

How many bytes does the read method in the FileInputStream class actually return to the program call?

(Multiple Choice)
4.9/5
(28)

Objects are saved in ___________ format in object streams.

(Multiple Choice)
4.9/5
(34)

Why does FileInputStream override the read method from its superclass InputStream?

(Multiple Choice)
4.8/5
(32)

The two IO classes used for serialization are _______ and ________.

(Multiple Choice)
4.8/5
(41)
Showing 1 - 20 of 82
close modal

Filters

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