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 C Programming Language Patient Following System1) Define a struct included patient number, name, age, and disease information.2) Main menu of the program include the following operations:◦ create a patient file with 100 empty records.◦ Insert a new patient record.◦ Find and retrieve patient information.◦ Delete a patient record.◦ Modify a patient record.◦ List all patients information. I need more information for solution.arrow_forwardA movie file has the following record structure: name of the movie producer director type production cost Assume that the name of the movie is the primary key of the file. The field type refers to the type of the movie, for example, drama, sci-fi, horror, crime thriller, comedy and so forth. Input a sample set of records of your choice into the movie file.i) Implement a primary index-based ISAM file organization.ii) Implement secondary indexes on director, type and production cost.iii) How could the secondary index-based file organization in Programming Assignment 3 (ii), be used to answer a query such as “Who are the directors who have directed films of the comedy or drama type, who have incurred the highest production cost?arrow_forward
- The capacity of a vector indicates A the number of elements it contains B the number of elements it can currently store the largest number of elements it can store the current size of the vector in bytes Unlike a sequence container, whose elements are organized by index, the elements in an associative container are organized by A value B key memory location pointerarrow_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_forwardThis lab will exercise your understanding of some of the concepts covered in Chapter 12:dynamic data, arrays, pointer addresses 1. Create a structure called students. The structure should contain:firstname, lastname, gpa. 2. Create a pointer to the student structure and dynamically create an array of thestudent structure, enough for 4 students.Hint: Store the address of the beginning of the array 3. Create a file that contains four rows of data with last name, first name and gpa valueor use the inFile.txt file attached. 4. Using pointer notation only (not array notation []), read the data from the file andstore the data into the structure.After all the data is read and stored, using pointer notation only, output to the console (cout)each student's first name, last name and gpa. Use information messages and ensure the datais displayed properly. 5. Before exiting, delete the dynamically allocated structure array.Complete as much as you can before you leave ensuring what you've completed…arrow_forward
- 5. 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_forwardIt is a type used to represent a heterogeneous collection of data. array O function struct pointer Check It! Structure is a user-defined data type in C which allows you to combine different data types to store a particular type of record. O True False Check It!arrow_forwardProgram 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_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
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage