Dav ZJM CS 4

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

Roll No. : _________________ Sub.

Code : 083
Please Check that this question paper
contains 35 questions and 06 pages.

D.A.V. INSTITUTIONS, CHHATTISGARH


Practice Paper – 4 : 2023-24
Class : XII
Time : 3 Hrs. Subject : Computer Science-Python (083) Max. Marks : 70
General Instructions :
➢ Question paper is containing 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.
➢ In some questions of Section B,C & E there will be internal choice.
➢ All programming questions are to be answered using Python Language only.
Section : A ( 1 Mark each)
Select the most appropriate option out of the options given or write answer in one word/line.
Attempt all the questions from question No. 1 to 18.
1 State True or False : 1
“In a Python program, if a break statement is given in a nested loop, it terminates the
execution of all loops in one go . “
2 The primary key is selected from the set of ______________. 1
(a) Composite keys (b) candidate keys (c) foreign keys (d) None of the above
3 What is the value of this expression : 3 ** 3 ** 1 ? 1
(a) 27 (b) 9 (c) 3 (d) 1
4 What is the output of the following code ? 1
S = “hello”
print( S [ : 2 ] )
(a) he (b) lo (c) olleh (d) hello
5 In MySql , which key word is used to sort the records of a table in descending order ? 1
6 Amar wants to transfer pictures from his mobile phone to his laptop. She uses Bluetooth 1
Technology to connect two devices. Which type of network will be formed in this case ?
(a) PAN (b) LAN (c) MAN (d) WAN
7 Which line of code will cause an error ? 1
1. N = [5,4,3,[2],1]
2. print(N[0])
3. print(N[3][0])
4. print(N[5])
(a) Line 3 (b)Line 2 (c) Line 4 (d) Line 1
8 The partition() returns always a 3-elemnt list in string datatype (True/ Flase) 1
9 Which of the following options will not result in an error when performed on type in Python 1
where T = (1,2,3) ?
(a) T[1] = 5 (b) T.append(2) (c) T1 = T + T (d) T.sum()
10 __________ function returns the absolute value of given number under math module. 1
11 Out of the following , which has the largest network coverage area ? 1
(a) LAN (b) MAN (c) PAN (d) WAN
12 Consider the code given below : 1
1
N = 10
def Cal (A):
____________ # missing statement
N=N+A
Cal(20)
print(N)
Which of the following statement should be given in the blank for #missing statement, if the
output produced is 30 ?
(a) global N (b) global N=10 (c) global A (d) global A=20
13 State whether the following statement is True or False : 1
An exception may be raised even if the program is syntactically correct.
14 Which of the following field referred to the primary key of another table ? 1
(a) Alternate key (b) Primary Key (c) Candidate key (d) Foreign key
15 What is the full form of VoIP in context with Networking ? 1
16 Which of the following is not a valid mode to open a file ? 1
(a) ab (b) rw (c) r+ (d) w+
Q 17 & 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) : The file modes “r”,”w”,”a” work with text files as well as CSV files. 1
Reasoning (R) : The CSV file is a type of delimited text file only.
18 Assertion (A) : Every open file maintains a file pointer and keeps track of its position after 1
every operations.
Reasoning (R) : Every read & write operation takes place at the current position of the file
pointer.
Section B
Attempt all the questions from Q.No. 19 to 25 . Each question carries 2 mark

19 (i) Expand the following terms : PPP , FTP 2


(ii) Give one difference between XML and HTML
OR
(i) Define the term bandwidth with respect to networks.
(ii) How is http different from https ?
20 Rewrite the following code in Python after removing all syntax error(s). Underline each 2 2
correction done in the code.
Def sm(c):
s=0
for i in range( 1, c+1)
s += i
print(s)
#MAIN PROGRAM STARTS
print(sm( )) #function calling part
21 Write a function countNow(PLACES) in Python, that takes the dictionary, PLACES as an 2
argument and displays the names (in uppercase)of the places whose names are longer than 5
characters.
For example, Consider the following dictionary
PLACES={1:"Delhi",2:"London",3:"Paris",4:"New York",5:"Doha"}
The output should be:
LONDON
NEW YORK

2
OR
Write a function, lenWords(STRING), that takes a string as an argument and returns a tuple
containing length of each word of a string.
For example, if the string is "Come let us have some fun", the tuple will have (4, 3, 2, 4, 4, 3)
22 Predict the output of the following program : 2 2
keepgoing = True
x = 100
while keepgoing:
print(x)
x = x – 10
if x < 70 :
keepgoing = False
23 Name the function / method required to : 2 2
(i) Check if a string contains only uppercase letters.
(ii) Gives the length of the list.
(iii) Returns the element from the tuple having maximum value.
(iv) Gives all the keys in the dictionary.

24 Ms. Anjali has just created a table named “Emp” containing columns ENm, Dept & Salary. 2
After creating the table , she realized that she has forgotten to add a primary key column in
the table. Help her in writing an MySql command to add a primary key column EmpId of
integer type to the table “Emp”. Thereafter, write the command to insert a record as per your
choice.
25 Predict the output of the Python code given below: 2
def Diff(N1,N2):
if N1>N2:
return N1-N2
else:
return N2-N1
NUM= [10,23,14,54,32]
for CNT in range (4,0,-1):
A=NUM[CNT]
B=NUM[CNT-1]
print(Diff(A,B),'#', end=' ')

