Class12PB ComputerScience 2024A
Class12PB ComputerScience 2024A
Class - XII
Subject: Computer Science [083]
Time: 3 Hours Maximum Marks: 70
General Instructions:
Please check this question paper contains 35 questions.
The paper is divided into 5 Sections- A, B, C, D and E.
Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark.
Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
All programming questions are to be answered using Python Language only.
Section A
(Each question carries 1 mark)
2 Ameena is executing the following MySQL query but not getting the appropriate output, 1
help her to do the suitable correction.
say('Hello ' , 3)
say('World!')
Page 1 of 8
8 If L=['M','O','D','E','R','N'] 1
Write the output of: print(L[-5:5])
T=(((('a',1),('b',2),'c',3),'d',4),'e',5)
11 Identify the protocol that is best known for uploading & downloading files on internet. 1
14 Which of the following type(s) of table constraint(s) will not prevent NULL entries in a 1
table?
(a) Unique (b) Distinct (c) Primary Key (d) NOT NULL
15 Write the value returned by the following function available is one Python module. 1
ceil(-5.4)
Q17 and Q18 are ASSERTION (A) and REASONING (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
OR
21 (a) Find and write the output of the following Python code: 2
A=(2,3,4,5,6)
B=-2,-1,0,1,2
B=B[:2]+(3,)+B[2:]
x=A[1]
y=B[-1]
print(x, y)
print(A,B)
OR
(b) Find and write the output of the following Python code: 2
s='Modern School'
for i in range(len(s)):
if i%2==0:
print(s[i],end='')
elif s[i]>='a' and s[i]<='z':
print('*',end='')
elif s[i]>='A' and s[i]<='Z':
print(s[i:],end='')
22 (a) With the help of some suitable examples, compare split() and partition() 2
functions, when used with some Python strings.
OR
(b) With the help of some suitable examples, compare del() and clear() functions, 2
when used with some Python dictionaries.
Page 3 of 8
23 Rewrite the following code in Python after removing all syntax error(s) and exception(s). 2
Underline each correction done in the code.
define SOD(N)
while N>0
D=N%10
N=//10
Sum+=D
return Sum
NUM=365
print(SOD(NUM)
24 (a) Using suitable examples, write any two differences between WHERE and HAVING clause 2
in MySQL.
OR
(b) When and why do you use the commit() function in Python MySQL connectivity? Give 2
any two examples of commands after which the use of commit() is required.
25 What possible output(s) are expected to be displayed on screen at the time of execution 2
of the program from the following code? Also specify the maximum values that can be
assigned to each of the variables Lower and Upper.
import random
AR=[20,30,40,50,60,70];
Lower =random.randrange(1,3)
Upper =random.randint(2,4)
for K in range(Lower, Upper+1):
print (AR[K],end='#')
Section C
(Each question carries 3 marks)
Table: STUDENT
SID AADHAAR NAME MARKS
101 123456789012 Anita 65
107 NULL Rahaman 85
110 345678901234 Anita NULL
(a) Identify any one attribute and one tuple of the table
(b) Name the attributes, suitable for candidate key of the table
(c) Write the degree and cardinality of the table
27 Consider the following MySQL Table STUDENT and write the output of the following 3
MySQL queries:
Page 4 of 8
Table: STUDENT
SID AADHAAR NAME MARKS
101 123456789012 Anita 60
107 NULL Rahaman 75
110 345678901234 Anita NULL
28 (a) Define a function WordCount(W) in Python that counts the number of occurrences of 3
the word W (the argument) in all possible cases, in a text file “STORY.TXT”. If the
“STORY.TXT” contents are as follows:
OR
(b) Define a function ReplaceWord(OldW, NewW) in Python that replace all the 3
occurrences of the word OldW with NewW (both are the arguments), in a text file
“STORY.TXT”. If the “STORY.TXT” contents are as follows:
Q29 and Q30 are based on the two tables given below in a database called SCHOOL.
Write the MySQL queries to execute the following tasks given in Q29 and Q30.
29 Based on the above database and tables, write the MySQL queries to execute the 3
following tasks
(a) Insert a new student into the table STUDENT with the details
SID=115, SNAME=’Sagar’,Grade=11 and MARKS not known (given)
(b) Enter the MARKS of the student with SID=115 as 50
(c) Display the average marks scored by the students of different grades
Page 5 of 8
30 Based on the above database and tables, write the MySQL queries to execute the 3
following tasks
(a) Display the names of all students (SNAME) along with their respective class
teachers names (CTNAME)
(b) Display the names of the class teachers (CTNAME) along with the number of
students in their respective grades.
(c) Identify whether GRADE is a primary key or foreign key. Justify.
Section D
(Each question carries 4 marks)
Section E
(Each question carries 5 marks)
33 Swadeshi University is setting up its academic and administrative blocks at Bharati Nagar 5
and planning to set up a computer network. The university has 4 blocks namely the
Business, Technology, Law and HR Blocks or Centres as shown in the diagram given
below:
Page 6 of 8
Based on the above details, answer the following questions:
(a) Suggest the most suitable place to house the server of the organization with suitable
reason.
(b) Suggest a cable layout of connection between the blocks and also name the topology
of the layout.
(c) Do you require any Repeater in your suggested network layout? Justify.
(d) Which device should be placed/installed in each of these blocks to efficiently connect
all the computers within these blocks?
(e) The university is planning to link its admission and placement counters situated in
various parts of the other cities in the country. Which type of network out of LAN,
MAN or WAN will be formed?
34 (a) Consider a binary file ‘result.dat’ containing roll_no and marks of some students. Define 3+2
two functions to process the following tasks:
(i) Add one more record into the binary file and display all the records one by one.
(ii) Delete the records of all those students who have scored less than 33 marks.
OR
(b) Meena Bharti, a programmer is writing a program to create a CSV file ‘result.csv’ which 5
will contain roll_no and marks of some students. She has written the following
incomplete code. As a student of Computer Science, help her to successfully execute the
given task.
addstudent('2401',93)
addstudent('2402',87)
addstudent('2404',98)
readstudent() #Line 5
35 (a) Ashoka, a student has written the following incomplete Python MySQL connectivity 5
program to display the details of all students whose name would be entered by the user.
Help him to complete the program by filling in appropriate commands in the
FIVE (5) BLANK places.
OR
(b) Write a Python MySQL connectivity program to display the details of all employees in an 5
IT Services company Bharati Inc, whose SALARY are more than 80000 in a table EMP
in the database BHARAT contains attribute EMPID, ENAME and SALARY.
Also note that: host='localhost', user='root' & password='modern'
Page 8 of 8