You're viewing questions only. Log in as a Grade 12 student to reveal solutions for this paper.
Log In →
Q1
short answer
1 mark
State True or False.
Q2
mcq
1 mark
Which of the following is not a sequential datatype in Python ?
-
A.
Dictionary
-
B.
String
-
C.
List
-
D.
Tuple
Q3
mcq
1 mark
Given the following dictionary
Day={1:"Monday", 2: "Tuesday", 3: "Wednesday"}
Which statement will return "Tuesday".
-
A.
Day.pop()
-
B.
Day.pop(2)
-
C.
Day.pop(1)
-
D.
Day.pop("Tuesday")
Q4
mcq
1 mark
Consider the given expression :
$7<4$ or $6>3$ and not $10==10$ or $17>4$
Which of the following will be the correct output if the given expression is evaluated ?
-
A.
True
-
B.
False
-
C.
NONE
-
D.
NULL
Q5
mcq
1 mark
Select the correct output of the code :
S="Amrit Mahotsav @ 75"
A=S.split(" ",2)
print(A)
-
A.
('Amrit', 'Mahotsav', '@', '75')
-
B.
['Amrit', 'Mahotsav', '@ 75']
-
C.
('Amrit', 'Mahotsav', '@ 75')
-
D.
['Amrit', 'Mahotsav', '@', '75']
Q6
mcq
1 mark
Which of the following modes in Python creates a new file, if file does not exist and overwrites the content, if the file exists ?
Q7
mcq
1 mark
Fill in the blank :
___________ is not a valid built-in function for list manipulations.
-
A.
count()
-
B.
length()
-
C.
append()
-
D.
extend()
Q8
mcq
1 mark
Which of the following is an example of identity operators of Python ?
-
A.
is
-
B.
on
-
C.
in
-
D.
not in
Q9
mcq
1 mark
Which of the following statement(s) would give an error after executing the following code ?
S="Happy" # Statement 1
print(S*2) # Statement 2
S+="Independence" # Statement 3
S.append("Day") # Statement 4
print(S) # Statement 5
-
A.
Statement 2
-
B.
Statement 3
-
C.
Statement 4
-
D.
Statement 3 and 4
Q10
mcq
1 mark
Fill in the blank :
In a relational model, tables are called _________, that store data for different columns.
-
A.
Attributes
-
B.
Degrees
-
C.
Relations
-
D.
Tuples
Q11
mcq
1 mark
The correct syntax of tell() is :
-
A.
tell.file_object()
-
B.
file_object.tell()
-
C.
tell.file_object(1)
-
D.
file_object.tell(1)
Q12
mcq
1 mark
Fill in the blank :
_________ statement of SQL is used to insert new records in a table.
-
A.
ALTER
-
B.
UPDATE
-
C.
INSERT
-
D.
CREATE
Q13
mcq
1 mark
Fill in the blank :
In _________ switching, before a communication starts, a dedicated path is identified between the sender and the receiver.
-
A.
Packet
-
B.
Graph
-
C.
Circuit
-
D.
Plot
Q14
mcq
1 mark
What will the following expression be evaluated to in Python ?
print(6/3 + 4**3//8 4)
-
A.
6.5
-
B.
4.0
-
C.
6.0
-
D.
4
Q15
mcq
1 mark
Which of the following functions is a valid built-in function for both list and dictionary datatype ?
-
A.
items()
-
B.
len()
-
C.
update()
-
D.
values()
Q16
mcq
1 mark
fetchone() method fetches only one row in a ResultSet and returns a __________.
-
A.
Tuple
-
B.
List
-
C.
Dictionary
-
D.
String
Q17
mcq
1 mark
Assertion (A) : In Python, a stack can be implemented using a list.
Reasoning (R) : A stack is an ordered linear list of elements that works on the principle of First In First Out (FIFO).
-
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.
Q18
mcq
1 mark
Assertion (A) : readlines() reads all the lines from a text file and returns the lines along with newline as a list of strings.
Reasoning (R) : readline() can read the entire text file line by line without using any looping statements.
-
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.
Q19
long answer
2 marks
Ravi, a Python programmer, is working on a project in which he wants to write a function to count the number of even and odd values in the list. He has written the following code but his code is having errors. Rewrite the correct code and underline the corrections made.
define EOCOUNT(L):
even_no=odd_no=0
for i in range(0,len(L))
if L[i]%2=0:
even_no+=1
Else:
odd_no+=1
print(even_no, odd_no)
Q20
short answer
2 marks
(a) Write any two differences between Fiber-optic cable and Coaxial cable.
OR
(b) Write one advantage and one disadvantage of wired over wireless communication.
Q21
short answer
1 mark
(a) Given is a Python string declaration:
NAME = "Learning Python is Fun"
Write the output of: print(NAME[-5:-10:-1])
(b) Write the output of the code given below:
dict1={1:["Rohit",20], 2:["Siya",90]}
dict2={1:["Rahul",95], 5:["Rajan",80]}
dict1.update(dict2)
print(dict1.values())
Q22
short answer
2 marks
Explain the usage of HAVING clause in GROUP BY command in RDBMS with the help of an example.
Q23
short answer
1 mark
(a) Write the full forms of the following:
(i) XML
(ii) HTTPS
(b) What is the use of FTP?
Q24
short answer
2 marks
(a) Write the output of the Python code given below:
a=0
def fun1(x,y):
global g
g=x+y
return g
def fun2(m,n):
global g
g=m-n
return g
k=fun1(2,3)
fun2(k,7)
print(g)
OR
(b) Write the output of the Python code given below:
a=15
def update(x):
global a
a+=2
if x%2==0:
a*=x
else:
a//=x
a=a+5
print(a,end="$")
update(5)
print(a)
Q25
short answer
2 marks
(a) Differentiate between IN and BETWEEN operators in SQL with appropriate examples.
OR
(b) Which of the following is NOT a DML command.
DELETE, DROP, INSERT, UPDATE
Q26
short answer
3 marks
(a) Consider the following tables Student and Sport:
Table: Student
ADMNO NAME CLASS
1100 MEENA X
1101 VANI XI
Table: Sport
ADMNO GAME
1100 CRICKET
1103 FOOTBALL
What will be the output of the following statement?
SELECT * FROM Student, Sport;
(b) Write the output of the queries (i) to (iv) based on the table, GARMENT given below:
TABLE: GARMENT
GCODE TYPE PRICE FCODE ODR_DATE
G101 EVENING GOWN 850 F03 2008-12-19
G102 SLACKS 750 F02 2020-10-20
G103 FROCK 1000 F01 2021-09-09
G104 TULIP SKIRT 1550 F01 2021-08-10
G105 BABY TOP 1500 F02 2020-03-31
G106 FORMAL PANT 1250 F01 2019-01-06
(i) SELECT DISTINCT(COUNT(FCODE))FROM GARMENT;
(ii) SELECT FCODE, COUNT(*), MIN(PRICE) FROM GARMENT GROUP BY FCODE HAVING COUNT(*)>1;
(iii) SELECT TYPE FROM GARMENT WHERE ODR_DATE >'2021-02-01' AND PRICE <1500;
(iv) SELECT * FROM GARMENT WHERE TYPE LIKE 'F%';
Q27
long answer
3 marks
(a) Write a function in Python that displays the book names having y in their name from a text file Bookname.t
Example:
The names of following books:
One Hundred Years of Solitude
The Diary of a Young Girl
On the Road
After execution, the output will be:
One Hundred Years of Solitude
The Diary of a Young Girl
OR
(b) Write a function RevString() prints the words The rest of the content is displayed normally.
Example:
If content in the text file is:
UBUNTU IS AN OPEN SOURCE OPERATING SYSTEM
Output will be:
UBUNTU IS AN NEPO SOURCE GNITAREPO SYSTEM
Q28
short answer
3 marks
Write the output of any three SQL queries (i) to (iv) based on the tables COMPANY and CUSTOMER given below:
Table: COMPANY
CID C_NAME CITY PRODUCTNAME
111 SONY DELHI TV
222 NOKIA MUMBAI MOBILE
333 ONIDA DELHI TV
444 SONY MUMBAI MOBILE
555 BLACKBERRY CHENNAI MOBILE
666 DELL DELHI LAPTOP
Table: CUSTOMER
CUSTID CID NAME PRICE QTY
C01 222 ROHIT SHARMA 70000 20
C02 666 DEEPIKA KUMARI 50000 10
C03 111 MOHAN KUMAR 30000 5
C04 555 RADHA MOHAN 30000 11
(i) SELECT PRODUCTNAME, COUNT(*)FROM COMPANY GROUP BY PRODUCTNAME HAVING COUNT(*)> 2;
(ii) SELECT NAME, PRICE, PRODUCTNAME FROM COMPANY C, CUSTOMER C
Q28
short answer
3 marks
Write the output of any three SQL queries (i) to (iv) based on the tables COMPANY and CUSTOMER given below :
Q29
short answer
3 marks
Write a function search_replace() in Python which accepts a list $L$ of numbers and a number to be searched. If the number exists, it is replaced by $0$ and if the number does not exist, an appropriate message is displayed.
Q30
short answer
3 marks
A list contains following record of course details for a University : $[\text{Course\_name}, \text{Fees}, \text{Duration}]$. Write the following user defined functions to perform given operations on the stack named 'Univ' : (i) Push_element() To push an object containing the Course_name, Fees and Duration of a course, which has fees greater than 100000 to the stack. (ii) Pop_element() To pop the object from the stack and display it.
Q31
long answer
ABC Consultants are setting up a secure network for their office campus at Noida for their day-to-day office and web-based activities. They are planning to have connectivity between three buildings and the head office situated in Bengaluru. As a network consultant, give solutions to the questions (i) to (v), after going through the building locations and other details which are given below : (i) Suggest the most suitable place to install the server for this organization. Also, give reason to justify your suggested location. (ii) Suggest the cable layout of connections between the buildings inside the campus. (iii) Suggest the placement of the following devices with justification : Switch Repeater (iv) The organization is planning to provide a high-speed link with the head office situated in Bengaluru, using a wired connection. Suggest a suitable wired medium for the same. (v) The System Administrator does remote login to any PC, if any requirement arises. Name the protocol, which is used for the same.
Q33
mcq
2 marks
What possible output(s) are expected to be displayed on screen at the time of execution of the following code ?
-
A.
Pencil:Book
-
B.
Pencil:Book Eraser:Bag
-
C.
Pen:Book Bag:Book
-
D.
Bag:Eraser
Q33
long answer
5 marks
Write a point of difference between append (a) and write (w) modes in a text file. Write a program in Python that defines and calls the following user defined functions:
(i) Add_Teacher() : It accepts the values from the user and inserts record consists of a list with field elements as T_id, Tname and desig to store teacher ID, teacher name and designation respectively.
(ii) Search_Teacher() : To display the records of all the PGT (designation) teachers.
Q33
long answer
5 marks
Write one point of difference between seek() and tell() functions in file handling. Write a program in Python that defines and calls the following user defined functions:
(i) Add_Device() : The function accepts and adds records of the consists of a list with field elements as P_id, P_name and Price to store peripheral device ID, device name, and price respectively.
(ii) Count_Device() : To count and display number of peripheral devices, whose price is less than 1000.
Q34
short answer
3 marks
The table Bookshop in MySQL contains the following attributes : B_code Integer B_name String Qty Integer Price Integer Note the following to establish connectivity between Python and MySQL : Username is shop Password is Book The table exists in a MySQL database named Bstore. The code given below updates the records from the table Bookshop in MySQL. Statement 1 to form the cursor object. Statement 2 to execute the query that updates the Qty to 20 of the records whose B_code is 105 in the table. Statement 3 to make the changes permanent in the database. import mysql.connector as mysql def update_book(): mydb=mysql.connect(host="localhost", user="shop",passwd="Book",database="Bstore") mycursor=__________ # Statement 1 qry= "update Bookshop set Qty=20 where
Q34
long answer
2 marks
The ABC Company is considering to maintain their salespersons records using SQL to store data. As a database administrator, Alia created the table Salesperson and also entered the data of 5 Salespersons.
Table: Salesperson
S_ID S_NAME AGE S_AMOUNT REGION
S001 SHYAM 35 20000 NORTH
S002 RISHABH 30 25000 EAST
S003 SUNIL 29 21000 NORTH
S004 RAHIL 39 22000 WEST
S005 AMIT 40 23000 EAST
Based on the data given above, answer the following questions:
(i) Identify the attribute that is best suited to be the Primary Key and why?
(ii) The Company has asked Alia to add another attribute in the table. What will be the new degree and cardinality of the above table?
(iii) Write the statements to:
(a) Insert details of one salesman with appropriate data.
(b) SHYAM SOUTH table Salesperson.
OR (Option for part iii only)
(iii) Write the statement to:
(a) Delete the record of salesman RISHABH, as he has left the company.
(b) Remove an attribute REGION from the table.
Q35
short answer
3 marks
The table Bookshop in MySQL contains the following attributes: B_code Integer, B_name String, Qty Integer, Price Integer. Note the following to establish connectivity between Python and MySQL: Username is shop, Password is Book. The table exists in a MySQL database named Bstore. The code given below updates the records from the table Bookshop in MySQL. Statement 1 to form the cursor object. Statement 2 to execute the query that updates the Qty to 20 of the records whose B_code is 105 in the table. Statement 3 to make the changes permanent in the database.
Q35
long answer
Atharva is a programmer, who has recently been given a task to write a Python code to perform the following binary file operation with the help of a user defined function/module:
Copy_new() : to create a binary file new_items.dat and write all the item details stored in the binary file, items.dat, except for the item whose item_id is 101. The data is stored in the following
Q35
long answer
Atharva is a programmer, who has recently been given a task to write a Python code to perform the following binary file operation with the help of a user defined function/module :
Copy_new() : to create a binary file new_items.dat and write all the item details stored in the binary file, items.dat, except for the item whose item_id is 101. The data is stored in the following format :
{item_id:[item_name,amount]}
import ___________ # Statement 1
def Copy_new():
f1=_____________ # Statement 2
f2=_____________ # Statement 3
item_id=int(input("Enter the item id"))
item_detail=___________ # Statement 4
for key in item_detail:
if _______________: # Statement 5
pickle.___________ # Statement 6
f1.close()
f2.close()
He has succeeded in writing partial code and has missed out certain statements. Therefore, as a Python expert, help him to complete the code based on the given requirements :
Q37
short answer
3 marks
The table Bookshop in MySQL contains the following attributes: B_code Integer, B_name String, Qty Integer, Price Integer. Note the following to establish connectivity between Python and MySQL: Username is shop, Password is Book. The table exists in a MySQL database named Bstore. The code given below reads the records from the table Bookshop and displays all the records: Statement 1 to form the cursor object. Statement 2 to write the query to display all the records from the table. Statement 3 to read the complete result of the query into the object named B_Details, from the table Bookshop in the database.
Q43
short answer
1 mark
Which module should be imported in the program ? (Statement 1)
Q44
short answer
1 mark
Write the correct statement required to open the binary file "items.dat". (Statement 2)
Q45
short answer
2 marks
Which statement should Atharva fill in Statement 3 to open the binary file "new_items.dat" and in Statement 4 to read all the details from the binary file "items.dat".
Q46
short answer
2 marks
What should Atharva write in Statement 5 to apply the given condition and in Statement 6 to write data in the binary file "new_items.dat".
Q91
mcq
2 marks
Predict the output of the code given below:
-
A.
learningCS
-
B.
LearningCS
-
C.
L&&earningCS
-
D.
None