Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

QUESTION 11 Which of the following statements enables you to write output to a t

ID: 3821373 • Letter: Q

Question

QUESTION 11

Which of the following statements enables you to write output to a text file?

PrintWriter out = new PrintWriter();

PrintWriter out = new PrintWriter("output.txt");

FileReader reader = new FileReader("input.txt");

Scanner in = new Scanner(reader);

QUESTION 12

Which of the following cannot be serialized?

I ArrayList<String>

II String

III  Integer

I

II and III

III

All can be serialized

QUESTION 13

Which method in the RandomAccessFile class provides for random access?

move

seek

goto

offset

QUESTION 14

Which code moves the file pointer to the middle of a RandomAccessFile object, file?

file.seek(file.length() / 2)

file.seek(file.length())

file.seek(0L)

file.seek(file.getFilePointer() / 2)

QUESTION 15

Which is an advantage of storing numbers in binary format?

I fast access

II less storage needed

III easy to read in a text editor

I

III

I and II

I and III

QUESTION 16

A file pointer is a position in a random access file. Because files can be very large,

the file pointer is of type _______.

double

byte

int

long

QUESTION 17

Which is not a method in the RandomAccessFile class?

getFilePointer

seek

scan

length

QUESTION 18

If you want to process text data from a file, which keyword do you look for in classes that specialize in doing that?

text

serializable

binary

reader

QUESTION 19

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 key should you use to encrypt picture into mfzqrob?

3

19

-3

-19

QUESTION 20

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

1

2

4

8

PrintWriter out = new PrintWriter();

PrintWriter out = new PrintWriter("output.txt");

FileReader reader = new FileReader("input.txt");

Scanner in = new Scanner(reader);

Explanation / Answer

11.

Statement enables you to write output to a text file

Syntax :

PrintWriter out = new PrintWriter("output.txt");

Where output.txt name of the file.

Option 2 is correct choice.

12.

I ArrayList<String>

II String

III  Integer

All can be serialized

Option 4 is correct choice.

13.

seek method in the RandomAccessFile class provides for random access.

Option 2 is correct choice.

14.

file.seek(file.length() / 2) code moves the file pointer to the middle of a RandomAccessFile object.

Option 1 is correct choice.

15.

Advantage of storing numbers in binary format :

Option 4 is correct choice.

16.

A file pointer is a position in a random access file. Because files can be very large,

the file pointer is of type long.

Option 4 is correct choice.

17.

scan not a method in the RandomAccessFile class.

18.

serializable keyword do process text data from a file.

Option 2 is correct choice.

19.

encryption of picture for a key = -3 use to encrypt picture into mfzqrob.

Option 3 is correct choice.

20.

read method in the InputStream class actually return one byte to the program call.

Option 1 is correct choice.

seek method in the RandomAccessFile class provides for random access.

Option 2 is correct choice.

14.

file.seek(file.length() / 2) code moves the file pointer to the middle of a RandomAccessFile object.

Option 1 is correct choice.

15.

Advantage of storing numbers in binary format :

  • fast access
  • easy to read in a text editor

Option 4 is correct choice.

16.

A file pointer is a position in a random access file. Because files can be very large,

the file pointer is of type long.

Option 4 is correct choice.

17.

scan not a method in the RandomAccessFile class.

18.

serializable keyword do process text data from a file.

Option 2 is correct choice.

19.

encryption of picture for a key = -3 use to encrypt picture into mfzqrob.

Option 3 is correct choice.

20.

read method in the InputStream class actually return one byte to the program call.

Option 1 is correct choice.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote