Concept explainers
(a)
To choose a suitable word for a blank.
(a)
Explanation of Solution
Answer: Files
Explanation: A file is a collection of data that is stored in the storage devices.
(b)
To choose a suitable word for a blank.
(b)
Explanation of Solution
Answer: Record
Explanation: The data can be stored in the form of the fields in the record.
(c)
To choose a suitable word for a blank.
(c)
Explanation of Solution
Answer: Key
Explanation: To retrieve the data from the record, something unique is required, that is, a key.
(d)
To choose a suitable word for a blank.
(d)
Explanation of Solution
Answer: String
Explanation: A set of characters is known as a string.
(e)
To choose a suitable word for a blank.
(e)
Explanation of Solution
Answer: Standard input, standard output, and standard error
Explanation: These are the basic streams required for the file operations.
(f)
To choose a suitable word for a blank.
(f)
Explanation of Solution
Answer: fputc
Explanation: A fputc() is a pre-defined function to write a character to the file.
(g)
(g)
Explanation of Solution
Answer: fputs
Explanation: A fputs() is a pre-defined function to write a string to the file.
(h)
To choose a suitable word for a blank.
(h)
Explanation of Solution
Answer: fwrite
Explanation: Generally, a fwrite() function is used to write to a file.
(i)
To choose a suitable word for a blank.
(i)
Explanation of Solution
Answer: fseek
Explanation: A fseek() function will move the pointer to the starting of the file.
Want to see more full solutions like this?
Chapter 11 Solutions
C How to Program (8th Edition)
- (Data processing) A bank’s customer records are to be stored in a file and read into a set of arrays so that a customer’s record can be accessed randomly by account number. Create the file by entering five customer records, with each record consisting of an integer account number (starting with account number 1000), a first name (maximum of 10 characters), a last name (maximum of 15 characters), and a double-precision number for the account balance. After the file is created, write a C++ program that requests a user-input account number and displays the corresponding name and account balance from the file.arrow_forwardin the FILE structure : What two fields we used to determine the size of the internal buffer allocated : Group of answer choices read_ptr and write_ptr base and end pointer flags and fileio all of the abovearrow_forward5. Assume a file system is using combined indexing scheme to keep track of the blocks allocated to a file, as in Linux/Unix file system. In the inode of a file, there are 12 direct pointers, one single-indirect pointer, one double-indirect pointer, and one triple-indirect pointer. Assume the size of a disk block address (i.e., disk pointer size) is 8 bytes. Assume block size is 4 KB. a) What is the maximum file size? b) How many index blocks are required for files of size 30 KB, 256KB, 15 MB, 512 MB, 32 GB? c) Assume nothing is cached (no disk caching applied in the system) and we know the disk location of the inode of a file of size 1 GB. How many disk accesses are required to access a byte at offset 2^14 (16K) in the file? How many disk accesses are required to access a byte at offset 2^26 in the file?arrow_forward
- Program this Sometimes data comes in as a structured format that you have to break down and turn into records so you can process them. CSV, or comma-separated values, is a common standard for doing this. Construct a program that reads in the following data file: Lee, Jason, 55908 Flores, Jim, 56500 Cruz, Aaron, 46000 Cruz, Chris, 34500 Swift, Geoffrey, 14200 Xiong, Fong, 65000 Zafra, Sabrina,51500 Process the records and display the results formatted as a table, evenly spaced, as shown in the example output. EXAMPLE OUTPUT Last First Salary $65,000 $56,500 $55,900 Xiong Fong Flores Jim Lee Jason Zafra Sabrina Cruz Aaron Cruz Chris Swift $51,500 $46,000 $34,500 Geoffrey $14,200 CONSTRAINTS 1. Write your own code to parse the data. Don't use a CSV parser 2. Use string formatting to properly space out the columns. Make each column one space longer than the longest value in the column. 3. Format the salary as currency with dollar signs and commas. 4. Sort the results by salary from highest…arrow_forwardProgram thisarrow_forwardShow clearly all working explaining detailly each steparrow_forward
- Array/File FunctionsWrite a function named arrayToFile. The function should accept three arguments:the name of a file, a pointer to an int array, and the size of the array. The functionshould open the specified file in binary mode, write the contents of the array to the file,and then close the file.Write another function named fileToArray. This function should accept three arguments: the name of a file, a pointer to an int array, and the size of the array. Thefunction should open the specified file in binary mode, read its contents into the array,and then close the file.Write a complete program that demonstrates these functions by using the arrayToFilefunction to write an array to a file, and then using the fileToArray function to readthe data from the same file. After the data are read from the file into the array, displaythe array’s contents on the screen.arrow_forwardA movie file has the following record structure:name ofthe movie producer director type productioncostAssume that the name of the movie is the primary key of the file. Thefield type refers to the type of the movie, for example, drama, sci-fi, horror, crimethriller, comedy and so forth. Input a sample set of records of your choice into themovie file.i) Implement a primary index-based ISAM file organization.ii) Implement secondary indexes on director, type and productioncost.arrow_forwardTopics: Functions, Files Read and write, DictionarySuppose you are given an input file of a document that only contains English words, spaces, commas(always followed with one space) and periods (always followed with one space). Your task is to readthe file, count the word frequency by ignoring the letter case, output the frequently used words (i.e.,the words occurred more than once) and the most frequently used word among all of them.Lab Scenario: Count the word in a document1. The program reads from an already provided input file: “document.txt”, which containsseveral paragraphs separated by an empty line.2. You will perform the file open operation. And then perform the read operation with your choice ofread functions and read the content of the file.3. Once you are done reading, start processing the contents of the file using a dictionary where thekey would be the word in lowercase and the corresponding values would be word frequency whichwill be the number of occurrences in the…arrow_forward
- - PROJECT REQUIREMENTS Choose a programming project application to be developed, then design and implement the programming elements according to your creativity using C++ language. The application must demonstrate the integration of file I/O, records(struct), array and functions. You may follow the general framework for the implementation phase as highlighted below: Read data from file. Store data into a struct array. Process the data using functions. You may pass variables, one dimensional array, two dimensional array, struct variable or struct array to functions, where appropriate. Display the output to the screen, where appropriate. Write the output file, where appropriate. O O O O Oarrow_forwardMake a distinction between file storage structure and structure storage structure.arrow_forwardC programming language Topic : Input/Output Program : Product list (product.c) Definition : The program reads a series of items form a file and displays the data in columns. The program obtains the file name from the command line. Each line of the file will have the following form: item, mm-dd-yyyy, price For example, suppose that the file contains the following lines: 123, 12.00, 12/25/2006 124, 18.30, 1/10/2020 Expected output: Item Unit Purchase Price Date 123 $ 12.00 12/25/2006 124 $ 18.30 1/10/2020arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Fundamentals of Information SystemsComputer ScienceISBN:9781305082168Author:Ralph Stair, George ReynoldsPublisher:Cengage Learning