Input / Output – General Questions

6. Which files will get closed through the fclose() in the following program?

Screenshot 1

A. “A.C” “B.C” “C.C”
B. “B.C” “C.C”
C. “A.C”
D. Error in fclose()

Correct Answer: D. Error in fclose()

7. On executing the below program what will be the contents of the ‘target.txt’ file if the source file contains a line “To err is human”?

Screenshot 2

A. r n
B. Trh
C. err
D. None of above

Correct Answer: B. Trh

8. To scan a and b given below, which of the following scanf() statement will you use?

Screenshot 3

A. scanf(“%f %f”, &a, &b);
B. scanf(“%Lf %Lf”, &a, &b);
C. scanf(“%f %Lf”, &a, &b);
D. scanf(“%f %lf”, &a, &b);

Correct Answer: D. scanf(“%f %lf”, &a, &b);

9. Out of fgets() and gets() which function is safe to use?

A. gets()
B. fgets()

Correct Answer: B. fgets()

10. Consider the following program and what will be the content of t?

Screenshot 4

A. size of “DUMMY.C” file
B. The handle associated with “DUMMY.C” file
C. Garbage value
D. Error in fileno()

Correct Answer: B. The handle associated with “DUMMY.C” file

Leave A Comment?

20 + five =