0% found this document useful (0 votes)
11 views10 pages

CS Model I AK

Uploaded by

darkling527
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)
11 views10 pages

CS Model I AK

Uploaded by

darkling527
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/ 10

CHINMAYA VIDYALAYA, CMECT - GC

MODEL EXAMINATION I, 2024-25


COMPUTER SCIENCE (083)
Marking Scheme

SECTION A
1 mark for each correct answer
1. True

2. (B) TheQUICK_BROWN_FOX

3. (B) True or not(False)

4. (A) Pytho+isfu+

5. (D) ginyn

6. (C) (1, 2, 3, 5) (1, 2, 3, 4)

7. (B) print(fruit_prices['mangeo'])

8. (D) Removes the element at index x from the list and returns it.

9. (C) 4

10. (A) tell

11. False

12. (D) Error

13. Delete

14. (A) Details of all orders placed in October 2024

15. (C) The maximum length of a VARCHAR column is always less than that of a
CHAR column.

16. (D) COUNT(DISTINCT column_name)

17. (C) SMTP

18. (B) Router

19. Circuit Switching

20. (A)Both A and R are true and R is the correct explanation for A

21. (B)Both A and R are true and R is not the correct explanation for A

Section-B ( 7 x 2=14 Marks)

Page 1
22. (A):

a is mutable (list), so its contents can change.

c is immutable (tuple), so its contents cannot change.

(B):

b = [1, 2, 3, 4]

d = (5, 6, 7, 8)

½ mark for each correct explanation & ½ mark for each correct output

23. (I) Assignment Operators: Used to assign values (=, +=, -=).

(II) Identity Operators: Used to check if two objects are the same (is, is not).

(III) Membership Operator: Used to check if a value is present in a sequence (in,


not in).

(IV) Logical Operators: Used to combine conditions (and, or, not).

½ mark for each correct example

24. (I)(A): del L1[-2] Or L1.pop(4)

(I)(B): min(L1)

(II)(A): L2.extend([10, 20])

(II)(B): L1.sort(reverse=True) Note: Any other correct statement also to be


considered

1 mark for correct answer

25. Expected Outputs: (A) 30@, (C) 20@30


Maximum values: BEG = 2, END = 4.
½ mark for each correct answer
26. def reverse_list(lst): # Added a colon at the end of the fun definition
if not lst:
return lst # Indented this line correctly for Python's syntax
reversed_lst = lst[::-1]
return reversed_lst

print("Reversed list:", reverse_list([1, 2, 3, 4]))

(½ mark each for correcting 4 mistakes)


27. (I) (A) Foreign Key OR (B) Unique
(1 mark for correct answer)

Page 2
(II)(A) ALTER TABLE Users MODIFY email VARCHAR(25);
OR
(B) ALTER TABLE Customers ADD PRIMARY KEY (Customer_ID);
(1 mark for correct answer)
28. (A): MODEM stands for Modulator-Demodulator, used for converting digital data
to analog signals and vice versa in networking.
(1 mark for correct expansion)
(1 mark for correct usage)
(B): In mesh topology, the advantage is high reliability and fault tolerance, while
the disadvantage is high cost and complexity due to numerous connections.
(1 mark for correct Advantage)
(1 mark for correct Disadvantage)
SECTION C

29. (A)

def extract_lines_with_to_do():
try:
with open("Vocab.txt", "r") as file:
for line in file.readlines():
if "TO" in line.upper() or "DO" in line.upper():
print(line.)
except FileNotFoundError:
print("The file 'Vocab.txt' was not found.")

(½ mark for correct function header)


(½ mark for correctly opening the file)
(½ mark for correctly reading from the file)
(½ mark for loop)
(1 mark for correctly displaying the desired line)
OR
(B)
def display_hyphenated_words():
with open('HyphenatedWords.txt', 'r') as file:
words = file.read().split()
for word in words:
parts = word.split('-')
if len(parts) == 2 and len(parts[0]) == 3 and len(parts[1]) == 4:
print(word)
½ mark for file opening

Page 3
½mark for correct loop
½mark for correct use of split( )
1 mark for correct condition
½ mark for output display
30. (A) MovieStack Implementation

(I) def push_movie(MovieStack, new_movie):

MovieStack.append(new_movie)

(II)

def pop_movie(MovieStack):
if MovieStack:
return MovieStack.pop() # Removes and returns the topmost movie
else:
print( "Stack is empty")

(III)

def peek_movie(MovieStack):
if MovieStack:
return MovieStack[-1] # Returns the topmost movie without removing it
else:
print( "None")

(3x1 mark for correct function body; No marks for any function header as it

was a part of the question)

(B)

(I) OddNumbers = []

def push_odd(M):
for num in M:
if num % 2 != 0:
OddNumbers.append(num)
(II)
def pop_odd():
if OddNumbers:
return OddNumbers.pop()
else:
print( "Stack is empty")
(III)
def disp_odd(OddNumbers):

Page 4
if OddNumbers:
print( OddNumbers )
else:

print("None")

(3x1 mark for correct function body; No marks for any function header as it

was a part of the question)

31. cO*P*t*R

OR

(22, 44, 66)


SECTION D

32. (A)

(I) select Product, sum(Quantity) from orders group by product having


sum(Quantity)>=5;

(II) select * from orders order by Price desc;

(III) select distinct C_Name from orders;

(IV) select sum(price) as total_price from orders where Quantity IS NULL;

(4 x 1 mark for each correct query)

OR

(B)

(I)

C_Name | Total_Quantity
--------- |---------------
Jitendra | 1
Mustafa | 2
Dhwani | 1
Alice |1
David | NULL
(II)
O_Id | C_Name | Product | Quantity | Price
----- |-------- |------------ |---------- |-------
1002 | Mustafa | Smartphone | 2 | 10000
1003 | Dhwani | Headphone | 1 | 1500
1004 | Alice | Smartphone |1 | 9000

