You are on page 1of 2

Smart Guess & Test Papers

Student Name ______________________ Father Name ______________________ Roll Number _______


Class: 2nd /Year - Computer Science New Marks : 39 Exam Format : Chapter Wise MCQs
Time : notespk.com_Nauman Sadaf | Date _________________ Examiner Sig __________ Chapter#: 14

MCQ's S/Q L/Q Total

Objective Type

1. Encircle the Correct Option. (1 x 28 = 28)


1) A ________ is a set of related records .
a) Language b) Function c) File d) Program

2) A file is stored in .
a) RAM b) ROM c) Hard disk d) Cache

3) There are following types of streams .


a) 1 b) 2 c) 3 d) 4

4) In File handing sequence of bytes is called .


a) Text stream b) File stream c) Binary steam d) Character stream

5) A logical interface to a file is called .


a) I/O b) FILE I/O c) Stream d) Pointer

6) Text stream have following correspondence with characters .


a) One to one b) One to many c) Many to one d) All of these

7) A ______ can store text only .


a) Binary file b) Text file c) Exe file d) Object file
8) To mention end of file point , following marker is used .
a) File End ( FE ) b) End File ( EF ) c) End of File ( EF ) d) End of File ( EOF )

9) A text file is a _______ collection of characters .


a) Fresh b) Old c) Named d) New
10) If fptr = fopen ("afile.txt" , "r" ) statement is used to open a file then what would be the necessary condition ?
a) The file must already exist b) The file must contain valid c) The file should be data file d) The type of file must be
student data only read only
11) Fopen ( ) function takes ______ parameters .
a) 1 b) 2 c) 3 d) 4

12) To open a file following function is used .


a) Open ( ) b) File open ( ) c) Fopen ( ) d) Getc ( )

13) In the absolute path of a file we use .


a) \ b) / c) \\ d) //

14) Which mode opens only an existing file for both reading and writing ?
a) "w" b) "w+" c) "r+" d) "a+"

15) In the statement FILE * fp ; the * denotes .


a) Pointer b) Variable c) Multiplication d) Parameter
16) A file can be closed using following function .
a) close ( ) b) fclose ( ) c) file close ( ) d) exit ( )
17) On successfully closing a file , the fclose ( ) returns .
a) NULL b) 1 c) FILE pointer
18) An array subscript should be .
a) int b) float c) boule d) real
19) Which of the following function is used to write string to a file ?
a) getc ( ) b) putc ( ) c) fputs ( ) d) fgets ( )
20) Which of the following character is used to mark the end of the string ?
a) \0 b) /0 c) \a d) \n
21) Which of the following function is used to read character from a file ?
a) getc ( ) b) putc ( ) c) fputs ( ) d) fgets ( )
22) A file is stored in .
a) RAM b) Hard disk c) ROM d) Cache
23) On successfully closing a file , the fclose () returns .
a) NULL b) 0 ( Zero ) c) 1 ( One ) d) FILE pointer

24) Which mode opens only an existing file for both reading and writing?
a) "W" b) "W+" c) "r+" d) "a+"
25) Which of the following function is used to read character from a file?
a) getc ( ) b) putc ( ) c) fputs ( ) d) fgets ( )
26) Which of the following function is used to write string to a file?
a) getc ( ) b) putc ( ) c) fputs ( ) d) fgets ( )
27) An array subscript should be.
a) int b) float c) duble d) real
28) Which of the following character is used to mark the end of the string?
a) \0 b) /0 c) \a d) \n
2. Write "T" for a true statement and "F" for a false statement (1 x 6 = 6)
29) A picture cannot be stored in a test file .
☐ True ☐ False

30) EOF marks the end of a string .


☐ True ☐ False

31) A null character marks the end of a text file .


☐ True ☐ False

32) Text files are stored in a FILE * ( file pointer ) .


☐ True ☐ False

33) C can handle text files only .


☐ True ☐ False

34) When an existing file is opened in "w" mode , its contents are over-written .
☐ True ☐ False
3. Fill in the blanks. (1 x 5 = 5)
35) A ___________ can store text only .
36) EOF stands for ____________ .

37) The __________ function is used to open a file .

38) An opened file must be ___________ before terminating the program .

39) A file opened in ___________ mode can be read and appended .

You might also like