0% found this document useful (0 votes)
112 views4 pages

Half Yearly Exam Class 12 CS Python

The document outlines the Half Yearly Examination for Class 12th in Computer Science with Python, consisting of 35 questions divided into 5 sections (A to E) with varying marks. Section A contains 18 one-mark questions, Section B has 7 two-mark questions, Section C includes 5 three-mark questions, Section D has 2 four-mark questions, and Section E consists of 2 five-mark questions. Each section tests different aspects of Python programming and computer science concepts.

Uploaded by

itsmuksh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views4 pages

Half Yearly Exam Class 12 CS Python

The document outlines the Half Yearly Examination for Class 12th in Computer Science with Python, consisting of 35 questions divided into 5 sections (A to E) with varying marks. Section A contains 18 one-mark questions, Section B has 7 two-mark questions, Section C includes 5 three-mark questions, Section D has 2 four-mark questions, and Section E consists of 2 five-mark questions. Each section tests different aspects of Python programming and computer science concepts.

Uploaded by

itsmuksh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Half Yearly Examination 2024-25

Class - 12th
Sub - Computer Science with Python (083)
M.M. 70
Time: 3:00 hr.

General Instructions:
1. Please check this question paper which contains 35 questions.

2. The paper is divided into 5 sections A, B, C, D, E.

3. Section A, consists of 18 questions. (1 to 18) Each question carries 1 mark.

4. Section B, consists of 7 questions. (19 to 25) Each question carries 2 mark.

5. Section C, consists of 5 questions. (26 to 30) Each question carries 3 mark.

6. Section D, consists of 2 questions. (31 to 32) Each question carries 4 mark.

7. Section E, consists of 2 questions. (33 to 35) Each question carries 5 mark.

Section A
1. Q.1 State true or false.
Write defining a function in Python, the positional parameter in the function header
must always be written after the default parameters.
2. Q.2 What will be the output of the following statement?
print(25//5/2.0 + 20/10)
a. 1.0 b. 5.0 c. 10.0 d. 16.1
3. Q.3 Consider the given expression –
print(2>0 or 17<7 and not 7<4)
a. True b. False c. None d. Null
4. Q.4 The numbered position of a letter in a string is called…………
a. Position b. Integer position c. index d. location
5. Q.5 Which of the following function/method of the csv module?
a. reader() b. writer() c. load() d. read()
6. Q.6 What is the output of the code >>>int(“3”+“4”)?
a. “7” b. “34” c. 34 d. 3+4
7. Q.7 What will be value of x >>> x = (1,2,3)+(4,5,6)?
a. (1,2,3,4,5,6) b. (1,2,3)+(4,5,6) c. (5,7,9) d. Error
8. Q.8 What will be the output of the following?
>>> str = “Mera Bharat Mahan”
>>> str[:]
a. Mera b. ‘Mera Bharat Mahan’ c. Mahan d. Error
9. Q.9 Which of the following function header is correct?
a. def f(a=1, b): b. def f(a=1, b, c=2):
c. def f(a=1, b=1, c=2): d. def f(a=1, b=1, c=2, d):
10. Q.10 Which function is used to write all characters in file?
a. write() b. writecharacters() c. writell() d. writechar()
11. Q.11 What is the significance of seek() method?
a. seeks absolute path of the file b. tells current byte position
c. It place the file pointer at desired location d. seeks the entire content of the file
12. Q.12 Which of the following will delete key-value pair for key=“Red” from the dictionary
D1?
a. delete d1(“Red”) b. del D1[“Red”] c. del.D1[“Red”] d. D1.del[“Red”]
13. Q.13 Evaluate the expression if A=16 and B=15 then what will be the value of x = A
%B//A
a. 0.0 b. 0 c. 1.0 d. 1
14. Q.14 Which among the list of operators has the highest precedence? +,-,**,%,//,<<,>>,|
a. <<,>> b. ** c. | d. %
15. Q.15 What is the output if x=>(10,12,14,20,22,24,30,32,34) then what will be the value
of x[2:10:3]
a. (12,22,32) b. (10,20,30) c. (14,24,34) d. Error
16. Q.16 Which is not a mutable data type?
a. list b. dictionary c. Integer variable d. set
17. Q.17 Assertion (A) Each element in the list can be traversed.
Reason (R) List cannot be traverse.
a. Both A and R are true and R is correct explanation for A.
b. Both A and R are true and R is not a correct explanation for A.
c. A is true but R is false. d. A is false but R is true.
18. Q.18 Assertion (A) Assigning a new value to an int variable creates a new variable.
Internally.
Reason (R) The int type is immutable data type of Python.

Section B
19. Q.19 (a) Explain the core data types of Python.
(b) How to put decimal, octal and hexadecimal values into a variable, show it with
example.
20. Q.20 (a) What is entry controlled loop? Which loop is entry controlled?
(b) What would be the output produced by the following code:
import math
import random
print(math.ceil(random.random()))
21. Q.21 What is the difference between actual parameter and formal parameter, explain
with suitable example.
22. Q.22 Write a function to calculate factorial of a given number.
23. Q.23 What are the advantages of saving data in 1. Binary form 2. Text form 3. Csv file.
24. Q.24 Predict the output of the following:
def func(msg, num=2):
print(msg*num)
func(5)
func("vidya", 2)
25. Q.25 Write a function that receives a string and abbreviate the given string - for e.g.
saraswati vidya mandir ass.s.v.m.
OR
Write a program to get roll number, name and marks of the students of a class (get from
user) and store these details in file called 'Marks.txt'.

Section C
26. Q.26 Explain Python try, except and finally with a suitable example.
27. Q.27 Write a function in Python to count the total number of alphabets and digits
present in a text file abc.txt
OR
Write a program to read a text file line by line and display each word separated by a #.
28. Q.28 Write the need to handle an exception, why it is necessary?
29. Q.29 Write the various Modes used in Data File Handling and explain their usage.
30. Q.30 Predict the output of the following code fragment:
def check(n1=1,n2=2):
n1 = n1 + n2
n2 = n2 + 1
print(n1,n2)
check()
check(2)
check(3)

Section D
31. Q.31 Explain the following functions:
a. input() b. int() c. gcd() d. floor()
32. Q.32 Explain mutable and immutable types, explain with example.
What is the difference between a local variable and a global variable? Also give a
suitable Python code to illustrate both.

Section E
33. Q.33 Write a program to copy a text file source.txt onto target.txt barring the lines
starting with a '@' sign.
34. Q.34 (a) What is pickling and unpickling process?
(b) Predict the output of the following code fragment:
def fun(s):
k = len(s)
m = ""
for i in range(0, k):
if(s[i].lower()):
m = m + s[i].lower()
elif s[i].isalpha():
m = m + s[i].upper()
else:
m = m + "@"
print(m)
fun("My@Bharat@COM")
35. Q.35 Write a function in Python that counts the number of 'Me' or 'My' words present in
a text file POEM.TXT
OR
Write a function in Python to count the number of lines in text file 'STORY.TXT' which is
starting with an alphabet 'B'.

You might also like