Questions And 100% Well Answered
Solutions.
With the DataInputStream class:
a) the read method can only read one character at a time.
b) the read method can read only one record at a time.
c) the read method can read more than one record at a time.
d) the read method can read only one field at a time. - Answer D
Which of the following is true?
a) You open a file by creating the appropriate object.
b) You close a file by deleting the appropriate object.
c) Two of these answers are correct.
d) The DataOutputStream class is used to write to a printer.
e) The BufferedInputStream class is used to read characters from a file. - Answer A
An object of the File class is required
a) in order to read data from or write data to files.
b) in order to get information about files.
,d) in order to write data to but NOT read data from files.
e) two of these answers are correct. - Answer B
With the following code:
filePosition = employeeID%100;
employeeFile.seek(filePosition * RECORDSIZE);
a) The maximum random access record size is 100 characters.
b) The maximum number of random access records depends on the values of filePosition and
RECORDSIZE.
c) The maximum number of random access records depends on the value of RECORDSIZE.
d) The maximum number of random access records is 100.
e) The maximum number of random access records cannot be determined with this code. -
Answer D
How many records will be written to the newMasterFile?
a) Cannot calculate this based on the code.
b) The same as that in the oldMasterFile.
c) An amount equal to that in the oldMasterFile plus the transaction file.
d) The same as that in the transactionFile. - Answer B
How many fields are there in each transactionFile record?
, c) There are one to three fields, depending on the record.
d) There are zero to two fields. - Answer B
What would happen if you replaced
payRate = oldMasterFile.readFloat();
ytdGrossPay = oldMasterFile.readFloat();
with
ytdGrossPay = oldMasterFile.readFloat();
payRate = oldMasterFile.readFloat();
a) Everything would work OK.
b) There would be a compile error.
c) The program would run but calculations would be wrong.
d) The program would stop with an error when
ytdGrossPay = oldMasterFile.readFloat(); was executed - Answer C
If you opened the oldMasterFile in TextPad, which fields would you be able to understand?
a) payRate and ytdGrossPay only
b) you would not be able to understand any fields.
c) oldMastKey and address only.
d) All fields - Answer C