0% found this document useful (0 votes)
110 views

XII CS Term-1 Question Paper 2024-25

Woah

Uploaded by

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

XII CS Term-1 Question Paper 2024-25

Woah

Uploaded by

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

Shri Bhairavnath Shikshan Sanstha’s

Aditya English Medium School


Affiliation No. 1130831
Baner, Pune – 411045
Term-I Examination
2024-2025

Sub – Computer Science (083) Grade- XII


Marks - 70 Time- 3 Hours

General Instructions:

1. Please check this question paper contains 35 questions.


2. The paper is divided into 4 Sections- A, B, C, D and 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 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
8. All programming questions are to be answered using Python Language only.

Section A
1. State True or False: “In a Python program, if a break statement is given in a nested loop, it 1
terminates the execution of all loops in one go.”

2. What will be the output of the following statement: print(3-2**2**3+99/11) 1


(a) 244
(b) 244.0
(c) -244.0
(d) Error

3. Which of the following commands can be used to read “n” number of characters from a 1
file using the file object <file>?
(a) file.read(n)
(b) n=file.read()
(c) readline(n)
(d) readlines().file

4. Evaluate the expression given below if A=30 and B=20 1


A% B // A.

(a) 0.00
(b) 0
1
(c) 1.0
(d) 1

5. What is the significance of the tell() method? 1


(a) tells the path of the file.
(b) tells the current position of the file pointer within the file.
(c) tells the end position within the file.
(d) checks the existence of a file at the desired location.

6. Find the invalid identifier from the following: 1


(a) Marks@12
(b) String_12
(c) _bonus
(d) First_Name

7. Evaluate the following Python expression: 1


print(12*(3%4)//2+6)
(a) 12
(b) 24
(c) 10
(d) 14

8. When is the finally block executed? 1


(a) when there is no exception
(b) when there is an exception
(c) only if some condition that has been specified is satisfied
(d) always

9. What will be the output of the following code? 1


tuple1=(2,4,3)
tuple3=tuple1*2
print(tuple3)
(a) (2, 4, 3, 2, 4, 3)
(b) (4,8,6)
(c) (2, 2, 4, 4, 3, 3)
(d) Error

10. When will the else part of try-except-else be executed? 1


(a) always
(b) when an exception occurs
(c) when no exception occurs
(d) when an exception occurs in to except block

11. The structure of a Python function contains a function header and ____________. 1
(a) return Statement
(b) Indented Block
(c) Function Body
(d) def Statement
12. Fill in the blank: 1
A variable is only available inside a specific region of the program, called it’s
____________.
2
13. Array or linear list comes under the category of__________. 1
(a) Simple Data Structure
(b) Compound Data Structure
(c) Random
(d) None of these

14. Fill in the blanks: 1


Stacks follows____________ order.

15. In a stack, if a user tries to remove an element from empty stack it is called ___________. 1
(a) Underflow
(b) Empty
(c) Overflow
(d) Garbage Collection

16. Any modification to a global variable is permanent and affects _________ where it is 1
used.
(a) Only one function
(b) All the functions
(c) Only two functions
(d) None of the above
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice as

a) Both A and R are true and R is the correct explanation of A


b) Both A and R are true and R is not the correct explanation for A
c) A is true but R is false
d) A is false but R is true
e) Both A and R are false
17. Assertion(A):- The seek method will move the pointer. 1

Reasoning (R):- Python file method tell() returns the current position of the file
read/write pointer within the file.

18. Assertion (A):-TOP is a pointer to the stack’s current location. 1

Reasoning (R):- Insertion and Deletion takes place from Top of the stack.

Section B
19. Rewrite the code fragment using while loop. 2

for i in range (1,10):


if i % 3== 0:
print (i)

20. What will be the output of the following code: 2


dict={'c#':6,'Java':89,'Python':4,'R':10}
for _ in sorted(dict):
print(dict[_])

3
21. Write a function to push an element into the stack. 2

22. Write a program to print the following pyramid. 2

1
22
333
4444
55555

23. Give difference between an array and a list in Python. 2

