12th Class Computer Chapter 7 File Management Short Questions Answer

12th Class Computer Chapter 7 File Management Short Questions Answer

How can we handle the small amount of input/output data?

When we are dealing with small amount of input/output data the input can be entered from the keyboard and output can be displayed on the monitor or printed on the printer.

Define a file?

A file is a collection of bytes that is given a name.

What does C language provides to handle data file?

C language provides facilities to read and write files in a variety of ways.

Define the character input/output method?

In this method data can be read or written on character at a time. This is very similar to how the functions such as putchar() and getche() read data from the keyboard and wrote it to the screen.

Which statement defines the file structure?

The statement “FILE* fptr;” defines the file structure.

Describe file structure?

The file structure contains information about the file being used.

Explain the statement “fptr = fopen(“test.txt”, “w”);”.

This tells the operating system to open a file data called “test.txt”. In this statement “w” indicates that we will be writing to the file. The fopen function returns a pointer to the FILE structure for our file which we store in the variable fptr.

What is the purpose of “putc(ch, fptr);” statement?

The purpose of this statement is to write a character stored in “ch” to the file whose file structure is pointed to by the variable fptr which we obtained when we opened the file.

What is the function of the statement “fclose(fptr);”?

Statement fclose(fptr); means close the file whose FILE structure is pointed to by the variable fptr. The pointer fptr has become our key for communication with the file and used to refer to it.

Describe the statement “fputs(“ ”,fptr);”.

The statements adds a new line character to the end of the line. We need this statement to do this because the fputs() function does not automatically add a newline character at the end of the string.

Which function is used for reading strings from a file?

For reading strings from a file we use the function fgets().

Explain the function “fgets(string, 80,fptr);”.

It takes three parameters. The first is the address where the string will be started and the second is the maximum length of the string. The third parameter “fptr” is the pointer to the FILE structure of the file.

Which functions are used for formatted read and write operation?

Functions fscanf() and fprintf() are used for formatted read and write operations.

You Can Learn and Gain more Knowledge through our Online Quiz and Testing system Just Search your desired Preparation subject at Gotest.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button