Question

Review Questions 1. Which of the following opens the employ.txt file and allows the computer to write new data to the end of5. Which of the following can be used to determine whether the employ.txt file exists? a. If Io. File.Exists(employ.txt) Th

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Ans 1. (b) outFile=IO.File.AppendText("employ.txt")

This is the only correct syntax amongst the given options to add data to the end of an existing text file. (a), (c) and (d) methods does'nt exist.

Ans 2. (b) CreateText

If the file to be opened exists this method will erase all the data inside it. Method (a) will add data to the end of an existing text file while method (c) and (d) does'nt exist.

Ans 3. (c) strText= inFile.ReadLine

This is the correct syntax to assign to strText, all the other options are not as per syntax.

Ans 4. (a) -1

The peek mehod will return -1 when it will reach the end of the file.

Ans 5. (a) IF IO.File.Exists("employ.txt") Then

This is the correct syntax to check if the file exists or not, all the other options are not as per syntax.

Ans 6. (d) none of the above

AppendText creates a StreamReader Object and none of the othe given options.

Ans 7. (c) StreamWriter

Both CreateText and AppendText creates a StreamWriter Object and none of the othe given options.

Though we are instructed to answer at max. one question, I have answered 7 of them, ENJOY!!!

Add a comment
Know the answer?
Add Answer to:
Review Questions 1. Which of the following opens the employ.txt file and allows the computer to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 5. Which of the following can be used to determine whether the employ.txt file exists? a....

    5. Which of the following can be used to determine whether the employ.txt file exists? a. If Io. File.Exists("employ.txt") Then b. If Io. File("employ.txt").Exists Then C. If IO. Exists("employ.txt") = True Then d. If Io. Exists. File("employ.txt") = True Then 6. What type of object is created by the OpenText method? a. File c. StreamWriter b. SequenceReader d. None of the above. 7. What type of object is created by the AppendText method? a. File C. StreamWriter b. SequenceReader d....

  • QUESTION The ReadFile class opens and reads a text file. The WriteFile class opens and writes...

    QUESTION The ReadFile class opens and reads a text file. The WriteFile class opens and writes to a file. Compile and run these programs. There are several ways to read/write text files. The examples shown here are just one way of achieving this. Look at the API for the BufferedReader class. The readline() method is a simple way to read the text file line by line. It returns null when the end of the file has been reached. https://docs.oracle.com/javase/8/docs/api/java/io/BufferedReader.html Look...

  • FOR JAVA Write a program that takes two command line arguments: an input file and an...

    FOR JAVA Write a program that takes two command line arguments: an input file and an output file. The program should read the input file and replace the last letter of each word with a * character and write the result to the output file. The program should maintain the input file's line separators. The program should catch all possible checked exceptions and display an informative message. Notes: This program can be written in a single main method Remember that...

  • Select the correct answer. (1)     Which of the following will open a file named MyFile.txt and...

    Select the correct answer. (1)     Which of the following will open a file named MyFile.txt and allow you to read data from it?                (a)      File file = new File("MyFile.txt");           (b)      FileWriter inputFile = new FileWriter();           (c)       File file = new File("MyFile.txt");                      FileReader inputFile = new FileReader(file);           (d)      FileWriter inputFile = new FileWriter("MyFile.txt"); (2)     How many times will the following do - while loop be executed?                      int x = 11;             do {             x...

  • Java language (a) Create a class HexEditor with a constructor which creates a 5x10 text area...

    Java language (a) Create a class HexEditor with a constructor which creates a 5x10 text area in a Frame. Also add a pull-down menu with a menu item "Load". Copy the class as the answer to this part. (b) Create another class TestHexEditor with a main() method which creates an object anEditor of the class HexEditor and displays the frame in part (a) using setVisible(true). Copy the class as the answer to this part. (c) Make changes to the class...

  • Random access memory is _________________ . a. Persistent                    c. permanent b....

    Random access memory is _________________ . a. Persistent                    c. permanent b. Volatile                        d. sequential 2. Which of the following is not permanent storage?       a. RAM                       c. A USB drive       b. a hard disk                   d. all of these 3. Which of the following is not a File class method?         a. Create()                       c. Exists()         b. Delete()      ...

  • Program In Assembly For this part, your MAL program must be in a file named p5b.mal....

    Program In Assembly For this part, your MAL program must be in a file named p5b.mal. It must have at least one function in addition to the main program. For the purposes of Part (b), you may assume the following 1. Any line of text typed by a user has at most 80 characters including the newline character. 2. A whitespace character refers to a space, a tab or the new line character. 3. A word is any sequence of...

  • Please help with all the questions. These question are for autocad users. CIVILEN 2405-COMPUTER GRAPHICS for...

    Please help with all the questions. These question are for autocad users. CIVILEN 2405-COMPUTER GRAPHICS for CIVIL ENGINEERS QUIZ 2 Each question is worth 5 points for a total of 50 points 1. AutoCAD's object snap feature allows you to: Name 6. Which of the following commands would you most A. B. C. D. snap to end points of lines snap to the midpoints of lines snap to the centers of circles all of the above likely use to remove...

  • A. File I/O using C library functions File I/O in C is achieved using a file...

    A. File I/O using C library functions File I/O in C is achieved using a file pointer to access or modify files. Processing files in C is a four-step process: o Declare a file pointer. o Open the desired file using the pointer. o Read from or write to the file and finally, o Close the file. FILE is a structure defined in <stdio.h>. Files can be opened using the fopen() function. This function takes two arguments, the filename and...

  • JAVA Write a program that prompts the user to enter a file name, then opens the...

    JAVA Write a program that prompts the user to enter a file name, then opens the file in text mode and reads it. The input files are assumed to be in CSV format. The input files contain a list of integers on each line separated by commas. The program should read each line, sort the numbers and print the comma separated list of integers on the console. Each sorted list of integers from the same line should be printed together...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT