Deck 10: File IO
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/46
العب
ملء الشاشة (f)
Deck 10: File IO
1
The method _________ reads a single character from an input stream.
(a)readLine()
(b)skip()
(c)read()
(d)close()
(a)readLine()
(b)skip()
(c)read()
(d)close()
C
2
The read()method of the class RandomAccessFile returns the type:
(a)byte
(b)int
(c)char
(d)double
(a)byte
(b)int
(c)char
(d)double
B
3
All of the following are methods of the File class except:
(a)exists()
(b)delete()
(c)getDirectory()
(d)getName()
(a)exists()
(b)delete()
(c)getDirectory()
(d)getName()
C
4
Every input file and every output file used by your program has only one name which is the same name used by the operating system.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
5
A stream is an object that allows for the flow of data between your program and some I/O device or some file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
6
In Java,when you open a text file you should account for a possible:
(a)FileNotFoundException
(b)FileFullException
(c)FileNotReadyException
(d)all of the above
(a)FileNotFoundException
(b)FileFullException
(c)FileNotReadyException
(d)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
7
The stream that is automatically available to your Java code is:
(a)System.out
(b)System.in
(c)System.err
(d)all of the above
(a)System.out
(b)System.in
(c)System.err
(d)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
8
An ___________ allows data to flow into your program.
(a)input stream
(b)output stream
(c)file name
(d)all of the above
(a)input stream
(b)output stream
(c)file name
(d)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
9
Files whose contents must be handled as sequences of binary digits are called:
(a)text files
(b)ASCII files
(c)binary files
(d)output files
(a)text files
(b)ASCII files
(c)binary files
(d)output files
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
10
The class ObjectInputStream contains all of the following methods except:
(a)readLine()
(b)readChar()
(c)readObject()
(d)readInt()
(a)readLine()
(b)readChar()
(c)readObject()
(d)readInt()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
11
The scanner class has a series of methods that checks to see if there is any more well-formed input of the appropriate type.These methods are called __________ methods:
(a)nextToken
(b)hasNext
(c)getNext
(d)testNext
(a)nextToken
(b)hasNext
(c)getNext
(d)testNext
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
12
The class ObjectOutputStream contains all of the following methods except:
(a)writeInt()
(b)writeChar()
(c)writeDouble()
(d)println()
(a)writeInt()
(b)writeChar()
(c)writeDouble()
(d)println()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
13
A __________ path name gives the path to a file,starting with the directory that the program is in.
(a)relative
(b)descendant
(c)full
(d)complete
(a)relative
(b)descendant
(c)full
(d)complete
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
14
The FileNotFoundException is a descendant of the class IOException.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
15
An ____________ allows data to flow from your program.
(a)input stream
(b)output stream
(c)file name
(d)all of the above
(a)input stream
(b)output stream
(c)file name
(d)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
16
All of the following are methods of the Scanner class except:
(a)nextFloat()
(b)next()
(c)useDelimiter()
(d)readLine()
(a)nextFloat()
(b)next()
(c)useDelimiter()
(d)readLine()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
17
The method __________ from the File class forces a physical write to the file of any data that is buffered.
(a)close()
(b)flush()
(c)writeUTF()
(d)writeObject()
(a)close()
(b)flush()
(c)writeUTF()
(d)writeObject()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
18
The output stream connected to the computer screen is:
(a)System.exit
(b)System.quit
(c)System.in
(d)System.out
(a)System.exit
(b)System.quit
(c)System.in
(d)System.out
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
19
There are two common classes used for reading from a text file.They are:
(a)PrintWriter and BufferedReader
(b)FileInputStream and Scanner
(c)BufferedReader and Scanner
(d)None of the above
(a)PrintWriter and BufferedReader
(b)FileInputStream and Scanner
(c)BufferedReader and Scanner
(d)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
20
When the method readLine()tries to read beyond the end of a file,it returns the value of:
(a)1
(b)-1
(c)null
(d)none of the above
(a)1
(b)-1
(c)null
(d)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
21
Write a Java statement that creates an output stream to append data to a file named autos.txt.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
22
Write a Java statement to create and open an output stream to a file named autos.txt.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
23
The File class contains methods that allow you to check various properties of a file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
24
When your program is finished writing to a file,it should close the stream connected to that file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
25
Using BufferedReader to read integers from a file requires the String input to be parsed to an integer type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
26
Use the output stream to the file autos.txt created above in number 2 to write the line "Mercedes" to the file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
27
Write a Java statement that creates an output stream to a binary file named statistics.dat.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
28
The preferred stream classes for processing binary files are ObjectInputStream and ObjectOutputStream.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
29
Write a Java statement to create an input stream to a file named autos.txt.Use the BufferedReader class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
30
Create try and catch block that opens a file named statistics.txt for output.Writes the integers 24,55,and 76 to the file,and then closes the file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
31
Only the classes provided for file output contain a method named close.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
32
Binary files store data in the same format that is used by any common text editor.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
33
Write a Java method that returns a String representing a file name entered by the user.Use the BufferedReader class to obtain input.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
34
A full path name gives a complete path name,starting from the directory the program is in.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
35
Binary files can be handled more efficiently than text files.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
36
The methods of the scanner class do not behave the same when reading from a text file as they do when used to read from the keyboard.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
37
Write a complete Java program using a BufferedReader object that opens a file named autos.txt and displays each line to the screen.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
38
Explain the differences between a text file,an ASCII file and a binary file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
39
What happens when the method close is invoked on a stream?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
40
Explain what happens when an output file is opened in Java.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
41
Write a Java statement to create an input stream to a file named "statistics.dat".
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
42
Write a Java statement that creates a stream that provides read/write access to the file named autos.txt.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
43
Write a Java statement to create an input stream to the binary file statistics.dat.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
44
Write a complete Java program using a Scanner object that opens a file named autos.txt and displays each line to the screen.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
45
Use the output stream created in number 11 above to write the String BBC to the file named statistics.dat.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
46
Write a complete Java program that opens a binary file containing integers and displays the contents to the screen.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck