Question
QUESTION 1 What is returned by the read method when a FileInputStream has reached the end of the file? -1 -2 0 1 points QUESTION
QUESTION 1
What is returned by the read method when a FileInputStream has reached the end of the file?
-1 | ||
-2 | ||
| ||
0 |
1 points
QUESTION 2
The two IO classes used for serialization are _______ and ________.
Reader, Writer | ||
ObjectInputStream, ObjectOutputStream | ||
Scanner, PrintWriter | ||
FileReader, FileWriter |
1 points
QUESTION 3
In Java, you use a(n) ____________ object to access a file and move its file pointer.
Stream | ||
Serializable | ||
SequentialAccessFile | ||
RandomAccessFile |
1 points
QUESTION 4
What type is returned from a call to the ObjectInputStream.readObject method when reading a String from an object stream?
Object | ||
String | ||
char | ||
ObjectStream |
1 points
QUESTION 5
If serializing object obj requires 12 bytes, how many bytes are required to serialize obj 3 times?
12 bytes plus 3 serial numbers of obj | ||
36 bytes | ||
12 bytes | ||
12 bytes plus 2 serial numbers of obj |
1 points
QUESTION 6
Which code stores an array buttonArray of JButton objects in a file named buttonFile? We ignore exceptions in this problem.
ObjectStream os = new ObjectStream(new FileStream("buttonFile"); os.writeObject(buttonArray); | ||
ObjectOutputStream oos = new ObjectOutputStream( new FileOutputStream("buttonFile"); oos.writeObject(buttonArray); | ||
ObjectOutputStream oos = new ObjectOutputStream( new FileOutputStream("buttonFile"); oos.writeObject(buttonArray[0]); | ||
ObjectOutputStream oos = new ObjectOutputStream("buttonFile"); oos.writeObject(buttonArray); |
1 points
QUESTION 7
How many bytes does the read method in the InputStream class actually return to the program call?
1 | ||
2 | ||
4 | ||
8 |
1 points
QUESTION 8
Which is not a method available in the RandomAccessFile class?
open | ||
readInt | ||
readDouble | ||
close |
1 points
QUESTION 9
Which file storage method stores data in bytes?
binary | ||
object | ||
text | ||
byte |
1 points
QUESTION 10
When constructing a Scanner from a File object, the Scanner automatically constructs a ___________.
InputStream | ||
FileInputStream | ||
FileReader | ||
PrintWriter |
1 points
QUESTION 11
The ______ method returns an integer, either -1 (at the end of the file) or a byte between 0 and 255.
RandomAccessFile.seek | ||
InputStream.read | ||
Scanner.next | ||
Reader.length |
1 points
QUESTION 12
How many bytes does the read method in the FileInputStream class actually return to the program call?
1 | ||
2 | ||
4 | ||
8 |
1 points
QUESTION 13
In which package are most classes for file processing found?
java.file | ||
java.inputoutput | ||
java.io | ||
java.stream |
1 points
QUESTION 14
What is the lowest value for a signed (negative and positive) byte?
-127 | ||
-128 | ||
-255 | ||
-256 |
1 points
QUESTION 15
Why does FileInputStream override the read method from its superclass InputStream?
In order to return a char. | ||
In order to read binary data. | ||
To read data from a file. | ||
To check for end of file. |
1 points
QUESTION 16
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. A z would become a c, wrapping around the alphabet.Which is the decryption of exmmv for a key = -3?
cvkkt | ||
atiir | ||
bujjs | ||
happy |
1 points
QUESTION 17
Which of the following classes are related through inheritance?
I InputStream
II InputStreamReader
III ObjectInputStream
I and II | ||
I and III | ||
II and III | ||
I, II and III |
1 points
QUESTION 18
Which method in the RandomAccessFile class provides for random access?
move | ||
seek | ||
goto | ||
offset |
1 points
QUESTION 19
Which of the following reads binary data from a disk file?
PrintWriter text = new PrintWriter("input.bin"); | ||
FileReader text = new FileReader("input.bin"); | ||
FileInputStream inputStream = new FileInputStream("input.bin"); | ||
FileWriter text = new FileWriter("input.bin"); |
1 points
QUESTION 20
Which interface allows classes to be written to an ObjectOutputStream?
Objective | ||
Streaming | ||
Serializable | ||
Objectifiable |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started