Dav ZJM CS 4
Dav ZJM CS 4
Dav ZJM CS 4
Code : 083
Please Check that this question paper
contains 35 questions and 06 pages.
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
(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
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