Why we use File Handling?

1 Answer

Answer :

Ans: The input and output operation that we have performed so far were done through screen and keyboard only.After the termination of program all the entered data is lost because primary memory is volatile . if the data has to be used later ,then it becomes necessary to keep it in permanent storage device. so the c language provide the concept of file through which data can be stored on the disk or secondary storage device.The stored data can be read whenever required.

Types of File Handling in C:
The file handling in C can be categorized in two types1. High level (Standard files or stream oriented files)- High level file handling is managed by library function. High level file handling is commonly used because it is easier and hide most of the details from the programmer.
2. Low level (system oriented files)- low level files handling is managed by system call.

Related questions

Description : State true or false. i) Jpanel is a class included in awt package. ii) Anonymous classes are mostly used for event handling. iii) Names of anonymous classes must be unique iv) JOptionPane is an inner class A) i-false ... ) i-false, ii-true, iii-false, iv-false D) i-true, ii-false, iii-false, iv-true

Last Answer : C) i-false, ii-true, iii-false, iv-false

Description : Match the following mechanisms for interrupting the execution of a process and their uses. i) Interrupt a) Call to an operating system function ii) Trap b) Reaction to an asynchronous external event iii) Supervisor Call c) Handling of a error ... -a, iii-b C) i-b, ii-c, iii-a D) i-a, ii-c, iii-b

Last Answer : C) i-b, ii-c, iii-a

Description : Which of the following statements concerning Object-Oriented databases is FALSE? (A) Objects in an object-oriented database contain not only data but also methods for processing the data. (B ... Object-oriented databases store more types of data than relational databases and access that data faster.

Last Answer : (C) Object-oriented databases are more adapt at handling structures (analytical) data than relational databases.

Description : In gw basic what are the two types of file handling?

Last Answer : Sequential and random access.

Description : Describe working of diff and cmp file handling commands with example.

Last Answer : Diff command: diff stands for difference. This command is used to display the differences in the files by comparing the files line by line. it tells us which lines in one file have is to be changed to make the two files ... $ cat file1 abcd xyz $ cat file2 Abed wxy $_  

Description : Describe cat and rm file handling commands with example.

Last Answer : cat Command: Cat(concatenate) command is very frequently used in Linux. It reads data from the file and gives their content as output. It helps us to create, view, concatenate files. cat is ... and will delete all the files and sub-directories recursively of the parent directory. $ rm -r 

Description : Use the new system as the same time as the old system to compare the results. This is known as … A) Procedure Writing B) Simultaneous processing C) Parallel Operation D) File Conversion

Last Answer : C) Parallel Operation

Description : What is the difference between a sequential file and a random file?

Last Answer : Ans: Sequential file access is the method employed in tape drives where the files are access in a sequential manner. So if you have to get a file in the end of the tape you have to start ... Disks and Optical drives, wherever the files is placed it will go to that particular place and retrieve it.

Description : What do you mean by File Positioning?

Last Answer : Ans: The file positioning of a stream describes where in the file the stream is currently reading or writing. I/O on the stream advances the file position through the file. On GNU systems, the ... position is represented as an integer, which counts the number of bytes from the beginning of the file.

Description : Write the general formats for file opening and file closing commands?

Last Answer : Ans: For Opening:- fp=fopen(“filename” , “mode”); where ‘fp’ refers to the file pointer. ‘filename’ refers to the name of the file to be opened. ‘mode’ refers to the mode of accessing data. For Closing:- fclose(fp); where fp denotes the file pointer.

Description : In what way is a file more flexible than a String?

Last Answer : Ans: A file is stored permanently in a storage device.It is easy to access a file whenever required. On the other hand, a string is stored temporarily in RAM, and the contents of a string will be erased automatically when the power is switched off or when the program execution is terminated.

Description : List some of the most used File Processing functions in C?

Last Answer : Ans: Most used file processing functions in C are-  fopen()-used to open a file and set the file pointer to the beginning or end of a File.  fclose()-used to close an active File.  getc()-used ... used to write data to a File.  rewind()-used to move the file pointer to the beginning of a File.

Description : What do you mean by a File?

Last Answer : Ans: A File contains containsdata/information which are stored permanently in a storage device.Floppy disk and hard disk are commonly used to store file information.When large quantity data is required to ... filename normally has a primary name and a secondary name which are separated by a Dot(.)

Description : Which command is used to display a file contents in octal form? A. cd B. od C. of D. oct E. None of the above

Last Answer : B. od

Description : Which command is used to count just the number of characters in a file? A. wc - 1 B. wc -c C. wc -w D. wc -r E. None of the above

Last Answer : B. wc -c

Description : Which of the following commands is used to update access and modification times of a file? A. grep B. wc C. touch D. cat E. None of the above

Last Answer : C. touch

Description : Which command is used to remove a file? A. remove B. rm C. mv D. del E. None of the above

Last Answer : B. rm

Description : The command which transcribes the standard input to the standard output and also makes a copy of the same in a file is A. tee B. tr C. sort D. grep E. None of the above

Last Answer : A. tee

Description : The Octal number to be given alogn with chmod command to make a file readable, writable and executable to the owner, readable and executable to group and others is: A. 000 B. 755 C. 744 D. 555 E. None of the above

Last Answer : B. 755

Description : Which command is used to remove the read permission of the file 'note' from both the group and others? A. chmod go+r note B. chmod go+rw note C. chmod go-x note D. chmod go-r, 4-x note E. None of the above

Last Answer : D. chmod go-r, 4-x note

Description : Which command sends the word count of the file infile to the newfile. A. wc infile >newfile B. wc newfile C. wc infile - newfile D. wc infile | newfile E. None of the above

