| 1. | What will the function randomize() do in Turbo C under DOS? |
|||||||
Answer: Option C Explanation: The randomize() function initializes the random number generator with a random value based on time. You can try the sample program given below in Turbo-C, it may not work as expected in other compilers.
|
| 2. | Can you use the fprintf() to display the output on the screen? |
|||
Answer: Option A Explanation: Do like this fprintf(stdout, "%s %d %f", str, i, a);
|
| 3. | What is the purpose of fflush() function. |
|||||||
Answer: Option A Explanation: "fflush()" flush any buffered output associated with filename, which is either a file opened for writing or a shell command for redirecting output to a pipe or coprocess. Example: |
| 4. | Does there any function exist to convert the int or float to a string? |
|||
Answer: Option A Explanation: 1. itoa() converts an integer to a string.
|
| 5. | What is stderr ? |
|||||||
Answer: Option C Explanation: The standard error(stderr) stream is the default destination for error messages and other diagnostic warnings. Like stdout, it is usually also directed to the output device of the standard console (generally, the screen).
|
| 6. | Which standard library function will you use to find the last occurance of a character in a string in C? |
|||||||
Answer: Option D Explanation: strrchr() returns a pointer to the last occurrence of character in a string. Example:
Output: The last position of '2' is 14. |
| 7. | Input/output function prototypes and macros are defined in which header file? |
|||||||
Answer: Option C Explanation: stdio.h, which stands for "standard input/output header", is the header in the C standard library that contains macro definitions, constants, and declarations of functions and types used for various standard input and output operations. |
| 8. | What will the function rewind() do? |
|||||||
Answer: Option D Explanation: rewind() takes the file pointer to the beginning of the file. so that the next I/O operation will take place at the beginning of the file. |