24. Explain the purpose of the dict() function using an example. 2

25. Write a statement in Python to perform the following operations 2


1. To open a text file “MYPET.TXT” in write mode
2. To open a text file“MYPET.TXT” in read mode

Section C
26. Define the following: 3
1. Exception Handling
2. Throwing an exception
3. Catching an exception

27. (i) Differentiate write() and writelines(). 3


(ii) Write the output of the following, if the data stored in the file 'quotes.txt' is given as:
'A positive mindset brings positive things'
(Assume that 'f' is the file object associated with the file. )

f=open("quotes.txt")
print(f.read(4))
print(f.read(5))
print(f.read())

28. Write a random number generator that generates random numbers between 1 and 6 3
(simulates a dice).

OR

Write a program to input any number and to check whether the given number is
Armstrong or not.

29. Convert ((A+B)*C/D+E^F)/G into postfix notation 3

30. What will be the output produced by the following code statements? 3
(i) 87//5.0*2
(ii) 17%5//3**2
(iii) 2+9*((3*12)-8)/10

4
Section D

31. Which string method is used to implement the following: 4

(i) To count the number of characters in the string.


(ii) To change the first character of the string in capital letter.
(iii)To check whether given character is letter or a number.
(iv) Change one character into another character.

32. A list contains following record of a customer: [Customer_name, Phone_number, City] 4


Write the following user defined functions to perform given operations on the stack
named ‘status’:
(i) Push_element() - To Push an object containing name and Phone number of
customers who live in Goa to the stack
(ii) Pop_element() - To Pop the objects from the stack and display them. Also,
display “Stack Empty” when there are no elements in the stack.

For example:
If the lists of customer details are:
[“Ashok”, “9999999999”,”Goa”]
[“Avinash”, “8888888888”,”Mumbai”]
[“Mahesh”,”77777777777”,”Cochin”]
[“Rakesh”, “66666666666”,”Goa”]
The stack should contain: [“Rakesh”,”66666666666”] [“Ashok”,” 99999999999”]
The output should be:
[“Rakesh”,”66666666666”] [“Ashok”,”99999999999”]
Stack Empty

Section E

33. A binary file “Book.dat” has structure [BookNo, Book_Name, Author,Price]. 5


(i) Write a user defined function CreateFile() to input data for a record
and add to Book.dat .
(ii) Write a function CountRec(Author) in Python which accepts the Author
name as parameter and count and return number of books by the given
Author are stored in the binary file “Book.dat”

34. (i) Differentiate between r+ and w+ file modes in Python. 5


(ii) Consider a file, SPORT.DAT, containing records of the following structure:
[SportName, TeamName, No_Players]
Write a function, copyData(), that reads contents from the file SPORT.DAT and
copies the records with Sport name as “Basket Ball” to the file named
BASKET.DAT. The function should return the total number of records copied to
the file BASKET.DAT.
OR
(i) Write a function ETCount() in Python, which should read each character of a
text file “TESTFILE.TXT” and then count and display the count of occurrence
of alphabets E and T individually (including small cases e and t too).

Example:

If the file content is as follows:


5
Today is a pleasant day.It might rain today.
It is mentioned on weather sites

The ETCount() function should display the output as:


The number of E or e: 6
The number of T or t : 9

(ii) Differentiate between Text file and Binary files?

35. What is the advantage of using a csv file for permanent storage? 5
Write a Program in Python that defines and calls the following userdefined functions:

(i) ADD() – To accept and add data of an employee to a CSV file ‘record.csv’. Each
record consists of a list with field elements as empid, name and mobile to store
employee id, employeename and employee salary respectively.

(ii) COUNTR() – To count the number of records present in the CSVfile named
‘record.csv’.
OR

Give any one point of difference between a binary file and a csv file.Write a Program
in Python that defines and calls the following user defined functions:

(i) add() – To accept and add data of an employee to a CSV file ‘furdata.csv’.
Each record consists of a list with field elements as fid, fname and
fprice to store furniture id, furniture name and furniture price respectively.
(ii) search()- To display the records of the furniture whose price is more than
10000.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy