Wednesday , October 14 2026
Class XI & XII Computer Science: Python

Class 12 Computer Science Mid Term Examination 2026 – 27: St. Margaret School, Rohini, New Delhi

School Name: St. Margaret Sr. Sec. School, D-Block, Prashant Vihar, Sector 14, Rohini, Delhi 110085
Class: XII
Subject: Computer Science (083)
Exam: Periodic Test I (2026–27)
Time: 3 Hr
Maximum Marks:  70

General Instructions:

This question paper contains 37 questions.

  • The paper is divided into 5 sections: A, B, C, D, and E.
  • Section A consists of 21 questions (1 to 21). Each question carries 1 mark.
  • Section B consists of 7 questions (22 to 28). Each question carries 2 marks.
  • Section C consists of 3 questions (29 to 31). Each question carries 3 marks.
  • Section D consists of 4 questions (32 to 35). Each question carries 4 marks.
  • Section E consists of 2 questions (36 to 37). Each question carries 5 marks.
  • In the case of MCQs, the text of the correct answer should also be written.

SECTION – A (21 X 1 = 21 Marks)

Question 01: Write a statement in Python to declare a dictionary whose keys are 1, 2, 3 and values are month names respectively. (1)

Question 02: Write the missing statement to complete the following code: (1)

file = open(“example.txt”, “r”)
data = file.read(100)
_____________________Move the file pointer to the beginning of file
next_data= file.read(50)
file.close()

Question 03: Find the valid identifier from the following (more than one option can be correct): (1)

a) in
b) While
c) Day_two
d) _init_

Question 04: Suppose a tuple T is declared as T = (10, 12, 43, 39), Identify the incorrect one: (1)

a) print(T[1])
b) print(max(T))
c) T[2] = – 29
d) print(len(T))

Question 05: CSV means:

a) Collective String Value
b) Comma Separated Value
c) Comma String Value
d) Common Separated Values

Question 06: Identify the statement to open a binary file write data from a list Ist1: [1,2,3,4] on it:

a) with open(‘record.bin’,’wb’) as myfile:
pickle.dump(Ist1,myfile)

b) with open(‘record.bin’,’wb’) as myfile:
pickle.dump(myfile,lst1)

c) with open(‘record.bin’,’wb+’) as myfile:
pickle.dump(myfile,lst1)

d) with open(‘record.bin’,’ab’) as myfile:
pickle.dump(myfile,lst1)

Question 07: I will use ____________ to have an audio-visual chat with an expert sitting in a faraway place to fix-up a technical issue.

a) Email
b) VoIP
c) FTP
d) SMTP

Question 08: Identify the valid arithmetic operator in Python from the following.

a) ?
b) <
c) **
d) and

Question 09: Identify the valid arithmetic operator in Python from the following.

a) A newline gets added to the file
b) Empty string gets appended to the first line.
c) Empty string gets appended to all lines.
d) EOL translation is suppressed

Question 10: ________ the most expensive wired medium of data transmission, explain.

Question 11: Predict the output of the Python code given below also justify your suggested output:

def add (num1, num2):

sum= num1+num2

sum = add(20,30)

print(sum)

Question 12: Identify the TRUE statement regarding opening a text file in using the ‘r’ mode:

a) If the file does not exist, Python raises a FileNotFoundError.
b) Python creates the file automatically if it does not exist.
c) The file is opened in write mode by default.
d) The contents of the file are erased before opening.

Question 13: Stack follows ____________ principle-

a) LIFO
b) FIFO
c) FIFA
d) LIFA

Question 14: The following statement will execute ____________ times for i in range (2,15,3):

a) 6 times
b) 5 times
c) 0 times
d) infinitely

Question 15: Name the error that is returned if identifier is not found –

a) Type Error
b) EOFError
c) NameError
d) AttributeError

Question 16: Identify the correct way to call a function:

a) my_func()
b) def my_func()
c) return my_func
d) call my_func()

Question 17: Differenciate between the global and local variables.

Question 18: Function can return-

a) No values
b) Single value
c) Multiple values
d) All of above

Question 19: Stack is implemented in Python using ______________ –

a) list
b) String
c) dictionary
d) tuple

Assertion(A) and Reason(R) based questions. Mark the correct choice as:

a) Both A and R are true and R is the correct explanation for 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

Question 20:

Assertion (A): Positional arguments in Python functions must be passed in the exact order in which they are defined in the function signature.
Reasoning (R): This is because Python functions automatically assign default values to positional arguments.

Question 21:

Assertion (A): Multiple text files may be cpened together for processing.
Reasoning (R): Python allows creation and association of multiple file objects linked to text files.

SECTION – B (7 X 2 = 14 Marks)

Question 22: Predict the output of the following code:

def ChangeVal(M,N):
for i in range(N):
if M[i]%5 == 0:
M[i]//=5
if M[i]%3 == 0:
M[i]//=3
L = [25,8,75,12] ChangeVal(L,4)
for i in L:
print(i,end=”#”)

Question 23: Write the full forms of the following:

a) ARPANET b) XML

Question 24: Suppose content of ‘Myfile.txt’ is : Ek Bharat Shreshtha Bharat

Identify the output of the following code:

