0% found this document useful (0 votes)
18 views12 pages

12 CS MADURAI SAHO SET 1 MS - New

The document is a pre-board examination paper for Computer Science for Grade XII, with a total of 37 questions divided into five sections. Each section varies in the number of questions and marks, with programming questions required to be answered in Python. The exam has specific instructions regarding question attempts and includes various types of questions, including multiple-choice, programming, and case studies.

Uploaded by

vedeshadaikkalam
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)
18 views12 pages

12 CS MADURAI SAHO SET 1 MS - New

The document is a pre-board examination paper for Computer Science for Grade XII, with a total of 37 questions divided into five sections. Each section varies in the number of questions and marks, with programming questions required to be answered in Python. The exam has specific instructions regarding question attempts and includes various types of questions, including multiple-choice, programming, and case studies.

Uploaded by

vedeshadaikkalam
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/ 12

MADURAI SAHODAYA SCHOOLS COMPLEX

PRE BOARD EXAMINATION


ACADEMIC YEAR 2024-2025
ROLL NO: SUBJECT CODE: 083
GRADE : XII SUBJECT: COMPUTER SCIENCE
MAX MARKS : 70 DURATION: 3 Hrs.

GENERAL INSTRUCTIONS:

● Please check this question paper contains 37 questions.


● All questions are compulsory. However, internal choices have been provided
in some questions. Attempt only one of the choices in such 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 4 questions (29 to 32). Each question carries 3 Marks.
● Section D consists of 2 case study type questions (33 to 34). Each question
carries 4 Marks.
● Section E consists of 3 questions (35 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written.
Q Section-A (21 x 1 = 21 Marks) Marks
No.
1 CBSE 1
2 1
my_dict.pop()
3 1
INSERT INTO
4 'Ncert.nic.in' 1
5 34.0 1
6 True 1
7 15#5$15 1
8 An IP address is used to identify a computer on a network. 1
9 It is used to connect multiple computers in a network. 1
10 COUNT() 1
11 ['M', '', 'C - MDU'] 1
12 True 1
13 A foreign key is used to establish a relationship between two tables. 1
14 Telephone network. 1
15 VARCHAR 1
16 It automatically closes the file after the block of code is executed 1
17 ('', 'C', 'omputer Sci') 1
18 ALTER TABLE <old_table_name> RENAME TO <new_table_name> 1
19 Both (b) and (c) 1
20 (C) Assertion (A) is true, but Reason (R) is false. 1
21 (A) Both Assertion (A) and Reason (R) are true, and Reason (R) is the correct 1
explanation of Assertion (A).
Q Section-B (7 x 2 = 14 Marks) Marks
No.
22 def factorial(n): 2
f+=i
return f
n=5
f1=factorial(5)
print(f1)
23 Identity Operator Membership Operator 2
i. Identity operators are i. Membership operators
used to compare the are used to check if a
memory location of two value exists in a
objects. sequence (such as a list,
string, tuple, or set).
 is: Returns True if two  in: Returns True if the
variables point to the specified value is found in
same object in memory. the sequence (list, string,
etc.).
 is not: Returns True if two  not in: Returns True if the
variables point to specified value is not
different objects in found in the sequence.
memory.
24  Immutability Tuples are immutable, meaning once they are created, 2
their elements cannot be changed, added, or removed
 Tuples are generally faster than lists when it comes to iteration and
accessing elements because they are immutable.
25 Madurai#32000 2
26 def factorial(n): 2
f+=i
return f
n=5
f1=factorial(5)
print(f1)
27 I) 2
 The UNIQUE constraint ensures that all values in a column are
unique, i.e., no two rows can have the same non-NULL value.
 It allows NULL values in the column because NULLs are considered
distinct from each other in SQL, meaning multiple NULLs are allowed.
II)
 ALTER TABLE command along with the DROP CONSTRAINT clause.
 Alter table tablename drop primary key.
Or
I. ALTER TABLE MOBILE ADD PRIMARY KEY(M_ID);
II. To ensure that NULL values are not allowed in a column,
but duplicate values are allowed, you should use the NOT
NULL constraint on that column.
28  A MAC address is a unique identifier assigned to the network interface 2
card (NIC) or network adapter of a device, such as a computer,
smartphone, or printer, for use in network communication.

 VOIP stands for Voice Over Internet Protocol, which is a technology


that allows voice communication and multimedia sessions (like video
calls) over the internet or any other IP-based network
Q Section-C (4 x 3 = 12 Marks) Marks
No
29 A) 3

def COUNT():

try:

with open('Anthem.txt', 'r') as file:

line_number = 1

for line in file:

count_a = line.lower().count('a')

print(f"Line {line_number}: {count_a} occurrences of 'a'")

line_number += 1

except FileNotFoundError:

print("The file 'Anthem.txt' was not found.")

except Exception as e:

print(f"An error occurred: {e}")

COUNT()

b)

def Ending_with_L():
try:

with open('Anthem.txt', 'r') as file:

line_number = 1

for line in file:

if line.rstrip().endswith('l'):

print(f"Line {line_number}: {line.rstrip()}")

line_number += 1

except FileNotFoundError:

print("The file 'Anthem.txt' was not found.")

except Exception as e:

