SCHOLARS COLLEGE
CIMS School SARAI
SystemMUGHAL Sarai Mughal Ph: 03064664737
Student Name: Class: 2nd Year
Paper Type: Subjective Subject: Computer Science
Paper Time: 30 Maximum Marks: 23
Q1. Choose the correct option. (15X1=15)
1. Which mode opens only an existing file for both reading and writing?
(A) "w" (B) "w+" (C) "r+" (D) "a+"
2. A stream can associated from a file using ........... operation.
(A) Open (B) New (C) Ready (D) Start
3. A ............ can store text only.
(A) Binary file (B) text file (C) exe file (D) object file
4. The fopen() function uses .......... parameters.
(A) 1 (B) 2 (C) 3 (D) 4
5. In the statement FILE*FP, the * represents:
(A) Pointer (B) Variable (C) Multiplication (D) Parameter
6. Which of the following function is used to write a string to a file?
(A) puts() (B) putc() (C) fputs() (D) fgets()
7. An array script should be:
(A) int (B) float (C) double (D) an array
8. Which of the following character is used to mark the end of the string?
(A) o (B) (C) A and B (D) None of these
9. Which of the following function is used to copy a string to an array of characters?
(A) strcpy (B) strpcy (C) strycp (D) copy
10. Which of the following function is used to write character to a file?
(A) putc( ) (B) putc() (C) fputs() (D) fgets()
11. In text file data is stored in:
[GRW, 2014]
(A) ASCII-code (B) Binary code (C) Octal-code (D) Text code
12. Which memory location contains the address of another memory location?
[RWP, 2022]
(A) Function (B) Program (C) variable (D) pointer
13. The function which is used to close a file:
[LHR, 2022]
(A) fclose () (B) F"rt" (C) fopen (D) Both (A) and (B)
14. Which of the following function is used to write a character to a file:
[LHR, FSD, 2018]
(A) getc () (B) fputs () (C) putc () (D) Fgets ()
15. A string is sequence of ...........
[SWL, 2022]
(A) symbols (B) numbers (C) letter (D) All of these
Q2. Write down short answers of following questions. (4X2=8)
ـ
[i ] What is binary stream?
ـ
[ii ] How is end of text file indicated?
[GRW, GI, 2023]
ـ
[iii ] What type of varibles are declared outside any function?
[LHR, 2021]
ـ
[iv] What is string Handling?
[LHR, 2023]