Deck 21: Advanced Inputoutputetext Only

ملء الشاشة (f)
exit full mode
سؤال
Which class is used for input of text data?
A.OutputStream
B.Writer
C.InputStream
D.Reader
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Which class is used for output of binary data to a file?
A.Writer
B.FileOutputStream
C.FileOutput
D.Scanner
سؤال
Which class is used for input of binary data from a file?
A.FileInput
B.FileInputStream
C.Scanner
D.Reader
سؤال
Fill in the blank in the following code snippet to create an object for reading binary data from a disk file, named input.bin?
try (______________________________)
{
Process input
}
A.FileReader in = new FileReader("input.bin");
B.FileWriter in = new FileWriter("input.bin");
C.PrintWriter in = new PrintWriter("input.bin");
D.FileInputStream in = new FileInputStream("input.bin");
سؤال
Which class is used for output of text data to a file?
A.FileWriter
B.FileOutputStream
C.PrintWriter
D.RandomAccessFile
سؤال
In text format, data items are represented in human-readable form, as a sequence of ____________________.
A.integers
B.strings
C.bytes
D.characters
سؤال
Which file storage method stores data in bytes?
A.binary
B.byte
C.text
D.object
سؤال
Which class is used for input of binary data?
A.OutputStream
B.Reader
C.InputStream
D.Writer
سؤال
Which class is used for input of text data from a file?
A.FileWriter
B.RandomAccessFile
C.FileInputStream
D.Scanner
سؤال
Which class is used for output of text data?
A.OutputStream
B.Reader
C.InputStream
D.Writer
سؤال
Streams access sequences of ____.
A.bytes
B.files
C.characters
D.strings
سؤال
Which class is used for output of binary data?
A.Reader
B.Writer
C.OutputStream
D.InputStream
سؤال
Which file storage method is in human-readable form?
A.byte
B.text
C.binary
D.object
سؤال
Which of these classes access sequences of characters?
I readers
II writers
III streams
A.II and III only
B.II only
C.I only
D.I and II only
سؤال
If you store information in binary form, as a sequence of bytes, you will use the ____ class(es) and their subclasses.
A.Reader and Writer
B.PrintWriter
C.Serializable
D.InputStream and OutputStream
سؤال
A byte is composed of ____ bits and can denote ____ values.
A.8, 256
B.4, 256
C.8, 1024
D.2, 19
سؤال
If you access and store information in binary form in files, you will use the ____ class(es).
A.Scanner and PrintWriter
B.PrintStream
C.FileInputStream and FileOutputStream
D.Reader and Writer
سؤال
The ______ method returns an integer, either -1 (at the end of the file) or a byte between 0 and 255.
A.InputStream.read
B.OutputStream.write
C.Reader.length
D.Scanner.next
سؤال
Readers and writers access sequences of ____.
A.bytes
B.files
C.streams
D.characters
سؤال
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
A.I and II only
B.I only
C.III only
D.I and III only
سؤال
How many bytes does the read method in the FileInputStream class get from the file?
A.1
B.8
C.4
D.2
سؤال
The values of the byte type range from ____ to ____.
A.-128, 127
B.0, 256
C.-128, 128
D.0, 255
سؤال
What is the lowest value for a signed (negative and positive) byte?
A.-128
B.-256
C.-255
D.-127
سؤال
Fill in the blank in the following code snippet to create an object for writing binary data to a disk file, named output.bin?
try (______________________________)
{
Process output
}
A.Writer out = new Writer("output.bin");
B.PrintWriter out = new PrintWriter("output.bin");
C.FileOutputStream out = new FileOutputStream("output.bin");
D.FileWriter out = new FileWriter("output.bin");
سؤال
A Caesar cipher uses a shift of each character by a key with a value between 1 and 255.An a with a shift of 3 becomes a d.A z with a shift of 3 would become a c, wrapping around the alphabet.Which key should you use to encrypt picture into mfzqrob?
A.19
B.-3
C.-19
D.3
سؤال
You would need a Caesar cipher with a shift of __________ to decrypt the text T U V W X Y Z A B C D E F G H I J K L M N O P Q R S so that it reads A B C D E F G H I J K L M N O P Q R S T U V W X Y Z.
A.19
B.7
C.-19
D.20
سؤال
Which statement is NOT correct about the OutputStream.write method?
A.The method writes an int (4 bytes) to the output stream.
B.The type of the parameter for the method is int.
C.The FileOutputStream class overrides the method to write a single byte to a file.
D.The value of the parameter must be between the values of 0 and 255.
سؤال
A Caesar cipher uses a shift of each character by a key with a value between 1 and 255.An a with a shift of 3 becomes a d.A z with a shift of 3 would become a c, wrapping around the alphabet.Which is the decryption of exmmv for a key = -3?
A.bujjs
B.atiir
C.cvkkt
D.happy
سؤال
A Caesar cipher uses a shift of each character by a key with a value between 1 and 255.An a with a shift of 3 becomes a d.A z with a shift of 3 would become a c, wrapping around the alphabet.Which is the encryption of shadow for a key = 3?
A.adowsha
B.vkdgrz
C.vjegrz
D.ukdgry
سؤال
A Caesar cipher uses a shift of each character by a key with a value between 1 and 255.An a with a shift of 3 becomes a d.For the encrypt method below, select the correct body.Assume the key shift property is accessible to the method.
public int encrypt(int b)
{
__________
}
A.return (b + key) % 256);
B.return (b + key % 26);
C.return (b + key);
D.return (b + 26 % key);
سؤال
Which class has a write method that writes a single byte?
A.Stream
B.PrintWriter
C.OutputStream
D.Writer
سؤال
What is the highest value for a signed (negative and positive) byte?
A.256
B.127
C.128
D.255
سؤال
In ____________ file access, the file is processed starting from the beginning.
A.binary
B.random
C.parallel
D.sequential
سؤال
In Java, the byte type is a(n) ____ type.
A.unsigned
B.positive
C.signed
D.negative
سؤال
What is returned by the read method when a FileInputStream has reached the end of the file?
A.0
B.-1
C.-2
D.'\n'
سؤال
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.For the decrypt method below, select the correct body.Assume the key shift property is accessible to the method.
public int decrypt(int b)
{
__________
}
A.return (b - key);
B.return (b + key);
C.return (b - key % 26);
D.return (b - key) % 256);
سؤال
Why does FileInputStream override the read method from its superclass InputStream?
A.In order to read binary data.
B.In order to return a char.
C.To check for end of file.
D.To read data from a file.
سؤال
A Caesar cipher uses a shift of each character by a key with a value between 1 and 255.An a with a shift of 3 becomes a d.A z with a shift of 3 would become a c, wrapping around the alphabet.Which is the encryption of picture for a key = -3?
A.mfzqrob
B.erutcip
C.urepict
D.ngahspc
سؤال
You cannot read a ____________________ file with a text editor.
A.serial
B.binary
C.random
D.sequential
سؤال
The read method of the FileInputStream class reads binary data.What type is actually returned from a call to read?
A.int
B.String
C.byte
D.char
سؤال
In which of the following modes can a RandomAccessFile be opened?
I r
II rw
III w
A.I and III only
B.I only
C.I and II only
D.II only
سؤال
Which code moves the file pointer to the middle of a RandomAccessFile object, file?
A.file.seek(file.getFilePointer() / 2)
B.file.seek(file.length() / 2)
C.file.seek(0L)
D.file.seek(file.length())
سؤال
Assume we have a RandomAccessFile object, file, which stores a set of records of class MyData, each needing MyData.RECORD_SIZE bytes for storage.If the file pointer is currently on the 24th record, which expression represents the offset to the beginning of the 25th record?
A.MyData.RECORD_SIZE * 2
B.MyData.RECORD_SIZE + file.getFilePointer()
C.MyData.RECORD_SIZE + 1
D.file.getFilePointer()
سؤال
Given a RandomAccessFile that stores a set of records of class MyData, each needing MyData.RECORD_SIZE bytes for storage, which expression gets the offset to the beginning of the 25th record?
A.MyData.RECORD_SIZE * 25
B.MyData.RECORD_SIZE + 25
C.MyData.RECORD_SIZE++
D.MyData.RECORD_SIZE * 24
سؤال
Which of the following classes are used with data in binary form?
I FileInputStream
II FileReader
III RandomAccessFile
A.I and III only
B.I and II only
C.II and III only
D.I only
سؤال
Which is NOT a method in the RandomAccessFile class?
A.seek
B.length
C.getFilePointer
D.scan
سؤال
__________ access allows file access at arbitrary locations, without first reading the bytes preceding the access location.
A.Sequential
B.Serial
C.Random
D.Binary
سؤال
Assume we have a RandomAccessFile object, file, which stores a set of records of class MyData, each needing MyData.RECORD_SIZE bytes for storage.Which expression calculates the number of records in the file?
A.MyData.RECORD_SIZE * file.length()
B.file.length() / MyData.RECORD_SIZE
C.MyData.RECORD_SIZE + file.getFilePointer()
D.file.seek(0L) / MyData.RECORD_SIZE
سؤال
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? 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?  <div style=padding-top: 35px>
سؤال
A file pointer is a position in a random access file.Because files can be very large, the file pointer is of type _______.
A.int
B.double
C.long
D.byte
سؤال
Assume we have a RandomAccessFile object, file, that 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 1st record, which code correctly modifies the 2nd record by changing its color to Color.red through the setColor method? Assume we have a RandomAccessFile object, file, that 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 1st record, which code correctly modifies the 2nd record by changing its color to Color.red through the setColor method?  <div style=padding-top: 35px>
سؤال
Which method in the RandomAccessFile class provides for random access?
A.goto
B.offset
C.seek
D.move
سؤال
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");
A.test.getFilePointer(n);
B.test.length() - n;
C.test.seek(n);
D.test.getFilePointer();
سؤال
The readInt and writeInt methods of the RandomAccessFile class read and write integers as ____ quantities.
A.two-byte
B.four-byte
C.eight-byte
D.six-byte
سؤال
When storing numbers in a file with fixed record sizes, it is easier to store them in __________ format.
A.character
B.binary
C.serializable
D.text
سؤال
The readDouble and writeDouble methods of the RandomAccessFile class, process double precision floating-point numbers as ____ quantities.
A.ten-byte
B.two-byte
C.four-byte
D.eight-byte
سؤال
Which statement about object streams is NOT correct?
A.Use object input streams to load the saved objects.
B.You must cast the returned result from the readObject method.
C.Any object can be saved to an object output stream.
D.Use object output streams to save all instance variables of an object automatically.
سؤال
What do we call the measure in bytes of the file pointer from the beginning of a RandomAccessFile?
A.size
B.seek
C.latency
D.offset
سؤال
Which is not a method available in the RandomAccessFile class?
A.readDouble
B.open
C.readInt
D.close
سؤال
Which method moves the file pointer in a RandomAccessFile?
A.close
B.seek
C.length
D.getFilePointer
سؤال
Which of the following cannot be serialized?
I ArrayList
II String
III Integer
A.I only
B.III only
C.II and III only
D.All can be serialized
سؤال
What type is returned from a call to the ObjectInputStream.readObject method when reading a String from an object stream?
A.String
B.ObjectStream
C.Object
D.char
سؤال
How many methods are required to implement the Serializable interface?
A.3
B.1
C.0
D.2
سؤال
Every object is assigned a serial number on the stream.What might be the result if the same object is saved twice?
A.A performance decrease.
B.Running out of serial numbers.
C.The object will have two serial numbers.
D.Only the serial number is written out the second time.
سؤال
Which interface allows classes to be written to an ObjectOutputStream?
A.Streaming
B.Serializable
C.Objectifiable
D.Objective
سؤال
In which package are the following types found: Path, Paths, Files?
A.java.io.file
B.java.nio
C.java.nio.file
D.java.io
سؤال
If serializing object obj requires 12 bytes, how many bytes are required to serialize obj 3 times?
A.12 bytes plus 3 serial numbers of obj
B.36 bytes
C.12 bytes
D.12 bytes plus 2 serial numbers of obj
سؤال
Which code reads an array of Student objects from a file named studentFile.bin? We ignore exceptions in this problem. Which code reads an array of Student objects from a file named studentFile.bin? We ignore exceptions in this problem.  <div style=padding-top: 35px>
سؤال
Fill in the blank in the following code snippet.
______ myVariable = Paths.get("filename.txt");
A.FileReader
B.File
C.Path
D.FileInputStream
سؤال
Which of the following classes are related through inheritance?
I InputStream
II InputStreamReader
III ObjectInputStream
A.I, II and III
B.I and III only
C.II and III only
D.I and II only
سؤال
What type of object describes the location of a file or directory?
A.Path
B.Paths
C.Files
D.Directories
سؤال
If we want to write objects to a file, what type of object should be passed to the ObjectOutputStream constructor?
A.FileOutputStream
B.ObjectStream
C.ObjectInputStream
D.FileStream
سؤال
Objects are saved in ___________ format in object streams.
A.integer
B.binary
C.stream
D.character
سؤال
Which code stores an array studentArray of Student objects in a file named studentFile.bin? We ignore exceptions in this problem. Which code stores an array studentArray of Student objects in a file named studentFile.bin? We ignore exceptions in this problem.  <div style=padding-top: 35px>
سؤال
Which of the following is NOT a method of the Path type?
A.walk
B.getParent
C.resolve
D.getFileName
سؤال
The two IO classes used for serialization are _______ and ________.
A.Reader, Writer
B.ObjectInputStream, ObjectOutputStream
C.FileReader, FileWriter
D.Scanner, PrintWriter
سؤال
Objects saved to an object stream must belong to classes that ______________.
A.implement the ObjectInputStream interface
B.are RandomAccessFile objects
C.implement the Serializable interface
D.are abstract
سؤال
Which expression returns a String representing the full path to the file filename.txt?
A.Paths.get("filename.txt")
B.Paths.get("filename.txt").toString()
C.Paths.get("filename.txt").toAbsolutePath()
D.Paths.get("filename.txt").toAbsolutePath().toString()
سؤال
Which methods are not in the Serializable interface?
I readObject
II writeObject
III serializeObject
A.II and III only
B.I, II, and III
C.I and II only
D.I only
سؤال
If you write a simple Student class, what must you do in order to write Student objects to an ObjectOutputStream?
A.Make all class variables primitive.
B.Implement Streamable.
C.Code a write method.
D.Implement Serializable.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/90
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 21: Advanced Inputoutputetext Only
1
Which class is used for input of text data?
A.OutputStream
B.Writer
C.InputStream
D.Reader
Reader
2
Which class is used for output of binary data to a file?
A.Writer
B.FileOutputStream
C.FileOutput
D.Scanner
FileOutputStream
3
Which class is used for input of binary data from a file?
A.FileInput
B.FileInputStream
C.Scanner
D.Reader
FileInputStream
4
Fill in the blank in the following code snippet to create an object for reading binary data from a disk file, named input.bin?
try (______________________________)
{
Process input
}
A.FileReader in = new FileReader("input.bin");
B.FileWriter in = new FileWriter("input.bin");
C.PrintWriter in = new PrintWriter("input.bin");
D.FileInputStream in = new FileInputStream("input.bin");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
5
Which class is used for output of text data to a file?
A.FileWriter
B.FileOutputStream
C.PrintWriter
D.RandomAccessFile
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
6
In text format, data items are represented in human-readable form, as a sequence of ____________________.
A.integers
B.strings
C.bytes
D.characters
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
7
Which file storage method stores data in bytes?
A.binary
B.byte
C.text
D.object
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
8
Which class is used for input of binary data?
A.OutputStream
B.Reader
C.InputStream
D.Writer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
9
Which class is used for input of text data from a file?
A.FileWriter
B.RandomAccessFile
C.FileInputStream
D.Scanner
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
10
Which class is used for output of text data?
A.OutputStream
B.Reader
C.InputStream
D.Writer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
11
Streams access sequences of ____.
A.bytes
B.files
C.characters
D.strings
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
12
Which class is used for output of binary data?
A.Reader
B.Writer
C.OutputStream
D.InputStream
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
13
Which file storage method is in human-readable form?
A.byte
B.text
C.binary
D.object
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
14
Which of these classes access sequences of characters?
I readers
II writers
III streams
A.II and III only
B.II only
C.I only
D.I and II only
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
15
If you store information in binary form, as a sequence of bytes, you will use the ____ class(es) and their subclasses.
A.Reader and Writer
B.PrintWriter
C.Serializable
D.InputStream and OutputStream
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
16
A byte is composed of ____ bits and can denote ____ values.
A.8, 256
B.4, 256
C.8, 1024
D.2, 19
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
17
If you access and store information in binary form in files, you will use the ____ class(es).
A.Scanner and PrintWriter
B.PrintStream
C.FileInputStream and FileOutputStream
D.Reader and Writer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
18
The ______ method returns an integer, either -1 (at the end of the file) or a byte between 0 and 255.
A.InputStream.read
B.OutputStream.write
C.Reader.length
D.Scanner.next
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
19
Readers and writers access sequences of ____.
A.bytes
B.files
C.streams
D.characters
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
20
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
A.I and II only
B.I only
C.III only
D.I and III only
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
21
How many bytes does the read method in the FileInputStream class get from the file?
A.1
B.8
C.4
D.2
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
22
The values of the byte type range from ____ to ____.
A.-128, 127
B.0, 256
C.-128, 128
D.0, 255
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
23
What is the lowest value for a signed (negative and positive) byte?
A.-128
B.-256
C.-255
D.-127
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
24
Fill in the blank in the following code snippet to create an object for writing binary data to a disk file, named output.bin?
try (______________________________)
{
Process output
}
A.Writer out = new Writer("output.bin");
B.PrintWriter out = new PrintWriter("output.bin");
C.FileOutputStream out = new FileOutputStream("output.bin");
D.FileWriter out = new FileWriter("output.bin");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
25
A Caesar cipher uses a shift of each character by a key with a value between 1 and 255.An a with a shift of 3 becomes a d.A z with a shift of 3 would become a c, wrapping around the alphabet.Which key should you use to encrypt picture into mfzqrob?
A.19
B.-3
C.-19
D.3
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
26
You would need a Caesar cipher with a shift of __________ to decrypt the text T U V W X Y Z A B C D E F G H I J K L M N O P Q R S so that it reads A B C D E F G H I J K L M N O P Q R S T U V W X Y Z.
A.19
B.7
C.-19
D.20
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
27
Which statement is NOT correct about the OutputStream.write method?
A.The method writes an int (4 bytes) to the output stream.
B.The type of the parameter for the method is int.
C.The FileOutputStream class overrides the method to write a single byte to a file.
D.The value of the parameter must be between the values of 0 and 255.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
28
A Caesar cipher uses a shift of each character by a key with a value between 1 and 255.An a with a shift of 3 becomes a d.A z with a shift of 3 would become a c, wrapping around the alphabet.Which is the decryption of exmmv for a key = -3?
A.bujjs
B.atiir
C.cvkkt
D.happy
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
29
A Caesar cipher uses a shift of each character by a key with a value between 1 and 255.An a with a shift of 3 becomes a d.A z with a shift of 3 would become a c, wrapping around the alphabet.Which is the encryption of shadow for a key = 3?
A.adowsha
B.vkdgrz
C.vjegrz
D.ukdgry
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
30
A Caesar cipher uses a shift of each character by a key with a value between 1 and 255.An a with a shift of 3 becomes a d.For the encrypt method below, select the correct body.Assume the key shift property is accessible to the method.
public int encrypt(int b)
{
__________
}
A.return (b + key) % 256);
B.return (b + key % 26);
C.return (b + key);
D.return (b + 26 % key);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which class has a write method that writes a single byte?
A.Stream
B.PrintWriter
C.OutputStream
D.Writer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
32
What is the highest value for a signed (negative and positive) byte?
A.256
B.127
C.128
D.255
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
33
In ____________ file access, the file is processed starting from the beginning.
A.binary
B.random
C.parallel
D.sequential
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
34
In Java, the byte type is a(n) ____ type.
A.unsigned
B.positive
C.signed
D.negative
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
35
What is returned by the read method when a FileInputStream has reached the end of the file?
A.0
B.-1
C.-2
D.'\n'
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
36
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.For the decrypt method below, select the correct body.Assume the key shift property is accessible to the method.
public int decrypt(int b)
{
__________
}
A.return (b - key);
B.return (b + key);
C.return (b - key % 26);
D.return (b - key) % 256);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
37
Why does FileInputStream override the read method from its superclass InputStream?
A.In order to read binary data.
B.In order to return a char.
C.To check for end of file.
D.To read data from a file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
38
A Caesar cipher uses a shift of each character by a key with a value between 1 and 255.An a with a shift of 3 becomes a d.A z with a shift of 3 would become a c, wrapping around the alphabet.Which is the encryption of picture for a key = -3?
A.mfzqrob
B.erutcip
C.urepict
D.ngahspc
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
39
You cannot read a ____________________ file with a text editor.
A.serial
B.binary
C.random
D.sequential
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
40
The read method of the FileInputStream class reads binary data.What type is actually returned from a call to read?
A.int
B.String
C.byte
D.char
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
41
In which of the following modes can a RandomAccessFile be opened?
I r
II rw
III w
A.I and III only
B.I only
C.I and II only
D.II only
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
42
Which code moves the file pointer to the middle of a RandomAccessFile object, file?
A.file.seek(file.getFilePointer() / 2)
B.file.seek(file.length() / 2)
C.file.seek(0L)
D.file.seek(file.length())
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
43
Assume we have a RandomAccessFile object, file, which stores a set of records of class MyData, each needing MyData.RECORD_SIZE bytes for storage.If the file pointer is currently on the 24th record, which expression represents the offset to the beginning of the 25th record?
A.MyData.RECORD_SIZE * 2
B.MyData.RECORD_SIZE + file.getFilePointer()
C.MyData.RECORD_SIZE + 1
D.file.getFilePointer()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
44
Given a RandomAccessFile that stores a set of records of class MyData, each needing MyData.RECORD_SIZE bytes for storage, which expression gets the offset to the beginning of the 25th record?
A.MyData.RECORD_SIZE * 25
B.MyData.RECORD_SIZE + 25
C.MyData.RECORD_SIZE++
D.MyData.RECORD_SIZE * 24
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
45
Which of the following classes are used with data in binary form?
I FileInputStream
II FileReader
III RandomAccessFile
A.I and III only
B.I and II only
C.II and III only
D.I only
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
46
Which is NOT a method in the RandomAccessFile class?
A.seek
B.length
C.getFilePointer
D.scan
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
47
__________ access allows file access at arbitrary locations, without first reading the bytes preceding the access location.
A.Sequential
B.Serial
C.Random
D.Binary
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
48
Assume we have a RandomAccessFile object, file, which stores a set of records of class MyData, each needing MyData.RECORD_SIZE bytes for storage.Which expression calculates the number of records in the file?
A.MyData.RECORD_SIZE * file.length()
B.file.length() / MyData.RECORD_SIZE
C.MyData.RECORD_SIZE + file.getFilePointer()
D.file.seek(0L) / MyData.RECORD_SIZE
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
49
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? 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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
50
A file pointer is a position in a random access file.Because files can be very large, the file pointer is of type _______.
A.int
B.double
C.long
D.byte
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
51
Assume we have a RandomAccessFile object, file, that 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 1st record, which code correctly modifies the 2nd record by changing its color to Color.red through the setColor method? Assume we have a RandomAccessFile object, file, that 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 1st record, which code correctly modifies the 2nd record by changing its color to Color.red through the setColor method?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
52
Which method in the RandomAccessFile class provides for random access?
A.goto
B.offset
C.seek
D.move
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
53
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");
A.test.getFilePointer(n);
B.test.length() - n;
C.test.seek(n);
D.test.getFilePointer();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
54
The readInt and writeInt methods of the RandomAccessFile class read and write integers as ____ quantities.
A.two-byte
B.four-byte
C.eight-byte
D.six-byte
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
55
When storing numbers in a file with fixed record sizes, it is easier to store them in __________ format.
A.character
B.binary
C.serializable
D.text
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
56
The readDouble and writeDouble methods of the RandomAccessFile class, process double precision floating-point numbers as ____ quantities.
A.ten-byte
B.two-byte
C.four-byte
D.eight-byte
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
57
Which statement about object streams is NOT correct?
A.Use object input streams to load the saved objects.
B.You must cast the returned result from the readObject method.
C.Any object can be saved to an object output stream.
D.Use object output streams to save all instance variables of an object automatically.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
58
What do we call the measure in bytes of the file pointer from the beginning of a RandomAccessFile?
A.size
B.seek
C.latency
D.offset
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
59
Which is not a method available in the RandomAccessFile class?
A.readDouble
B.open
C.readInt
D.close
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
60
Which method moves the file pointer in a RandomAccessFile?
A.close
B.seek
C.length
D.getFilePointer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
61
Which of the following cannot be serialized?
I ArrayList
II String
III Integer
A.I only
B.III only
C.II and III only
D.All can be serialized
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
62
What type is returned from a call to the ObjectInputStream.readObject method when reading a String from an object stream?
A.String
B.ObjectStream
C.Object
D.char
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
63
How many methods are required to implement the Serializable interface?
A.3
B.1
C.0
D.2
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
64
Every object is assigned a serial number on the stream.What might be the result if the same object is saved twice?
A.A performance decrease.
B.Running out of serial numbers.
C.The object will have two serial numbers.
D.Only the serial number is written out the second time.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
65
Which interface allows classes to be written to an ObjectOutputStream?
A.Streaming
B.Serializable
C.Objectifiable
D.Objective
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
66
In which package are the following types found: Path, Paths, Files?
A.java.io.file
B.java.nio
C.java.nio.file
D.java.io
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
67
If serializing object obj requires 12 bytes, how many bytes are required to serialize obj 3 times?
A.12 bytes plus 3 serial numbers of obj
B.36 bytes
C.12 bytes
D.12 bytes plus 2 serial numbers of obj
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
68
Which code reads an array of Student objects from a file named studentFile.bin? We ignore exceptions in this problem. Which code reads an array of Student objects from a file named studentFile.bin? We ignore exceptions in this problem.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
69
Fill in the blank in the following code snippet.
______ myVariable = Paths.get("filename.txt");
A.FileReader
B.File
C.Path
D.FileInputStream
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
70
Which of the following classes are related through inheritance?
I InputStream
II InputStreamReader
III ObjectInputStream
A.I, II and III
B.I and III only
C.II and III only
D.I and II only
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
71
What type of object describes the location of a file or directory?
A.Path
B.Paths
C.Files
D.Directories
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
72
If we want to write objects to a file, what type of object should be passed to the ObjectOutputStream constructor?
A.FileOutputStream
B.ObjectStream
C.ObjectInputStream
D.FileStream
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
73
Objects are saved in ___________ format in object streams.
A.integer
B.binary
C.stream
D.character
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
74
Which code stores an array studentArray of Student objects in a file named studentFile.bin? We ignore exceptions in this problem. Which code stores an array studentArray of Student objects in a file named studentFile.bin? We ignore exceptions in this problem.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
75
Which of the following is NOT a method of the Path type?
A.walk
B.getParent
C.resolve
D.getFileName
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
76
The two IO classes used for serialization are _______ and ________.
A.Reader, Writer
B.ObjectInputStream, ObjectOutputStream
C.FileReader, FileWriter
D.Scanner, PrintWriter
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
77
Objects saved to an object stream must belong to classes that ______________.
A.implement the ObjectInputStream interface
B.are RandomAccessFile objects
C.implement the Serializable interface
D.are abstract
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
78
Which expression returns a String representing the full path to the file filename.txt?
A.Paths.get("filename.txt")
B.Paths.get("filename.txt").toString()
C.Paths.get("filename.txt").toAbsolutePath()
D.Paths.get("filename.txt").toAbsolutePath().toString()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
79
Which methods are not in the Serializable interface?
I readObject
II writeObject
III serializeObject
A.II and III only
B.I, II, and III
C.I and II only
D.I only
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
80
If you write a simple Student class, what must you do in order to write Student objects to an ObjectOutputStream?
A.Make all class variables primitive.
B.Implement Streamable.
C.Code a write method.
D.Implement Serializable.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 90 في هذه المجموعة.