Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Which of the following statements will write to an output file, assuming that a variable oFile has been declared correctly as in the previous question and that a String variable named s has been created with the appropriate data to write?
-
AoFile.println(s);
-
BoFile.write(s);
-
CoFile.output(s);
-
DoFile.fileWrite(s);
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- What is the name of the file object variable in the following code segment? a = open ("b.txt", "r") Select one: b.txt aarrow_forwardChapter 4. Homework Assignment (read instructions carefully) Write a program that asks the user for the name of a file. The program should read all the numbers from the given file and display the total and average of all numbers in the following format (three decimal digits): Total: nnnnn.nnn Average: nnnnn.nnn Class name: FileTotalAndAverage Here is a working code Please modify it so it passes the test cases because I run it it does not work: Also I do not need Goodbye And I run it through hypergrade which it has all the test cases it does not work. import java.io.File import java.io.FileNotFoundException;import java.util.Scanner;public class FileRead {public static void main(String[] args) throws FileNotFoundException {Scanner keyboard = new Scanner(System.in);System.out.println("Please enter the file name or type QUIT to exit:");String filename = keyboard.nextLine();if (filename.equalsIgnoreCase("Quit"))return;File myFile = new File(filename);while (!myFile.exists())…arrow_forwardChapter 4. Homework Assignment (read instructions carefully) Write a program that asks the user for the name of a file. The program should read all the numbers from the given file and display the total and average of all numbers in the following format (three decimal digits): Total: nnnnn.nnn Average: nnnnn.nnn Class name: FileTotalAndAverage est Case 1 Please enter the file name or type QUIT to exit:\ninput1.txtENTERTotal: 11.800\nAverage: 2.950\n Test Case 2 Please enter the file name or type QUIT to exit:\ninput2.txtENTERTotal: 17.300\nAverage: 3.460\n Test Case 3 Please enter the file name or type QUIT to exit:\ninput3.txtENTERTotal: 1.124\nAverage: 1.124\n Test Case 4 Please enter the file name or type QUIT to exit:\ninput4.txtENTERFile input4.txt is empty.\n Test Case 5 Please enter the file name or type QUIT to exit:\ninput5.txtENTERFile: input5.txt does not exist.\nPlease enter the file name again or type QUIT to…arrow_forward
- 8. The following statements are TRUE about the program EXCEPT #include int main() { FILE *fp; fp = fopen("D://sebb2033.txt", "w"); fclose(fp); A. The FILE datatype, fopen() and fclose() are declared in . B. A file name 'sebb2033.txt’ is opened with both ʼread' and 'write' mode. C. 'fp' is a file pointer which points to the type FILE. D. 'fclose' closes the file. 9. What is the program execution output of the code below? int a=2, b=1; a>++b ? printf("larger") : aarrow_forward1. Write a program named program61.py This program will have three functions, the main() create() and retrieve(). main() will call: create() and main() then calls retrieve() create() will prompt the user to enter any number of course name | grade values. The course name ,AND calculated class GPA ( not the class grade ) are the written one value per line to a file named grades.txt ( review example of grades.txt below! ). Pressing Enter with no input value on the course name will exit the loop, close the file, print "File was created and closed" and return the bool value True to the main(). See Simple GPA Tip below. retrieve() will open and read grades.txt. The function then will print the course names and Class GPA as shown below. The average of all class GPA values should be calculated and displayed to two decimal places and then return variable used for the GPA average to the main() . See sample run below in which 2 course names were entered, but note that more or fewer…arrow_forwardThe following code completes the program from the previous question. Assume you have an open output file handle called coutfile. What exactly can fill in the blank so that the output to the file looks exactly like the output to the screen from the print statement. for i in range(100): print(i) outfile.write(_. outfile.close()arrow_forwardTrue or false? The following statement fails if the file does not exist. ofstream file("out.txt"); Group of answer choices true falsearrow_forwardChapter 4. Homework Assignment (read instructions carefully) Write a program that asks the user for the name of a file. The program should read all the numbers from the given file and display the total and average of all numbers in the following format (three decimal digits): Total: nnnnn.nnn Average: nnnnn.nnn Class name: FileTotalAndAverage Here is a working code but please modify it so it passes the test cases because I run it it does not work: Also I do not need Goodbye. I run it through Hypergrade which has all the test cases and it does not pass. It says 0 out of 7 passed import java.io.File; //importing java.io.Fileimport java.io.FileNotFoundException; //importing FileNotFoundException for exception handlingimport java.util.Scanner; //importing Scanner for user inputpublic class FileTotalAndAverage { //class FileTotalAndAverage public static void main(String[] args) throws FileNotFoundException { Scanner keyboard = new Scanner(System.in); //declaring and…arrow_forwardarrow_back_iosarrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education