print(f"An error occurred: {e}")

Ending_with_L()
30 A. 3
s=[['BBA',250000,3],
['MBA',200000,4],
['BA',100000,5]]
a=[]
def Push_element(i):
a.append(i)
for i in s:
if i[1]>100000:
Push_element(i)
def Pop_element(a):
if a!=[]:
return a.pop()
while True:
if a!=[]:
print(Pop_element(a))
else:
break
OR

B.

d_city={'Tamil Nadu':'CHE','Kerala':'Alappuzha','Karnataka':'Bangalore'}
stack=[]
def push_city(i):
stack.append(i)
for i in d_city:
if len(d_city[i])>4:
push_city(d_city[i])
def Pop_city(stack):
if stack!=[]:
return stack.pop()
while True:
if stack!=[]:
print(Pop_city(stack))
else:
print('Stack is empty')
break
31 {'hi': 35, 'hello': 90} 3
or
2#[4, 2, 6, 2, 4]
Q Section-D (2 x 4 = 8 Marks) Marks
No.
32 import csv
def APPEND():
books = [
['B101', 'Python Programming', 650],
['B102', 'Data Science Handbook', 1200]
]

with open('BOOK.csv', mode='a', newline='') as file:


writer = csv.writer(file)
for book in books:
writer.writerow(book)
print("Two book records have been added to BOOK.csv.")
def DISP():
count = 0
try:
with open('BOOK.csv', mode='r') as file:
reader = csv.reader(file)
next(reader, None)
for row in reader:
price = float(row[2]) # Price is in the third column (index 2)
if price > 500:
count += 1
print(f"Books above price 500: {count}")

except FileNotFoundError:
print("The file BOOK.csv does not exist. Please create the file first.")
except Exception as e:
print(f"Error occurred: {e}")
33 I. SELECT customerID, COUNT(*) AS number_of_orders FROM 4
ORDERS GROUP BY customerID;
II. SELECT DISTINCT customerID FROM ORDERS;
III. SELECT productID, SUM(quantity) AS total_quantity FROM
ORDERS GROUP BY productID HAVING SUM(quantity) <= 2;
IV. SELECT * FROM ORDERS WHERE orderDate BETWEEN '2024-11-
01' AND '2024-11-04';
Or
i.

ii.
iii.

iv.
34 I. SELECT * FROM STUDENT NATURAL JOIN SPORTS; 4
II. UPDATE STUDENT SET AGE=AGE+3 WHERE MOBILE_NO LIKE
‘%4’;
III. SELECT SNAME,FNAME FROM STUDENT,SPORTS WHERE
STUDENT.ROLLNO=SPORTS.ROLLNO;
IV. SELECT * FROM SPORTS WHERE FEES BETWEEN 15000 AND
20000;

SNAME DOB GRADE

LAVANYA 2009-04-25 A
LAVANYA 2009-04-25 NULL
RAMANASAI PSS 2009-02-16 B
35 import mysql.connector 4
def connect_to_db():
try:
# Connect to MySQL using provided details
conn = mysql.connector.connect(
host='localhost',
user='root',
password='tiger',
database='company'
)
def display_records():
conn = connect_to_db()
if conn is None:
return
try:
cursor = conn.cursor()
query = "SELECT * FROM Emp WHERE Age > 55"
cursor.execute(query)

records = cursor.fetchall()
if len(records) > 0:
print("Records where Age > 55:")
for record in records:
print(f"EmpNo: {record[0]}, EmpName: {record[1]}, Age:
{record[2]}, Salary: {record[3]}")
else:
print("No records found where Age > 55.")

except mysql.connector.Error as err:


print(f"Error executing query: {err}")
finally:
cursor.close()
conn.close()
display_records()
Q Section-E (3 x 5 = 15 Marks) Marks
No.
36 import pickle 5
def write():
f=open('D:/testing1.dat','wb')
L=[]
while True:
c_id=int(input('enter c_id'))
c_name=input('enter name')
desig=input('enter desig')
exp=float(input('enter exp'))
sal=int(input('enter salary'))
L.append([c_id,c_name,desig,exp,sal])
a=input('do you want to contnue(y/n):')
if a=='y':
continue
else:
break
pickle.dump(L,f)
f.close()
write()
def exp():
f=open('D:/testing1.dat','rb')
a=pickle.load(f)
#print(a)
b=a
#print(b)
f.close()
f1=open('D:/testing1.dat','wb')
c=0
print(b)
for i in b:
if int(i[-1])>10.0:
b[c][4]=b[c][4]+b[c][4]*0.05
c+=1
pickle.dump(b,f1)
f1.close()
print(b)
exp()
def desig():
f=open('d:/testing1.dat','rb')
a=pickle.load(f)
n=0
for i in a:
print(i)
f.close()
desig()
37 I. a) LAN 5
b) PAN
II. STAR TOPOLOGY

K
Amrita
Block R

A I
D
M S
I
Sai Block N H

III. Admin. It has maximum no.of computers


IV. Yes, Because distance is more than 100 m.
Amrita to Admin 200 m
Amrita to Sai 250 m
Amrita to Krishna 120 m
Krishna to Sai 230 m
Sai to Admin 300 m

V. HUB/SWITCH

You might also like