OR
Predict the output of the Python code given below:
tuple1 = (11, 22, 33, 44, 55 ,66)
list1 =list(tuple1)
new_list = []
for i in list1:
if i%2==0:
new_list.append(i)
new_tuple = tuple(new_list)
print(new_tuple)
Section C
Attempt all the questions from Q.No. 26 to 30 . Each question carries 3 mark
26 Find and write the output of the following Python code : 3
def Display(S1):
S2 = “ “ #no blank space
for i in range( len(S1)):
3
if S1[i].isupper() :
S2 = S2 + S1[i].lower()
elif S1[i].islower():
S2 = S2 +S1[i].upper()
else:
if i%2 ==0:
S2 = S2 + S1[i-1]
else:
S2 = S2 +”#”
print(S2)
#MAIN PROGRAM
Display(“Fun@Python3”)
27 Ram has forgotten the names of the databases, tables and the structure of the tables that he 3
had created in RDBMS on his computer.
(a) Write MySql statement to display the names of all the databases present in RDBMS
application on his computer.
(b) Write the statement which he should execute to open the database named “STOCK”
(c) Write the statement which he should execute to display the structure of the table
“ITEMS” existing in the above opened database “STOCK”.
28 Write a function in Python to read a text file, Alpha.txt and displays those lines which begin 3
with the word ‘You’.
OR
Write a function, vowelCount() in Python that counts and displays the number of vowels in
the text file named Poem.txt.
29 Write SQLcommands for (a) to (c) on the basis of table GRADUATE. 3

i) List the names of those students who have obtained DIV 1 sorted by NAME.
ii) To count the number of students who are either PHYSICS or COMPUTER SC graduates.
iii) Display Name of the students whose average is more than 65.
30 A list contains following record of customer : 3
[Customer_name, Phone_number, City]
Write the following user-defined functions to perform given operations on the stack named
‘status’ :
Push_element() : To Push an object containing name and Phone number of customers who
live in ‘Kolkata’ to the stack.
Pop_element() : To Pop the objects from the stack and display them. Also, display ‘ Stack
Empty’ when there are no elements in the stack.
Section D
Attempt all the questions from Q.No. 31 to 32 . Each question carries 4 mark
31 Consider the table EXAMDETAILS given below : 4
4
Table : EXAMDETAILS
EXAMID ENAME ELANGUAGE RATING PLATFORM
E001 SSE ENGLISH 4 OFFILINE
E004 SSCE ENGLISH 5 OFFLINE
E007 CET HINDI 3 BLENDED
E011 TET ENGLISH 2 ONLINE
E015 PET HINDI 2 ONLINE
Write statements to :
(a) Delete the records whose language is “ENGLISH”
(b) Add a new record : “E020”, “IIT”, ENGLISH, 6, “ONLINE”
(c) Add a new column “EFEES” of type float.
(d) Display the structure of the table EXAMDETAILS.
32 Create a binary file student.dat to hold students’ records like Rollno, Students name, and 4
Address using the list. Write functions to write data, read them and print on the screen.
Give two functions as shown below :
file_create() : To write data into the file.
read_read() : To read data and print from file.
Section E
Attempt all the questions from Q.No. 33 to 35 . Each question carries 5 mark
33 Devine Tech Corporation(DTC) is a professional consultancy company. The company is 5
planning to set up their new offices in India with its hub at Hyderabad. As a network adviser,
you have to understand their requirement and suggest them the best available solutions.
Their queries are mentioned as (i) and (v) below :
Block to Block distance (in m )
Block (From) Block (To) Distance
Human Resource Conference 110
Human Resource Finance 40
Conference Finance 80
Expected number of computers to be in
each block
Block Computers
Human Resource 25
Finance 120
Conference 90

(i) Which will be the most appropriate block, where TTC should plan to install their
server ?
(ii) Draw a block to cable layout to connect all the buildings in the most appropriate
manner for efficient communication.
(iii) Suggest a suitable topology to connect the computers in each building.
(iv) Which of the following device will be suggested by you to connect each
computer in each of the buildings ?
(a) Swtich/Hub (b) Modem (c) Gateway
(v) Company is planning to connect its offices in Hyderabad which is less than 1 km.
Which type of network will be formed ?
34 (i) Differentiate between COUNT() and COUNT(*) functions in SQL. 1+4
(ii) Write a code to insert the following record in the table Product : =5
• Productno – integer
• Pname – string
• Productquantity – integer
5
• Productcost – integer
Note the following to establish connectivity between Python and MySQL :
• Username is root
• Password is tiger
• The table exists in a MySQL database named Manfacture.
• The details (Productno , Pname , Productquantity , Productcost ) are to be accepted
from user.
OR

Categorise the following commands as DDL or DML :


INSERT, UPDATE, ALTER, DROP
Write the code to read record from the table named student and displayes only those records
who have marks greater than 75 :
RollNo – integer
Name – string
Class – integer
Marks – integer
Note the following to establish connectivity between Python and MySQL :
• Username is root
• Password is tiger
• The table exists in a MySQL database named School.
35 (i) Define the term Domain with respect to RDBMS. Give one example to support your 1+4
answer. =5

(ii) Kabir wants to write a program in Python to insert the following record in the table
named Student in MYSQL database, SCHOOL:
• rno(Roll number )- integer
• name(Name) - string
• DOB (Date of birth) – Date
• Fee – float

Note the following to establish connectivity between Python and MySQL:


• Username - root
• Password - tiger
• Host - localhost

The values of fields rno, name, DOB and fee has to be accepted from the user. Help Kabir to
write the program in Python.
OR
(i) Give one difference between alternate key and candidate key.

(ii) Sartaj has created a table named Student in MYSQL database, SCHOOL:
• rno(Roll number )- integer
• name(Name) - string
• DOB (Date of birth) – Date
• Fee – float

Note the following to establish connectivity between Python and MySQL:


Sartaj, now wants to display the records of students whose fee is more than 5000. Help Sartaj
to write the program in Python.

You might also like