PAK GARRISON HIGHER SECONDARY SCHOOL
Housing Colony Nankana Sahib
Class: 2nd Year Computer Science Maximum Marks: 29
Student Name:
Roll Number: ___________ Date of Paper: 04-03-2025
_______________
Section: ___________ Paper Type: Chapter # 9 Time Allowed: 30min
Q1. Choose the correct option. (15X1=15)
1. Variable name can not begin with a(an).
(A) Number (B) Underscore (C) Upper case letter (D) Lower case letter
2. Which of the following is not a valid identifier?
(A) return (B) myint (C) myinteger (D) total3
3. Which of the following are valid variable names?
(A) long (B) Integer (C) Notongenough (D) B and c
4. Which is a numeric data type?
(A) float (B) int (C) a and b (D) char
5. The data type that can handle decimal places is.
(A) int (B) float (C) char (D) string
6. Which of the following data type is used to string value?
(A) char (B) float (C) string (D) long
7. Which variable should be used to store the value `I want an A in this exam`.
(A) char (B) int (C) float (D) string
8. Which of the following are required to declare a variable?
(A) Keyword (B) Variable name (C) Data type (D) B and c
9. Which of the following data type is most appropriate for storing a name?
(A) float (B) int (C) char (D) long
10. A process of assigning value to a variable at the time of declaration is called.
(A) Assigning (B) Initializing (C) Naming (D) Setting
11. Which of the following statements is correct?
(A) Float num1;num2; (B) int day, night; (C) int continue=5.0 (D) string black=white
12. Which of the following is an illegal variable name?
(A) Cust-num (B) Jan2009 (C) Day of weak (D) 2d graph
13. In C, the maximum length of variable name is:
(A) 25 characters (B) 255 characters (C) 31 characters (D) 55 characters
14. Int is a ............. in C.
(A) Special word (B) Key word (C) Cut word (D) First word
15. Which of the following is not a commonly used data type in programming?©
(A) Integer (B) String (C) Float (D) Loop
Q2. Write down short answers of following questions. (7X2=14)
[i] ـWhich of the following are variable names in C? (i) income (ii) total marks (iii) double (iv) average - score (v) room#
(vi) _area (vii) no_of_students (viii) long (ix) Item (x) MAX_SPEED
[ii] ـWrite a C statement to initialize three integer variables named A, B and C and assign them the values 10, 20 and 30
respectively.
[iii] ـInitialize three variables T1,T2,T3 in a single line by assigning values 48,45 and 39 respectively.
[iv] ـWrite down C statement to declare theree character variables ch1, ch2, ch3 in one line.
[v] ـDeclare an integer variable with name marks and store 799 in it.
[vi] ـWrite C Statement to declare Integer Variable x and assign any value to x.
[vii] ـWrite single C statement to initialize two integer variables x and y to 0