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

Class 12

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

St. Jagat Gyan Sr. Sec.

Public School
Affiliated to CBSE (New Delhi) upto 10+2
Piska Nagri, Ranchi

Class- 12 FM -70
Subject- Computer Science Time-3 hr.

GENERAL INSTRUCTION
All the questions are compulsory.
Read carefully all the questions and then write answers
Marks are indicated in the questions.
SECTION A
1. By default, a Python file is saved with ________ extension. (20)
(a) .py (b) .pyc (c). pyw (d) All of these
2. A table ‘Student’ contains 4 rows and 6 columns, whereas a table 'Result' contains 8 rows
and 3 columns. What will be the cardinality and degree of the resultant table after applying
the Cartesian product to the given tables?
(a) 12,9 (b) 32,18 (c) 32,9 (d) 9,32
3. If a program tries to access an array element by specifying index position that is outside
the range, it leads to an ____________.
(a) Error (b) Exclusion (c) Illegal message (d) Exception
4. When a primary key is combined with a foreign key, it creates—
(a) Many to many relationships between the tables which connect them.
(b) Network model between the tables that connect them.
(c) Parent-child relationship between the tables which connect them.
(d) None of these
5. Which switching technique offers a connectionless service to transfer the packets in a
network?
(a) Message Switching (b) Packet Switching
(c) Circuit Switching (d) All of these
6. Which function is used to write the text at the end of the text file?
(a) write() (b) append() (c) writelines() (d) dump()
7. In a table in a MySQL database, an attribute X of datatype varchar(15) has the value
"Database". The attribute Y of datatype char(15) has the value "System". How many
characters are occupied by attribute X and attribute Y?
(a) 8,6 (b) 15,6 (c) 8,15 (d) 15,8
8. Write the output of the following statement:
x="AnnualMeetattheCampus"
x=x.split('a')
y=x[0]+"."+x[1]+"."+x[2]+x[3]
print(y)
(a) Annu.l Meet .t the Cmpus (b) nnu.l Meet .t the Cmpus
(c) Error (d) Annu.l Meet .t the Campus
9. Select the correct output of the code:
p= (90)
print(p**2)
(a) 180 (b) 8100 (c) (90,90) (d) 8100
10. In MySQL database, a table Vehicle has 9 rows and 5 columns. If 2 more columns are
added and 1 row is deleted from the table, then what will be the cardinality and degree
of the said table?
(a) 5,9 (b) 9,5 (c) 8,7 (d) 7,8
11. A remote control of a TV or an AC is an example of ___________ transmission.
(a) Radio Wave (b) Microwave (c) Satellite Link
(d) Infrared
12. Consider the statements given below and then choose the correct output from the given
options:
lst1= [110,115,210,215,310]
lst1.insert(3,270)
lst1.insert(2,980)
print(lst1[-5])
(a) 980 (b) 110 (c) 2 (d) 3
13. Write the output of the given Python code –
d={"emp":"Yuvan","Salary":95000}
d["Salary"] = 105000
d["city"] = "Pune"
print(d.items())
(a) dict_items([('emp', 'Yuvan'), ('Salary', 105000), ('city', 'Pune')])
(b) d_items([('emp', 'Yuvan'), ('Salary', 105000), ('city', 'Pune')])
(c) dict_items({('emp', 'Yuvan'), ('Salary', 105000), ('city', 'Pune')})
(d) dict_items(['emp', 'Yuvan', 'Salary', 105000, 'city', 'Pune'])
14. What will be the output of the following code?
msg="**BUSINESSCONFERENCE Held in 2024**"
print(msg[::-2])
(a) **4202 ni dlehH ECNEREFNOCSSENISUB** (b) *40 ide CEENCSNSB*
(c) *BSNSCNEEC edi o4* (d) *UNSNRC e i 24
15. What possible output(s) will be obtained when the following code is executed?
import random
elements=[180,90,77,65,33,12,54,4,219]
beg=random.randint(1,4)
final=random.randint(beg,5)
for z in range(beg,final+1):
print(elements[z],"@")
(a) 90 @ (b) 90 @ (c) 180 @ (d) 90 @
77 @ 77 @ 12 @ 4@
65 @ 54 @
33 @ 4@
16. Fill in the blank:
________ protocol is used to transfer files from server system to requesting node for
information sharing.
(a) PPP (b) FTP (c) TCP (d) SMTP