Page 5
(III) O_Id | C_Name | Product | Quantity | Price
----- |---------- |------------ |---------- |-------
1001 | Jitendra | Laptop | 1 | 12000
1002 | Mustafa | Smartphone | 2 | 10000
(IV)
MAX(Price)
-----------
12000
(4 x 1 mark for each correct output)
33. (I) import csv

def filter_life_expectancy_above_75(filename):
with open(filename, mode='r') as file:
reader = csv.reader(file)
next(reader, None)
result = []
for row in reader:
if float(row[1]) > 75:
print(row)
(½ mark for opening in the file in right mode)

(½ mark for correctly creating the reader object)

(½ mark for correctly checking the condition)

(½ mark for correctly displaying the records)

(II)

def count_records(filename):
with open(filename, mode='r') as file:
reader = csv.reader(file)
next(reader, None)
count=0
for i in reader:
count+=1
print(count)

(½ mark for opening in the file in right mode)


(½ mark for correctly creating the reader object)
(½ mark for correct use of counter)
(½ mark for correctly displaying the counter)

Page 6
34. ( I ) SELECT * FROM STUDENTS S JOIN SUBJECTS Sub ON S.S_ID = Sub.S_ID

WHERE S.Marks > 70;

(II) SELECT * FROM SUBJECTS WHERE Credits BETWEEN 2 AND 4;

(III)UPDATE SUBJECTS SET Credits = Credits + 1 WHERE SubName LIKE


'%Science%';

(IV) A: SELECT FName, LName FROM STUDENTS S JOIN SUBJECTS Sub ON


S.S_ID = Sub.S_ID WHERE Sub.SubName = 'Mathematics';

OR

B: SELECT * FROM STUDENTS, SUBJECTS;

(4x1 mark for each correct query)

35. import mysql.connector as ms

def AddAndDisplay():

conn = ms.connect( host='localhost', user='root', password='Electro123',


database='PRODUCTDB' )
cursor = conn.cursor()
productID = int(input("Enter Product ID: "))
productName = input("Enter Product Name: ")
price = float(input("Enter Price: "))
stockQty = int(input("Enter Stock Quantity: "))
data = (productID, productName, price, stockQty))
cursor.execute("INSERT INTO ELECTRONICS VALUES (%s, %s, %s,
%s)",data)
conn.commit()
cursor.execute("SELECT * FROM ELECTRONICS WHERE price > 150")
records = cursor.fetchall()
print("\nRecords with price greater than 150:")
for record in records:
print(record)
conn.close()

(½ mark for correctly importing the connector object)


(½ mark for correctly creating the connection object)
(½ mark for correctly creating the cursor object)
(½ mark for correctly inputting the data)
(½ mark for correct creation of first query)
(½ mark for correctly executing the first query with commit)

Page 7
(½ mark for correctly executing the second query)
(½ mark for correctly displaying the data)

SECTION E

36. (I) import pickle

def NewTest():

try:
with open("TEST.dat", "ab") as file:
TestId = int(input("Enter Test ID: "))
Subject = input("Enter Subject: ")
MaxMarks = int(input("Enter Maximum Marks: "))
ScoredMarks = int(input("Enter Scored Marks: "))
test_record = [TestId, Subject, MaxMarks, ScoredMarks]
pickle.dump(test_record, file)
print("Record added successfully!")
except Exception as e:
print("Error:", e)

(½ mark for input + 1 mark for correct use of dump( ) to add new test)

(II) def UpdateMM(Sub):


try:
updated = False
with open("TEST.dat", "rb") as file:
records = []
while True:
try:
record = pickle.load(file)
if record[1] == Sub:
record[2] += 10
updated = True
records.append(record)
except EOFError:
break

# Write updated records back to the file

with open("TEST.dat", "wb") as file:


for record in records:
pickle.dump(record, file)

Page 8
if updated:
print(f"MaxMarks updated by 10 for subject: {Sub}")
else:
print(f"No records found for subject: {Sub}")
except Exception as e:

print("Error:", e)

(1 mark for correct use of load( ) method to retrieve data + ½ mark for correct loop +
½ mark for correct condition within loop )

(III) def DisplayAvgMarks(Sub):


try:
total_marks = 0
count = 0
with open("TEST.dat", "rb") as file:
while True:
try:
record = pickle.load(file)
if record[1] == Sub: # Check if the Subject matches
total_marks += record[3] # Add ScoredMarks
count += 1
except EOFError:
break
if count > 0:
avg_marks = total_marks / count
print(f"Average ScoredMarks for subject '{Sub}' is: {avg_marks:.2f}")
else:
print(f"No records found for subject: {Sub}")
except Exception as e:

print("Error:", e)

( 1 mark for correct use of load() and checking and ½ mark for correct display of
data loop )

37. (I) The server should be placed in the OPERATIONS building.


Justification:
It has the largest number of computers (40), making it the most central location
in terms of the network load. (1 Mark)

Page 9
(II) A switch should be used within each building to connect all computers.

( 1 Mark)

(III) Any correct cable layout

Cable Recommendation: Fiber optic cable is recommended for high speed data
transfer and reliable communication over distances. ( ½ + ½ mark)

(III) There is no need for a repeater in this layout. The maximum distance
between any two buildings is 90 meters, which is well within the 100-meter limit
for Ethernet cable or fiber optics before requiring a repeater. ( 1 mark )

(IV) A) Video Conferencing.

OR

(V) B) The network type in the Chennai hub would be a LAN (Local Area

Network) (1 mark)

*************************

Page
10

You might also like