Data Files - C Interview Questions and Answers

Why "C Programming - Data Files" Interview Questions?

In this section you can learn and practice interview questions based on ""C Programming - Data Files"" and improve your skills in order to face the interview, competitive examination and various entrance tests (CAT, GATE, GRE, MAT, Bank Exam, Railway Exam etc.) with full confidence.

Where can I get "C Programming - Data Files" interview questions and answers with explanation?

IndiaBIX provides you lots of fully solved "C Programming - Data Files" interview questions and answers with Explanation. All students, freshers can download "C Programming - Data Files" quiz questions with answers as PDF files and eBooks. Solved examples with detailed answer description, explanation are given and it would be easy to understand. View the solution for the problems with feel and good user interface; easily go through all questions and answers.

How to answer "C Programming - Data Files" interview questions?

You can easily answer the interview questions based on "C Programming - Data Files" by practicing the exercises given below.

  1. If errno contains a nonzero number, is there an error?

    The global variable errno is used by many standard C library functions to pass back to your program an error code that denotes specifically which error occurred. However, your program should not check the value of errno to determine whether an error occurred.

    Usually, the standard C library function you are calling returns with a return code which denotes that an error has occurred and that the value of errno has been set to a specific error number. If no error has occurred or if you are using a library function that does not reference errno, there is a good chance that errno will contain an erroneous value. For performance enhancement, the errno variable is sometimes not cleared by the functions that use it.

    You should never rely on the value of errno alone; always check the return code from the function you are calling to see whether errno should be referenced. Refer to your compiler's library documentation for references to functions that utilize the errno global variable and for a list of valid values for errno.

  2. What is a stream?

    A stream is a continuous series of bytes that flow into or out of your program. Input and output from devices such as the mouse, keyboard, disk, screen, modem, and printer are all handled with streams. In C, all streams appear as files - not physical disk files necessarily, but rather logical files that refer to an input/output source. The C language provides five "standard" streams that are always available to your program. These streams do not have to be opened or closed. These are the five standard streams:

    Name Description Example
    stdin-Standard Input-Keyboard
    stdout-Standard Output-Screen
    stderr-Standard Error-Screen
    stdprn-Standard Printer-LPT1: port
    stdaux-Standard Auxiliary-COM1: port

    Note that the stdprn and stdaux streams are not always defined. This is because LPT1: and COM1: have no meaning under certain operating systems. However, stdin, stdout, and stderr are always defined. Also, note that the stdin stream does not have to come from the keyboard; it can come from a disk file or some other device through what is called redirection. In the same manner, the stdout stream does not have to appear on-screen; it too can be redirected to a disk file or some other device. See the next FAQ for an explanation of redirection.

1 2 3 4 5 6 7 8 9 Next »