Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

XIIComp.Sc

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 14

RYAN INTERNATIONAL SCHOOL

NOIDA EXTENSION
CLASS- XII
COMPUTER SCIENCE
TIME-3 HRS MAX MARKS- 70

General Instruction:
1. Please check this question paper contains 35 questions
2. This question paper contains five sections, Section A to E.
3. Section A, consists of 18 questions (Q1 to Q18) carrying 01 mark each.
4. Section B, consists of 07 questions (Q19 TO Q25) carrying 02 marks each
5. Section C, consists of 05 questions (Q26 TO Q30) carrying 03 marks each.
6. Section D, consists of 03 questions (Q31 TO Q33) carrying 05 marks each.
7. Section E, consists of 02 questions (Q34 TO Q35) carrying 04 marks each All
programming questions are to be answered using Python Language only

SECTION A
Q1. Consider The following: 1
t=(12,13,14,16,[2,3])
What changes will be made in t after the execution of the following statement?
t.append(4)
(i) t=(12,13,14,16,[2,3],4) (ii) t= (12,13,14,16,[2,3,4])
(iii) t=(4,12,13,14,16,12,3) (iv) t=It will give an error

Q2. 1

Q3. What will be the output of the following Python Code? 1


D={1:’One’,2:’Two’,3:’Three’}
L=[]
for K,V in D.items():
if V[0]==”T”:
L.append(K)
print(L)
(i) [1,2,3]
(ii) [‘One’,’Two’,’Three’]
(iii) [2,3]
(iv) [‘Two’,’Three’]
Q4. Consider the given expression: 1
not True and False or True
Which of the following will be correct output if the given expression is evaluated?

(a) True (c) NULL


(b)False (d)NONE

Q5. What shall be the output of the following statement? 1


“TEST”.split(‘T’,1)
(i) [ ‘ ‘, ’ ES ’ ,’ ‘ ] (ii) [ ‘T’, ’ ES ’ ,’T’]
(iii) [ ‘ ‘, ‘ EST ’] (iv) Error
Q6. Which of the following options is the correct Python statement to read 1
and display the first 10 characters of a text file “poem.txt” ?
i. F=open(‘poem.txt’) ii. F=open(‘poem.txt’)
print(F.load(10)) print(F.reader(10))
iii. F=open(‘poem.txt’) iv. F=open(‘poem.txt’,)
print(F.read(10)) print(F.readline(10)
)
Q7. Fill in the blanks: 1
------------------command is used to remove attribute from the table in SQL

(i) Update
(ii) Remove
Q8. Fill in the blank: (iii) Alter
______________command is used to remove primary key from the table in SQL.
(a) update (b)remove (c) alter (d)drop

Q9. What shall be the output for the execution of the following statement? 1
“ANTARTICA”.strip(‘A’)
i. NTRCTIC
ii. [‘ ‘, ‘NT’, ‘RCTIC’, ‘ ‘]
Q10. iii.the following
Which of NTARCTIC constraints will supports the entry of duplicate 1
values in a column?
i. Unique
ii. Distinct
iii. Primary Key
Q11. The correct syntax of seek() is:
(a) file_object.seek(offset [, reference_point])
(b) seek(offset [, reference_point])
(c) seek(offset, file_object)
(d) seek.file_object(offset)

Q12. The Select statement when combined with -------------------- clause, 1


returns records without repetition.
i. DESCRIBE
ii. UNIQUE
iii. DISTINCT
Q13. Fill in the blank: 1
_______is a communication methodology designed to deliver both voice and multimedia
communications over Internet protocol.
(a) VoIP (b) SMTP (c) PPP (d)HTTP

Q14. What should be the output of the following statements? 1


S=” Let there be light “.split(‘t’)
print(S)
(i) [‘ et’. ‘ ‘, ‘here’,’be ligh’] (ii) [‘ Le’,’ ‘,’here be ligh ‘,’ ‘]
(iii) [‘e’, ‘here’,’be ligh’] (iv) Error
Q15. Which function is used to display the total no of records from a table in 1
a database?
i. total() ii. total(*)
iii. count(*) iv. count()
Q16. To establish a connection between Python and SQL database, connect() 1
function is used . Which of the following arguments may not
necessarily be given while calling connect()?
i. host ii. database
iii. user iv. password
Q17 and 18 are ASSERTION AND REASONING 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
Q17. Assertion. Data conversion is necessary during reading and writing 1
Reasoning: Binary files store data in a binary format, which can be directly read
and written without the need the data conversion
Q18. Assertion: The combination of the try block, except block and finally 1
block is essential for comprehensive exception handling in Python Reasoning:
The try block allows for the execution of the code that might raise exceptions,
the except block handles specific exceptions and the finally block ensures that
certain code is always executed, whether an exception occurs or not.
SECTION B
Q19. Rao has written a code to input a number and check whether it is prime or not. His code is
having errors. Rewrite the correct code and underline the corrections made.

