Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 1 Caesar cipher uses a shift of each character by a key with a value between 1 and 255. An a with a shift

QUESTION 1

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 encryption of shadow for a key = 3?

ukdgry

vkdgrz

adowsha

vjegrz

QUESTION 2

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

1

2

4

8

QUESTION 3

If you write a simple Student class, what must you do in order to write Student objects to an ObjectOutputStream?

Code a write method.

Make all class variables primitive.

Implement Serializable.

Implement Streamable.

QUESTION 4

Use a ____ object to access a file and move a file pointer.

Random

RandomAccess

RandomAccessFile

System.in

QUESTION 5

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); 

QUESTION 6

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"); 

test.getFilePointer(n);

test.getFilePointer();

test.seek(n);

test.length() n;

QUESTION 7

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?

myData.read(file); 
myData.setColor(Color.yellow); 
myData.write(file); 
myData.read(file); 
myData.setColor(Color.yellow); 
file.seek(file.getFilePointer()); 
myData.write(file); 
myData.read(file); 
myData.setColor(Color.yellow); 
file.seek(file.getFilePointer() + MyData.RECORD_SIZE); 
myData.write(file); 
long loc = file.getFilePointer(); 
myData.read(file); 
myData.setColor(Color.yellow); 
file.seek(loc); 
myData.write(file); 

QUESTION 8

Every object is assigned a serial number on the stream. What might be the result if the same object is saved twice?

The object will have two serial numbers.

Only the serial number is written out the second time.

A performance decrease.

Running out of serial numbers.

QUESTION 9

Objects saved to an object stream must belong to classes that:

implement the Serializable interface.

are RandomAccessFile objects.

are abstract.

implement the ObjectInputStream interface.

QUESTION 10

Which file storage method is in human-readable form?

binary

object

text

byte

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions