Format Function: Basic Concepts

Jan 12 • Resources • 1424 Views • 5 Comments on Format Function: Basic Concepts

Q.1. What is the format function?
Ans. Format function allow us to supply the input in a fixed format and let us obtain the output in the specified form. Formatted output converts the internal binary representation of the data to ASCII character which are written to the output file. And we can also define the Random access, Random access means we can move to any part of a file and read or write data from it without reading the entire file. We can access it in two ways, one is sequentially and other is randomly.

Q.2. How many types of formatted functions are there?
Ans. There are two types of formatted function. One is fprintf and second is fscanf.

Functions in Programming


Q.3. What is the use of fprint function?
Ans. fprintf() function is used to write the data to text file and its syntax is ” fprintf(FILE *fptr,const char *format [argu1,argu2……]);. Here fptr is a file pointer of type file structure.

Q.4. What is the use of fscanf() function?
Ans. It is used to read data from stream and store the data according to the parameter format into the location pointed by the additional argument.

Q.5. From “fgets()” and  “gets()” which function is safe to use?
Ans. fgets() function is safe to used because in it we can specify the size of the buffer into which the string supplied will  be store. So we use fgets() function mostly because it is the safe.

Q.6. What function we use  for reading from the strings?
Ans. We used “sscanf()”  function to read from the string s file.

Q.7. What header file we use for performing memory formatting?
Ans. We use  strstream.h / strstream header file for performing memory formatting.

Q.8. What escape sequence we use to move the cursor to the next vertical tab position?
Ans. We use v.

Q.9. What is the use of f?
Ans. It is used to move the cursor to the start of the next logic page.

Q10. What a back slash () represents?
Ans. Back slash () represents Escape.

Download questions and answers on Format Function Concepts in Pdf QUESTIONS AND ANSWERS ON FORMAT FUNCTION Pdf

Related Links-
C Aptitude Questions
C C++ Aptitude questions
C++ Aptitude Questions and Answers with PDF
C++ Interview Questions and Answers with PDF
Questions on inheritance in C++ with Answers


Tell us Your Queries, Suggestions and Feedback

Your email address will not be published.

5 Responses to Format Function: Basic Concepts

  1. sakshi chaudhary says:

    Satisfactory and useful explanation about the Format FUNCTION and its basic concept..!!!!

  2. Saurabh Singh says:

    Good post containing explanation on Formatting Function..have a look

« »