myfile = open(“Myfile.txt”)
vlist = list(“aeiouAEIOU”)
vc=0
x= myfile.read()
for y in x:
if(y in vlist):
vc+=1
print(vc)
myfile.close()

Question 25: Consider the following directory structure.

Suppose root directory (School) and present working directory are the same. What will be the absolute path of the file Syllabus.jpg?

Question 26: Explain the following, with the help of an example:

a) parameters b) default arguments

Question 27:

Explain the use of return statement in a function, with the help of an example. Discuss the cases when a function return None.

Question 28: Predict the output of following code –

def change():
boys={“A”:13,’B’:14,’C’:27}
girls={‘A’:18,’B’:16,’C’:14}
total={}
for c in boys:
total[c]=boys[c]+girls[c] return total
print(change())

SECTION – C (3 X 3 = 9 Marks)

Question 28: Write the definition of following user-defined functions:

a) push_even(N) which accepts a list of integers in a parameter ‘N’ and pushes all those integers which are even from the list ‘N’ into a Stack named ‘EvenNumbers’.
b) pop_even() to pop the topmost number from the stack and returns it. If the stack is already empty, the function should display “Empty”.
c) Disp_even() to display all element of the stack without deleting them. If the stack is empty, the function should display ‘None’.

For example:

If the integers input into the list ‘VALUES’ are: [10, 5, 8, 3, 12] Then the stack ‘EvenNumbers’ should store: [10, 8, 12]

Question 30:

Write a program, which takes the data of 1000 employees of an organization and process this data to generate the Salary Report for 1000 employees, also print the data of all those employees , who have a salary more than 50000 , per month. Assume that the data is already existing in a binary file, the name of which is asked at the run time.

Question 31:

Write a function AMCount() in Python, which should read each character of a text file STORY.TXT, should count and display the occurance of alphabets A and M (including small cases a and m too).

Example: If the flle content is as follows: Updated information
As simplified by official websites.

The EUCount() function should display the output as:

A or a : 4
M or m : 2

SECTION – D (4 X 4 = 16 Marks)

Question 32:

Amit Seth is a programmer, who has recently been given a task to write a python code to perform the following binary file operations with the help of following user defined function / module:

Add() – to create a binary file called STUDENT.DAT containing student information – roll number, name and Percentage of each student.

The function should also add records to file. He has succeeded in writing partial code and has missed out certain statements, so he has left certain queries in comment lines. You as an expert of Python have to provide the missing statements based on the following code written by Amit.

import _______________________ #Statement 1
def Add():
f= ____________________________ # Statement 2 to open binary file.
while True:
r=input(“Roll:”)
n=input(“Name:”)
p=float(input(“Score:”))
L=[r,n,p] ______________________________ # Statement 3 to write record in the file
ch=input(“Continue?”)
if ch not in’yY’:
break
_____________________________ #Statement 4 to close file

a) Name the module to be imported in the program. (Statement-1)
b) Write the correct statement required to open binary file STUDENT.DAT to write data. (Statement 2)
c) Fill in Statement-3 to write the list Linto the file .
d) Write the statement to fill In Statement- 4 to close the binary file.

Question 33:

Differentiate between the following, Support your answer with appropriate example :
a) r + and W+ file modes
b) library and user defined functions.

Question 34:

a) Explain llsts data structures in PYTHON, where are they used?
b) Consider list A given below and write the output of the statements that follow:
A=[3,6,7,8,10,12,23,33,16,6,2,1]

a) print(A[3 ::- 2])
b) print(A[-3 ::- 2])
c) print(A[3 :- 3 :- 3])
d) print(len(A[3:]))

Question 35: Explain the following (with the help of appropriate examples):

a) Method of reading from a CSV File.
b) STACK data structure, and it 2 uses in computer systems.

SECTION – E (2 X 5 = 10 Marks)

Question 36: Assume a csv file is created using MS-Excel with the following data:

Name, Age, Qualification, Experience
Ananya, 32, PG, 8

Write a menu driven program to perform the following operations on the file:

a) Append record(s) to the file
b) Display all the data from the file
c) Display all the records with Age<30
d) Increase the Experience of all the records by 1
e) Delete a record with given name and age (to be input from the user)

Question 37: Malala International has setup its new centre in Abu island. It has four buildings named Accounts, Research, store and Packaging:

Distances between various buildings are as follows:

Accounts to Store  150m
Packaging Unit to Research Lab  60m
Store to Research Lab 185m

Accounts to Research Lab  150m
Store to Packaging Unit  260m
Accounts to Packaging Unit  380m

Number of computers:

Accounts  125
Store  150

Research Lab  150
Packaging Unit  160

As a network expert, provide the best possible answer for the following queries:

a) Suggest the type of network established between the buildings.
6) Suggest the most suitable place (i.e., building) to house the server of this organization.
c) Suggest the placement of the following devices with justification:
(i) Repeater (ii) Hub / Switch
d) Suggest a system (hardware/software) to prevent unauthorized access to or from the network.
e) How to provide internet connectivity In between all the wings?

Check Also

12th Class English NCERT Textbooks

Class 12th English Core Periodic Test I Question Paper 2026 – 27: St. Margaret School, Rohini, New Delhi

School Name: St Margaret Sr Sec School Class: XII Subject: English Core (301) Exam: Periodic …

Leave a Reply