1 / 5

Question 1

Question 1. What can happen if you don’t close a File Stream when you are done with it? Nothing will happen since it will always close on its own The file won’t be readable because the file will never be closed The file may have corrupt data inside the file.

agnes
Télécharger la présentation

Question 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Question 1 • What can happen if you don’t close a File Stream when you are done with it? • Nothing will happen since it will always close on its own • The file won’t be readable because the file will never be closed • The file may have corrupt data inside the file. • The file will never save what was written to it.

  2. Question 2 • Which of the following is true? • The order of data written in a DataOutputStream and read in a DataInputStreamto the file isnt important; The program will know where to get the data we wrote. • The Order only matters as long as we use the correct variable types. • There is no reason to use FileInputStreams or FileOutputStreams except to attach higher level streams to them. • Our program needs the right order to retrieve the correct variables.

  3. Question 3 • Which is the correct way to initialize the objects to use a DataInputStream? A) Create the DataInput Stream object, then attach it to a new FileInputStream object, then finally create a File object and connect them together. B)Create a File Object, then Create a DataInputStream Object and connect it directly to the File Object. C) Create a FileInputStream object, then create a DataInputStream object to connect to the FileInputStream object. We don’t need a File object because the FileInputStream object can write directly to a file. D) Create a File object. Then create FileInputStream object with the File object. After that create a DataInputStream object using the FileInputStream object.

  4. Question 4 • What is a correct difference between a text and binary file type? A)You can’t store text inside a binary file. B)Binary files can’t be used on windows. C)Text file is more efficient to use than a Binary file D) Binary objects can sometimes depend on the machine (operating system, program)

  5. Question 5 • Which of the following is not a valid way to take input from a file? • Use a BufferedReader • Use a Scanner • Use a DataInputStream • Use a BinaryInputStream • Use a FileInputStream

More Related