Exam 20: Streams and Binary Inputoutput
Exam 1: Introduction98 Questions
Exam 2: Using Objects76 Questions
Exam 3: Implementing Classes103 Questions
Exam 4: Fundamental Data Types125 Questions
Exam 5: Decisions120 Questions
Exam 6: Loops128 Questions
Exam 7: Arrays and Array Lists118 Questions
Exam 8: Designing Classes95 Questions
Exam 9: Inheritance101 Questions
Exam 10: Interfaces85 Questions
Exam 11: Inputoutput and Exception Handling109 Questions
Exam 12: Object-Oriented Design104 Questions
Exam 13: Recursion110 Questions
Exam 14: Sorting and Searching109 Questions
Exam 15: The Java Collections Framework110 Questions
Exam 16: Basic Data Structures104 Questions
Exam 17: Tree Structures110 Questions
Exam 18: Generic Classes75 Questions
Exam 19: Graphical User Interfaces76 Questions
Exam 20: Streams and Binary Inputoutput82 Questions
Exam 21: Multithreading82 Questions
Exam 22: Internet Networking74 Questions
Exam 23: Relational Databases75 Questions
Exam 24: XML74 Questions
Exam 25: Web Applications75 Questions
Select questions type
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:
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:
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:
A
Which of the following cannot be serialized?
I ArrayList<String>
II String
III Integer
(Multiple Choice)
4.7/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)
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)
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)
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
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)