Q. 17 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.
17. Assertion (A): Tuples in Python are immutable, meaning their elements cannot be
modified after the tuple is created.
Reasoning (R): Immutability in tuples ensures data integrity and provides certain
performance benefits compared to mutable data structures like lists.
18. Assertion (A): Functions in Python facilitate code reusability and modular programming.
Reasoning (R): By encapsulating a set of instructions within a function, we can call the
function multiple times with different inputs, promoting efficient and organized code
development
19. Fill in the blank: __________ command is used to delete all the rows from a table and
free the space containing the table for reuse.
(a) DELETE (b) REMOVE (c) DROP (d) TRUNCATE
20. Which device can handle different protocols in a network?
(a) Gateway (b) Bridge (c) Router (d) None of these

SECTION B
21. (i) Expand the following terms: (1+1=2)
SMTP, URL
(ii) Define the following terms:
Website, Web Page
OR
(i) Identify the following:
(a) I am a wireless device that offers internet connectivity to mobile phones and other devices.
(b) I am a networking device used to connect multiple computers. I broadcast the data to all
the nodes in a network.
(ii) Differentiate between LAN and MAN.
22. Observe the following code carefully and rewrite it after removing all syntax and logical
errors. Underline all the corrections made. (1+1=2)
(i) Def Prod(x=5,y)
return x*y
print ("The Product is =" Prod(7, 1)
(ii) def top(a,b):
print(a + b)
top(5)
23. Write a function STR_PALIN(Str) that takes string as an argument and returns if a string
is a palindrome or not (A string is called palindrome if it reads the same backwards as
forward). (2)
For example, if the string is
Str = Naman
Then output should be:
The given string Naman is a palindrome.
OR
Write a function REPLACE_VOWEL(St) that takes string as an argument and returns a string
in which all vowels are replaced with ‘*’.
For example, if the string is
St= Message your token number
Then output should be:
St = M*ss*g* y**r t*k*n n*mb*r
24. Predict the output of the following code. (2)
st1= "WeLcOME"
st2="GUeSTs"
st3=""
for j in range(0, len(st2)+1):
if st1[j]>="A" and st1[j]<="M":
st3=st3+st1[j]
elif st1[j]>="N" and st1[j]<="Z":
st3=st3+st2[j]
else:
st3=st3+"*"
print(st3)
25. Write a Python statement for each of the following tasks using BUILT-IN functions/methods
only
(i) To find the minimum value from a list named ‘Numbers’. (1+1=2)
(ii) To find and print the length of words from the list.
26. Predict the output of the following code: (2)
value=210
def calculate():
global value
value=450
print(value, end='')
calculate()
print(value)
27.Differentiate between Alter Table and Update command in SQL. Also, write the syntax
along with example of each. (2)
SECTION C
28. What do you mean by computer network? What are the types of networks? (3)
29. What do you mean by topology? Explain the types of topologies. (3)
30. Explain web server, web browser and web hosting. (3)
31. What are the difference between DBMS and RDBMS? (3)
32. Mention some clauses of database and explain them? (3)
33. What are Built-in data types in Python? (3)
34. What is Python? List some popular applications of Python in the world of technology. (3)

SECTION D
33. Karan has set up a table named "Emp" in a MySQL database named "MNC": (5)
emp_id (Employee ID) – integer
emp_name (Employee Name) - string
emp_position (Employee Position) – string
emp_salary (Employee Salary) – float
Karan wants to establish connectivity between Python and MySQL with the following
database credentials:
Username: 'admin'
Password: 'pass121'
Host: 'localhost'
Karan is now interested in retrieving records of employees whose salary is greater than
60000. Help Karan write a Python program to accomplish this task.
34. Complete the following database connectivity program by writing missing statements and
performing the given query. (5)
import ___________ as pt #Statement 1
con=pt.____________ (host="localhost", user="root", passwd="123", database="drugs")
#Statement 2
mycursor=con.cursor()
mycursor.execute(___________) #Statement 3
data=mycursor.______________ #Statement 4
for i in data:
print(i)
con.close( )
(a) Complete the #Statement 1 by writing the name of library needed to import for database
connectivity.
(b) Complete the #Statement 2 by writing the name of the function that is required to create
the connection between Python and MySQL.
(c) Complete the #Statement 3 by writing the query to display those drugs records having price
range between 50 to 100 from table Drug.
(d) Complete the #Statement 4 to retrieve all records from the result set.

35. (i) Which clause is used to eliminate the redundant records from the table? (1+4=5)

(ii) Shanti Memorial Hospital is managing the patients’ data in "Hospital" database. Write a
Python code that connects to a database school and retrieves Drug and retrieves all records
and displays total number of patients.

You might also like