Deck 10: File IO

ملء الشاشة (f)
exit full mode
سؤال
The output stream connected to the computer screen is:

A)System.exit
B)System.quit
C)System.in
D)System.out
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
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
سؤال
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)
سؤال
All of the following are methods of the File class except:

A)exists)
B)delete)
C)getDirectory)
D)getName)
سؤال
The class ObjectOutputStream contains all of the following methods except:

A)writeInt)
B)writeChar)
C)writeDouble)
D)println)
سؤال
A stream is an object that allows for the flow of data between your program and some I/O device or some file.
سؤال
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
سؤال
The class ObjectInputStream contains all of the following methods except:

A)readLine)
B)readChar)
C)readObject)
D)readInt)
سؤال
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
سؤال
The FileNotFoundException is a descendant of the class IOException.
سؤال
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.
سؤال
An ____________ allows data to flow from your program.

A)input stream
B)output stream
C)file name
D)all of the above
سؤال
The method _________ reads a single character from an input stream.

A)readLine)
B)skip)
C)read)
D)close)
سؤال
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
سؤال
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
سؤال
The read)method of the class RandomAccessFile returns the type:

A)byte
B)int
C)char
D)double
سؤال
An ___________ allows data to flow into your program.

A)input stream
B)output stream
C)file name
D)all of the above
سؤال
All of the following are methods of the Scanner class except:

A)nextFloat)
B)next)
C)useDelimiter)
D)readLine)
سؤال
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
سؤال
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
سؤال
The File class contains methods that allow you to check various properties of a file.
سؤال
Write a Java method that returns a String representing a file name entered by the user.Use the BufferedReader class to obtain input.
سؤال
Only the classes provided for file output contain a method named close.
سؤال
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.
سؤال
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.
سؤال
The preferred stream classes for processing binary files are ObjectInputStream and ObjectOutputStream.
سؤال
Write a Java statement to create and open an output stream to a file named autos.txt.
سؤال
Using BufferedReader to read integers from a file requires the String input to be parsed to an integer type.
سؤال
Binary files can be handled more efficiently than text files.
سؤال
Binary files store data in the same format that is used by any common text editor.
سؤال
When your program is finished writing to a file,it should close the stream connected to that file.
سؤال
Write a Java statement that creates an output stream to append data to a file named autos.txt.
سؤال
Write a Java statement to create an input stream to a file named autos.txt.Use the BufferedReader class.
سؤال
Use the output stream to the file autos.txt created above in number 2 to write the line "Mercedes" to the file.
سؤال
A full path name gives a complete path name,starting from the directory the program is in.
سؤال
Write a Java statement that creates an output stream to a binary file named statistics.dat.
سؤال
Explain the differences between a text file,an ASCII file and a binary file.
سؤال
Explain what happens when an output file is opened in Java.
سؤال
Write a complete Java program using a BufferedReader object that opens a file named autos.txt and displays each line to the screen.
سؤال
What happens when the method close is invoked on a stream?
سؤال
Write a complete Java program using a Scanner object that opens a file named autos.txt and displays each line to the screen.
سؤال
Write a Java statement to create an input stream to the binary file statistics.dat.
سؤال
Write a Java statement to create an input stream to a file named "statistics.dat".
سؤال
Write a complete Java program that opens a binary file containing integers and displays the contents to the screen.
سؤال
Write a Java statement that creates a stream that provides read/write access to the file named autos.txt.
سؤال
Use the output stream created in number 11 above to write the String BBC to the file named statistics.dat.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/46
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 10: File IO
1
The output stream connected to the computer screen is:

A)System.exit
B)System.quit
C)System.in
D)System.out
D
2
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
C
3
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)
B
4
All of the following are methods of the File class except:

A)exists)
B)delete)
C)getDirectory)
D)getName)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
5
The class ObjectOutputStream contains all of the following methods except:

A)writeInt)
B)writeChar)
C)writeDouble)
D)println)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
6
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
7
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
8
The class ObjectInputStream contains all of the following methods except:

A)readLine)
B)readChar)
C)readObject)
D)readInt)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
9
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
10
The FileNotFoundException is a descendant of the class IOException.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
11
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
12
An ____________ allows data to flow from your program.

A)input stream
B)output stream
C)file name
D)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
13
The method _________ reads a single character from an input stream.

A)readLine)
B)skip)
C)read)
D)close)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
14
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
15
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
16
The read)method of the class RandomAccessFile returns the type:

A)byte
B)int
C)char
D)double
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
17
An ___________ allows data to flow into your program.

A)input stream
B)output stream
C)file name
D)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
18
All of the following are methods of the Scanner class except:

A)nextFloat)
B)next)
C)useDelimiter)
D)readLine)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
19
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
20
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
21
The File class contains methods that allow you to check various properties of a file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
22
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
23
Only the classes provided for file output contain a method named close.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
24
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
25
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
26
The preferred stream classes for processing binary files are ObjectInputStream and ObjectOutputStream.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
27
Write a Java statement to create and open an output stream to a file named autos.txt.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
28
Using BufferedReader to read integers from a file requires the String input to be parsed to an integer type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
29
Binary files can be handled more efficiently than text files.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
30
Binary files store data in the same format that is used by any common text editor.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
31
When your program is finished writing to a file,it should close the stream connected to that file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
32
Write a Java statement that creates an output stream to append data to a file named autos.txt.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
33
Write a Java statement to create an input stream to a file named autos.txt.Use the BufferedReader class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
34
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
35
A full path name gives a complete path name,starting from the directory the program is in.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
36
Write a Java statement that creates an output stream to a binary file named statistics.dat.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
37
Explain the differences between a text file,an ASCII file and a binary file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
38
Explain what happens when an output file is opened in Java.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
39
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
40
What happens when the method close is invoked on a stream?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
41
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
42
Write a Java statement to create an input stream to the binary file statistics.dat.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
43
Write a Java statement to create an input stream to a file named "statistics.dat".
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
44
Write a complete Java program that opens a binary file containing integers and displays the contents to the screen.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
45
Write a Java statement that creates a stream that provides read/write access to the file named autos.txt.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
46
Use the output stream created in number 11 above to write the String BBC to the file named statistics.dat.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.