CS Paper
CS Paper
22. Mr. Avinash wants to create a table in MySQL for Employee (eid (Primary Key), 2
ename, salary)
OR
Write any two differences between DELETE and DROP commands
23. Write a python statement for each of the following tasks using built-in functions/ 2
methods only:
i)To add list of elements L2=[11,12,14] to existing list L1=[10,15].
ii)To make the elements in sorted manner.
OR
A list named stu_percentage stores the percentage of students of a class. Write
python command to import the required module and display the most common
percentage from the given list.
24. Find output generated by the following code: 2
string="aabbcc"
count=3
while True:
if string[0]=='a':
string=string[2:]
elif string[-1]=='b':
string=string[:2]
else:
count+=1
break
print(string)
print(count)
25. Find output generated by the following code: 2
def Compy(N1,N2=10):
return N1 > N2
NUM= [10,23,14,54,32]
for VAR in range (4,0,-1):
A=NUM[VAR]
B=NUM[VAR-1]
if VAR > len(NUM)//2:
print(Compy(A,B),'#', end=' ')
else:
print(Compy(B),'%',end=' ')
SECTION C
26. Write a Python program to count number of words in a given string that start 3
with vowels.
27. Write the SQL command for the following on the basis of given table. 3
Table: SPORTS
StudentNo Class Name Game1 Grade1 Game2 Grade2
10 7 Sammer Cricket B Swimming A
11 8 Sujit Tennis A Skating C
12 7 Kamal Swimming B Football B
13 7 Venna Tennis C Tennis A
14 9 Archana Basketball A Cricket A
15 10 Arpit Cricket A Athletics C
i) Display the names of the students who have grade ‘A’ in either Game 1 or
Game 2 or both.
ii) Display the number of students having the GRADE1 as ‘A’ in Game1.
iii) Display number of students in each class group.
28. Write a Python program to read the text file abc.txt and print only the lines that 3
start with ‘s’
OR
Write a function in Python to read lines from a text file book.txt, to find and display
the occurrence of the word 'are'. For example, if the content of the file is:
Books are referred to as a man’s best friend. They are very beneficial for mankind
and have helped it evolve. Books leave a deep impact on us and are responsible
for uplifting our mood.
The output should be 3.
29. a. Define the term Domain with respect to RDBMS. Give one example to support 3
your answer.
b. What is the syntax of ALTER command in MySQL?
c. How to find referential integrity in MySQL?
30. Write the following functions in Python: 3
(i) Push (st, expression), where expression is a string containing a valid
arithmetic expression with +, -, *, and / operators, and st is a list
representing a stack. The function should push all the operators
appearing in this expression into the stack st.
(ii) Pop(st) to pop all the elements from the stack st and display them. It should
also display the message 'Stack Empty' when the stack becomes empty.
SECTION D
31. Write the SQL query commands based on following table: 4
Table : Book
Book_ Book Author_name Publis Price Type Quan
id name her tity
C0001 Fast Cook Lata Kapoor EPB 355 Cookery 5
F0001 The Tears William Hopkins First 650 Fiction 20
Publ
T0001 My First Brain & Brooke FPB 350 Text 10
c++
T0002 C++ Brain A.W. Rossaine TDH 350 Text 15
works
F0002 Thunderbo Anna Roberts First 750 Fiction 50
lts Publ
Write SQL query for (a) to (d)
a. To show book name, Author name and price of books of First Publ
Publisher
b. To list the names from books of text type
c. To Display the names and price from books in ascending order of their
prices.
d. To increase the price of all books of EPB publishers by 50.
SECTION E
33. BeHappy Corporation has set up its new centre at Noida, Uttar Pradesh for its 5
office and web-based activities. It has 4 blocks of buildings.
Distance between the various blocks is as follows:
A to B 40 m
B to C 120
m
C to D 100
m
A to D 170
m
B to D 150
m
A to C 70m
Numbers of computers in each block
Block A 25
Block B 50
Block C 12
5
Block D 10
Suggest the most suitable location to install the main server of this institution to
get efficient connectivity
a. Suggest and draw the cable layout to efficiently connect various blocks of
buildings within the Noida centre for connecting the digital devices
b. Suggest the placement of the following device with justification
i.Repeater
ii. Hub/Switch
c. Which kind of network (PAN/LAN/WAN) will be formed if the Noida office
is connected to its head office in Mumbai?
34. A binary file data.dat needs to be created with following data written it in the 2+3
form of Dictionaries.
EID ENAME SALARY
101 KARTHIK 50000
102 PRUDHVI 55000
103 MANASA 60000
Write the following functions in python accommodate the data and manipulate
it.
a) A function insert() that creates the data.dat file in your system and
writes the three dictionaries.
b) A function() read() that reads the data from the binary file and displays
the dictionaries whose SALARY is greater than 50000.
OR
a. What is the difference between w (write) mode and a (append) mode
b. Write a Program in Python that defines and calls the following user defined 1+4
functions: (i) ADD() – To accept and add data of an employee to a CSV file
‘record.csv’. Each record consists of a list with field elements as empid,
name and mobile to store employee id, employee name and employee
salary respectively.
(ii) COUNTR() – To count the number of records present in the CSV file
named ‘record.csv’
35. 2+3
a. What is the difference between UNIQUE KEY and PRIMARY KEY?
b. Arushi has created a table named student in MYSQL database, School:
•rno(Roll number )- integer
• name(Name) - string
• clas (Clas) – string
• marks – float
Note the following to establish connectivity between Python and MySQL:
• Username - root • Password - 12345
• Host - localhost
ii)Arushi, now wants to add record of student by taking data
from user. Help arushi to write the program in Python.
OR
a. Define Alternate Key
b. Ravi has created a table named employee in MYSQL database, orgn:
•eid(Roll number )- integer
• ename(Name) - string
• DOJ (Date of joining) – Date
• Salary – float
Note the following to establish connectivity between Python and MySQL:
• Username - root • Password - mysql
2+3
• Host - localhost
Ravi, now wants to display the records of employees whose salary is more
than 25000. Help Ravi to write the program in Python.
***************