Multiple Choice
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?
A) myData.read(file) ;
MyData.setColor(Color.yellow) ;
MyData.write(file) ;
B) myData.read(file) ;
MyData.setColor(Color.yellow) ;
File.seek(file.getFilePointer() ) ;
MyData.write(file) ;
C) myData.read(file) ;
MyData.setColor(Color.yellow) ;
File.seek(file.getFilePointer() + MyData.RECORD_SIZE) ;
MyData.write(file) ;
D) long loc = file.getFilePointer() ;
MyData.read(file) ;
MyData.setColor(Color.yellow) ;
File.seek(loc) ;
MyData.write(file) ;
Correct Answer:

Verified
Correct Answer:
Verified
Q1: You use _ and FileOutputStream objects to
Q2: Which line completes this code fragment to
Q3: The FileInputStream read method reads binary data.
Q4: Which of the following cannot be serialized?<br>I
Q5: Which file storage method is in human-readable
Q7: The _ class is used when writing
Q8: What is the highest value for a
Q9: How many bytes does the read method
Q10: Based on the code below, the statement
Q11: Caesar cipher uses a shift of each