def prime():
n=int(input("Enter number to check :: ")
for i in range (2, n//2):
if n%i=0:
print("Number is not prime \n") break
else:
print("Number is prime \n’)
Q20. Write two points of difference between Circuit Switching and Packet 2
Switching
OR
Write two points of difference between Star Topology and Ring Topology.
Q21. a. What shall be the output of the following Python statement? 2
mysubject=”Computer Science with Python “
print(mysubject[-27:-10:2])
b. Write the output of the following code given below:
>>>a=[10,20,30,40,50,60,70]
>>>a[3:5]=[100,1000]
>>>a[3:5]=[10000]
>>>print(a)
Q22. Explain the use of ‘Foreign Key’ in a Relational Management System , 2
Give an example to support your answer.
Q23. i. Write the full forms of following: (i) POP (ii) HTTPS 2
ii. What is the use of SMTP?
Q24. Predict an output of the following: 2
def Disp(A=4, B=’2’ , C=2):
If type(C)==int:
print(A*C*B, end=’#’)
else: Disp()

print(A*B+C)
Disp(3,’*’,’10’)
(i) 22222222 #**10**10**10
(ii) 22222222 #******10
(iii) 22222222 #**10**10
(iv) Error
OR
What shall be the output of the following:
S=”MARSHMELLOW”.partition(‘H’) print(S[::2])
Q25. Differentiate between DDL & DML in SQL with an appropriate example 2
OR
Differentiate between count() and count(*) functions in SQL with appropriate example.
SECTION C
Q26. a. Consider the following tables Bank-Account and Branch 3
Table: Bank-Account
ACode Name Type
A01 Amrita Savings
A02 Parthodas Current
A03 Miraben Current
Table:Branch
ACode City
A01 Delhi
A02 Mumbai
A03 Nagpur
What will be the output of the following statement?
SELECT * FROM Bank-Account NATURAL JOIN Branch
b. Write the output of the queries (i) to (iv) based on the table
Tech_Course given below:
CID CNAME FEES STARTDATE TID

C201 Animation & Mix 12000 2022-07-02 101


C202 CADD 15000 2021-11-15 NULL
C203 DCA 10000 2020-10-01 102
C204 DDTP 9000 2021-09-15 104
C205 Mobile Application Development 18000 2022-11-01 101
C206 Digital Marketing 16000 2022-07-25 103
(i) SELECT DISTINCT TID FROM TECH_COURSE
(ii) SELECT TID, COUNT(*), MIN(FEES) FROM TECH_COURSE GROUP BY TID
HAVIN GCOUNT(TID)>1
(iii) SELECT CNAME FROM TECH_COURSE WHERE FEES>15000
ORDER BY CNAME
(iv) SELECT AVG(FEE) FROM TECH_COURSE WHERE FEES BETWEEN 15000 AND
17000
Q27. Write a function SKCount() in Python which should read each character 3
of a text file “POEM.txt” and should count and display the occurrence
of alphabets S and K (including small case a and m too)
OR
Write a function in Python that counts the no of “His” or “Her” words present in a
text file “TEST.txt”.
Q28. Write the SQL queries on the following tables: 3
Table: PRODUCT
P_Id Prod_Name Manufacturer Price Discount
TP01 Talcum Powder LAK 40 NULL
FW0 Face Wash ABC 45 5
5
BS01 Bath Soap ABC 55 NULL
SH06 Shampoo XYZ 120 10
FW1 Face Wash XYZ 95 NULL
2
Table: CLIENT
C_Id C_Name City P_Id
01 Cosmetic Shop Delhi TP01
02 Total Health Mumbai FW05
03 Live Life Delhi BS01
04 Pretty Woman Delhi SH06
05 Dreams Delhi FW12
(i) Write SQL query to display product name and price of all products whose price is
in the range 50 to 150
(ii) Write SQL query to display the details of products whose manufacturer is either
XYZ or ABC
(iii) Write Sql query to display Product Name , Manufacturer and Price of all products
that are not giving any discount

Q29. Write a function INDEX_LIST(L) where L is the list of elements passed 3


as an argument to the function . The function returns another list named
‘indexlist’ that stores the indices of all non-zero elements of L. For example:
If L contains [12,4,0,11,0,56] The
index list will have =[0,1,3,5]
Q30. A list contains the following record of customer: 3
[Customer_name,Phone_no,City]
Write the following user-defined function to perform given operations on the
stack named status:
(i) Push_element(): To Push an object containing customer name and
phone no of customer who live in Goa to the stack.
(ii) Pop_element(): To pop an object from the stack and display them ,
Also dsplay “Stack Empty” when there is no elements in the stack
OR
Write a function in Python Push(SItem) where SItem is a dictionary containing the
details of stationary items (Sname, price)
The function should push the names of those items in the stack which
have price more than 75. Also display the count of element pushed into the stack.

SECTION D
Q31. In Ahmedabad one college is starting up the network between its different wings. 5
There are four buildings named as SENIOR, JUNIOR, ADMIN and HOSTEL as
shown below:

The distance between various buildings is as follows:

Number of Computers in Each Building :

a. Suggest the cable layout of connections between the buildings.


b. Suggest the most suitable place (i.e., building) to house the server
of this school, provide a suitable reason.
c. Suggest the placement of the following devices with justification.
o Repeater
o Hub/Switch
d. The organisation also has inquiry ’
office in another city about 50- 60
km away in hilly region. Suggest a
the suitable transmission media n
to interconnect to school and d
inquiry office out of the
following : s
o Microwave [
o Radiowave
i
]
<
e. Draw the cable layout to efficiently
=
connect buildings within

Ahmedabad campus for
z
connecting computers.

Q32. (a) Predict an output of the code given
)
below: :
S=”pythons2ip” m
n=len(S) =
m=’ ‘ m
for i in range(0,n): +
if (s[i] >=’a’ and s[i] <=’m’): s
[
m i
= -
m 1
+ ]
s
[ e
i l
] i
. f
u
p (
p s
e [
r i
( ]
) .
i
e s
l u
i p
f p
e
( r
s (
[ )
i )
] :
> m=m+s[i].lower()
=

n
5
[2+3]

else: print(m)

m=m+’&’
(b) The code given below reads the following record from the table named
STUDENT and display only those records that have marks greater than 75.
Roll No – Integer
Name – String Class
– Integer Marks –
Integer
Note the following to establish connectivity between Python and MySQL
● UserName is root
● Password is root
● The Table exists in a mySQL database named SCHOOL Write
the following missing statements to complete the code: Statement 1:
To form the cursor object
Statement 2: To execute the query that extracts records of those students whose
marks are greater than 75
Statement 3: To read the complete results of the query (records whose marks are
greater than 75) into the object data from the table student in the database.

import mysql.connector as myc def


sql_Data():

cool=mysql.connect(host=’localhost’,user=’root’,’passwd=’root’,
database=’school’
mycur=--------------------------------- #Statement 1
print(‘Student marks more than 75’)
--------------------------------------

#Statement 2
data=--------------------------------

5
#Statement 3
[1+4]
for I in data:
p
r
i
n
t
(
i
)

p
r
i
n
t
(
)
Q33. i. What is the advantages of
using a binary files for
permanent storage?
ii. Write a program in Python that
defines and calls the following
user-defined functions
a. insert(): - to accept and add
data of a student to a CSV
file ‘student.csv’ . Each
record consists of a list
with field elements as
studid , name and marks to
store student ids, student
name and student marks
respectively
b. total(): to count the no
of records present in the
CSV file named
student.csv
OR
i. Give any one point of difference between a binary files and CSV file.
ii. Write a program in Python in Python that defines and calls the
following functions:
a. add() – To accept and add data of an employee to a CSV file furdata.csv.
Each record consists of a list with field elements as fid, fname, fprice to
store furniture id, furniture name and furniture price respectively
b. search() – To display the records of the furniture whose price is more
than 10000
SECTION E
Q34. Raghav has been assigned task to create a database named ‘Project_Info’ 4
He also has to cerate the following two tables in the database:
Table:Projects
Field Data Type Constraints
PID Char(5) Primary Key
PName Varchar(20)
StartDate Date
EndDate Date
Table: Employee
Field Data Type Remarks
Eid Char(4) Primary Key
Name Varchar(20)
DOB Date Can not be Null
DOJ Date Can not be Null
Salary Integer
Project Char(5) Foreign Key references PID of Project Table

Based on the data given above answer the following questions:


a. Which table should he create first – Projects or Employee, Justify your
answer.
b. If two columns are added and two rows are deleted from the table Projects,
what will be the degree and cardinality of the Projects Table.
c. Write the statements to:
i. Add a column Gender of type char(1) to the table MEployee
, assuming table is already created
ii. Create table Project
Q35. Ram is a Python programmer. He has created computer science project 4
in Python and saved the file with the name ‘Record.dat’ consisting of the fields -
employeeids, ename, and salary. The file contains 10 records . He now has to update a
record based on the employee ids entered by user
and update the salary. The updated record is then to be written in the file
temp.dat. The records which are not to be updated also have to be written to the
file temp.dat . If the employee id is not found and appropriate message should be
displayed.
As a Python expert help him complete the following code based on the
requirement given below:
(i) Which module should be imported into the program
(ii) To open the file temp.dat
(iii) To read the data from the binary file Record.dat
(iv) To write the updated data in the file , temp.dat
import-------------------------- #Statement 1
def update_data():
rec=[]
fin=open(‘Record.dat’)
fout=open(“-----------------------------------”) #Statement 2
found=False
eid=int(input(“Enter employee ids to update their salary”))
while True:
try:
rec=---------------------------- #Statement 3
if rec[“Employee id”] ==eid:
Found=True
Rec[“Salary”] = int(input(“Enter new salary::”))
pickle.------------------------- #Statement 4
else:
pickle..dump(rec,fout) except
break
if found==False:
print(“N employee id found”)
else:
print(“Salary has been updated”)
fin.close()
fout.close()

*******************************ALL THE BEST**************************

You might also like