Last Answer : A. wc infile >newfile

Description : Which command is used to extract specific columns from the file? A. cat B. cut C. grep D. paste E. None of the above

Last Answer : B. cut

Description : Which command is used to display the top of the file? A. cat B. head C. more D. grep E. None of the above

Last Answer : B. head

Description : Which command is used to sort the lines of data in a file in reverse order A. sort B. sh C. st D. sort -r E. None of the above

Last Answer : D. sort -r

Description : MS-SQL stores data in a ........................ file format. A) .DAT B) .MDB C) .MSSQL D) .OBJ

Last Answer : A) .DAT

Description : The jdb is used to A) Create a jar archive B) Debug a java program C) Create C header file D) Generate java documentation

Last Answer : B) Debug a java program

Description : File management function of the operating system includes i) File creation and deletion ii) Disk scheduling iii) Directory creation iv) Mapping file in secondary storage. A) i, ii and iii only B) i, iii and iv only C) ii, iii and iv only D) All i, ii, iii and iv

Last Answer : B) i, iii and iv only

Description : Which of the following information not included in memory table? A) The allocation of main memory to process. B) The allocation of secondary memory to process C) Any information needed to manage virtual memory D) Any information about the existence of file

Last Answer : D) Any information about the existence of file

Description : The different types of tables maintained by the operating system are ............. A) memory, logical , I/O file B) memory, I/O, file, physical C) memory, I/O, file, process D) memory, logical, I/O, physical

Last Answer : C) memory, I/O, file, process

Description : ........... is a large kernel, including scheduling file system, networking, device drivers, memory management and more. A) Monolithic kernel B) Micro kernel C) Macro kernel D) Mini kernel

Last Answer : A) Monolithic kernel

Description : Which of the following is not the function of Microkernel? A) File management B) Low-level memory management C) Inter-process communication D) I/O interrupts management

Last Answer : A) File management

Description : ........... is a large kernel containing virtually the complete operating system, including, scheduling, file system, device drivers and memory management. A) Multilithic kernel B) Monolithic kernel C) Micro kernel D) Macro kernel

Last Answer : B) Monolithic kernel

Description : Based on the identification of objectives, input, output and file content, the vital document is called … A) System Definition B) System Document C) System Requirement Document D) System Subject

Last Answer : B) System Document

Description : Design Phase consists of ……………………. 1. Identity the functions to be performed 2. Design the input/output and file design 3. Defining basic parameters for system design A) 1 & 2 B) 2 & 3 C) 1 & 3 D) 1, 2 & 3

Last Answer : D) 1, 2 & 3

Description : Data store in a DFD represents. A) a sequential file B) a disk store C) a repository of data

Last Answer : C) a repository of data

Description : ome of the utilities of DBMS are ............. i) Loading ii) Backup iii) File organization iv) Process Organization A) i, ii, and iv only B) i, ii and iii only C) ii, iii and iv only D) All i, ii, iii, and iv

Last Answer : B) i, ii and iii only

Description : 4NF stands for .. A) Fourth Normal File B) Fourth Normal Form C) Fourth Normal Fraction D) Fourth Negative File

Last Answer : B) Fourth Normal Form

Description : In the ………………… mode any record in the file can be accessed at random A) Sequential access B) Random access C) Standard access D) Source access

Last Answer : B) Random access

Description : DFD stands for A) Data Flow Document B) Data File Diagram C) Data Flow Diagram D) Non of the above

Last Answer : C) Data Flow Diagram

Description : Which of the following operations can be performed by using FTP. i) Connect to a remote host ii) Select directory iii) Define the transfer mode iv) List file available A) i, and ii only B) i, ii and iii only C) ii, iii and iv only D) All i, ii, iii and iv

Last Answer : C) ii, iii and iv only

Description : A communication device that combines transmissions from several I/O devices into one line is a A) Concentrator B) Modifier C) Multiplexer D) Full duplex file

Last Answer : C) Multiplexer

Description : Devices on one network can communicate with devices on another network via a ....... A) File Server B) Utility Server C) Printer Server D) Gateway

Last Answer : D) Gateway

Description : Which of the following is an application layer service? A) Network virtual terminal B) File transfer, access and management C) Mail service D) All of the above

Last Answer : C) Mail service

Description : Which of the following are the network services? A) File service B) Print service C) Database service D) All of the above

Last Answer : D) All of the above

Description : FTP stands for A) File transfer protocol B) File transmission protocol C) Form transfer protocol D) Form transmission protocol

Last Answer : A) File transfer protocol

Description : ........... a record means a new record to the file. A) Amending B) Updating C) Editing D) Appending

Last Answer : D) Appending

Description : FTP stands for A) Folder Transfer Protocol B) File Transfer Process C) File Transfer Protocol D) File Text Protocol

Last Answer : C) File Transfer Protocol

Description : The versions of windows operating system like windows XP and window Vista uses following file system: (A) FAT-16 (B) FAT-32 (C) NTFS (NT File System) (D) All of the above

Last Answer : (D) All of the above

Description : A UNIX file system has 1 KB block size and 4-byte disk addresses. What is the maximum file size if the inode contains ten direct block entries, one single indirect block entry, one double indirect block entry and one triple indirect block entry? (A) 30 GB (B) 64 GB (C) 16 GB (D) 1 GB

Last Answer : (C) 16 GB

Description : A data file of 1,00,000 characters contains only the characters g-l, with the frequencies as indicated in table:  using the variable-length code by Huffman codes, the file can be encoded with (A) 2,52,000 bits (B) 2,64,000 bits (C) 2,46,000 bits (D) 2,24,000 bits

Last Answer : (D) 2,24,000 bits