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

Class12PB ComputerScience 2024A

Uploaded by

humna369xd
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)
62 views

Class12PB ComputerScience 2024A

Uploaded by

humna369xd
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/ 8

Preboard Examinations: 2023-24

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)

1 State True or False: 1

A Python List can be used as a key of a Python Dictionary.

2 Ameena is executing the following MySQL query but not getting the appropriate output, 1
help her to do the suitable correction.

SELECT NAME FROM STUDENT WHERE HOUSE=NULL;

3 Write the output of the following Python commands: 1

L = [x//2 for x in range(0,4)]


print(L)

4 What is the output of the following program? 1

def say(message, times = 1):


print(message * times)

say('Hello ' , 3)
say('World!')

5 Identify the MySQL Data Definition Language Command: 1

(a) Insert (b) Alter (c) Update (d) Delete

6 Write any two names for Unguided Transmission Media in networking. 1

7 Identify the mutable data type(s) out of the following options? 1

(a) Integer (b) Tuple (c) Dictionary (d) String

Page 1 of 8
8 If L=['M','O','D','E','R','N'] 1
Write the output of: print(L[-5:5])

9 Find the length of the tuple T, i.e. len(T), if T is: 1

T=(((('a',1),('b',2),'c',3),'d',4),'e',5)

(a) 3 (b) 4 (c) 5 (d) 6

10 Write the output of the Python command: 1

print(1>2 or 3<4 and not 5==6)

11 Identify the protocol that is best known for uploading & downloading files on internet. 1

(a) FTP (b) PPP (c) HTTP (d) SMTP

12 Which of the following is/are correct function prototype(s) in Python? 1

(a) def SI(P,R=10,T): (b) def SI(P=100,R,T):


(c) def SI(P=100,R,T=2): (d) def SI(P,R,T=2):

13 Suppose a tuple T is declared as T = ( [1], [2], [3] ), which of the following 1


is/are syntactically incorrect?

(a) T=T*4 (b) T=T+[4] (c) T[2].pop() (d) T[2].append(4)

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)

16 Write the MySQL query to show the structure of table Student. 1

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

17 Assertion (A): A function in Python can return multiple values. 1


Reasoning (R): More than one return statements can be used in a Python function.

18 Assertion (A): Foreign key in RDBMS cannot have NULL value. 1


Reasoning (R): Foreign keys link a column in one table to the primary key in another,
ensuring consistency in related data.
Page 2 of 8
Section B
(Each question carries 2 marks)

19 (a) Compare STAR and BUS topologies. 2

OR

(b) Briefly explain Circuit switching technique in computer networking. 2

20 Find and write the output of the following Python code: 2

def Change (P,Q=10):


P=P+Q
Q=Q-P
print(P,'@',Q)
return(P)
R=100
S=200
R=Change(R,S)
print(R,"#",S)
S=Change(S)
print(R,"&",S)

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='#')

(i) 20#30#40# (ii) 30#40#50# (iii) 50#60#70# (iv) 40#50#60#

Section C
(Each question carries 3 marks)

26 Consider the following MySQL Table STUDENT: 3

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

(a) SELECT DISTINCE NAME, MARKS FROM STUDENT;


(b) SELECT COUNT(AADHAAR) FROM STUDENT;
(c) SELECT AVG(MARKS) FROM STUDENT;

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:

My first book was Me and My Family.


It gave me chance to be Known to the world.

The return of the function call WordCount('Me') should be: 2

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:

My first book was Me and My Family.


It gave me chance to be Known to the world.

After the function call ReplaceWord(‘book’,‘song’), the updated file would


be:

My first song was Me and My Family.


It gave me chance to be Known to the world.

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.

Table: STUDENT Table: CTEACHER


SID SNAME GRADE MARKS GRADE CTNAME
101 Ashmeet 11 45 10 Sonika Sharma
103 Aman 12 36 11 Rajan Mishra
107 Ashok 12 44 12 Manav Bharti
110 Ajay 11 23
114 Raman 12 12

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)

31 Consider a Python nested List RESULT as


[[‘Amina’,23],[‘Mansi’,89],[‘Juhi’,56],,,] to store names and
marks scored of few students. Define the following functions as instructed:

(a) Define a Python function def PUSH(RESULT): 2


 to accept a nested List RESULT as described above as the parameter
 to create a Python list implementation of stack named PROMOTED containing the
names of the students who have scored 33 or more

(b) Define a Python function def POP(PROMOTED): 2


 to remove all names, one after another, from the stack called PROMOTED,
received as a parameter, using LIFO algorithm
 display the removed names
 display an appropriate message when the list PROMOTED is empty

32 Suppose content of 'Myfile.txt' is

Humpty Dumpty sat on a wall


Humpty Dumpty had a great fall
All the king's horses and all the king's men
Couldn't put Humpty together again

What will be the output of the following two codes?


myfile = open("Myfile.txt")
(a)
record = myfile.read().split() 2
print(len(record))
myfile.close()
myfile = open("Myfile.txt")
(b) data = myfile.readlines() 2
print(len(data[0]))
myfile.close()

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.

import __________________ #Line 1

#to write/add data into the CSV file


def addstudent(roll_no , marks):
fout=open('result.csv','a')
writer=csv.__________(fout) #Line 2
writer.writerow([roll_no , marks])
fout.close()
Page 7 of 8
#csv file reading code
def readstudent():
with open('result.csv','______') as fin: #Line 3
filereader=csv.reader(fin)
for row in filereader:
for data in row:
print(data,end='\t')
print(end='\n')
fin._________ #Line 4

addstudent('2401',93)
addstudent('2402',87)
addstudent('2404',98)

readstudent() #Line 5

Answer the following questions:


(i) Name the module she should import in Line 1.
(ii) Fill in the blank in Line 2 required to write the data in a CSV file.
(iii) In which mode, Meena should open the file to read the data from the file in Line 3.
(iv) Fill in the blank in Line 4 to close the file.
(v) Write the output she will obtain while executing 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.

import mysql.connector as SQL


MyDB=SQL. BLANK 1 (host='localhost',user='root',
password='modern',database='SCHOOL')
MyCursor=MyDB. BLANK 2 ()
SNAME=input("\n\nEnter the name to be searched : ")
Command="SELECT * FROM STUDENT WHERE NAME=%s;"
Value=(SNAME,)
MyCursor. BLANK 3 (Command,Value)
Rows=MyCursor. BLANK 4 ()
for R in Rows:
print("\nStudent's ID:",R[0])
print("Student's Name:",R[1])
print("Student's Email ID:",R[2])
print("\nTotal number of matching rows:", MyCursor.BLANK 5)

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

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