Cs Paper-3
Cs Paper-3
3. Which one of the following refers to the copies of the same data (or 1
information) occupying the memory space at multiple places.
a) Data Repository
b)Data Inconsistency
c)Data Mining
d)Data Redundancy
251 | P a g e
6. What is the output of the following program if the student.csv file contains 1
following data?
Student.csv
Ronit, 200
Akshaj, 400
import csv
d = csv.reader(“student.csv”)
next (d)
for row in d:
print (row);
7. The command used to skip a row in a CSV file is 1
A. next()
B. skip()
C. omit()
D. bounce()
8.Inspecting the value at the stack’s top without removing it. 1
a) peak operation
b) insert operation
c) pop operation
d) push operation
10. Which statement will give the output as : True from the following : 1
a) >>>not -5
b) >>>not 5 1
c) >>>not 0
d) >>>not(5-1)
252 | P a g e
11. Give the output of the following code: 1
>>>import math
>>>math.ceil(1.03)+math.floor(1.03)
a) 3
b) -3.0
c) 3.0
d) None of the above
a) Integer
b) float
c) string
d) Complex
Question.
Assertion (A): A referential integrity is a system of rules of DBMS.
Reason (R): It ensures that user don't accidently delete or change related data.
253 | P a g e
(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 correct explanation for A.
(C) A is true but R is false.
(D) A is false but R is true.
Question.
Assertion (A): The keyword DISTINCT is used with SELECT command.
Reason (R): DISTINCT keyword eliminates duplicate rows
17. Which of the following operation is supported in python with respect to tuple 1
t?
a) t[1]=33
b) t.append(33)
c) t=t+t
d) t.sum()
1
18. A ………………is a virtual table that does not really exist in its own right 1
but is instead derived from one or more underlying base table(s) in DBMS
254 | P a g e
SECTION B
19.
Littu wrote a code function to display Fibonacci series. Correct the errors and 2
rewrite it.
def Fibonacci()
nterms = int(input("How many terms? "))# first two terms
n1, n2 = 0, 1
count = 0
if nterms<= 0:# check if the number of terms is valid
print("Please enter a positive integer");
elifnterms == 1:# if there is only one term, return n1
print("Fibonacci sequence upto",nterms,":")
print(n1);
else:# generate fibonacci sequence
print("Fibonacci sequence:")
while count >nterms:
print(n1)
nth = n1 + n2
n1 = n2# update values
n2 = nth
count -= 1
21.
a)Predict the output of the following code fragments: 2
keepgoing = True
x=100
while keepgoing :
print (x)
x = x - 10
if x < 50 :
keepgoing = False
b)counter = {}
defaddToCounter(country):
if country in counter:
counter[country] += 1
else:
counter[country] = 1
255 | P a g e
addToCounter('China')
addToCounter('Japan')
addToCounter('china')
print (len(counter))
22.
The Mname Column of a table Members is given below 2
Mname
Aakash
Hirav
Vinayak
Sheetal
Rajeev
(i) SELECT Mname FROM Members WHERE Mname ' “%\v";
(ii) SELECT Mname FROM Members WHERE Mname LIKE "%e%";
23.
a. Give three examples of DDL & DML commands? 2
24. How is HAVING clause similar to WHERE clause? How is HAVING clause 2
differentfrom WHEREclause? Explain with the help of examples of each.
OR
SECTION C
26. Write a method in python to write multiple line of text contents into a text 3
file mylife.txt.
256 | P a g e
OR
Write a method in Python to read lines from a text file INDIA.TXT, to find
and display the occurrence of the word 'India'. For example, if the content of
the file is:
India is the fastest-growing economy. India is looking for more investments
around the globe. The whole world is looking at India as great market. Most
of the Indians can foresee the heights that India is capable of reaching.
The output should be 4.
27. a)Define candidate key, Primary key and Foreign Key. 1+2
b)Write the SQL commands for the given questions below based on the table
STUDENT.
No Name Age Dept DOJ Fee Sex
1 Anu 24 CS 10-01-19 250 M
2 Manu 21 EE 09-02-17 480 M
3 Vinu 25 CS 23-01-19 400 M
4 Pallavi 26 IT 22-05-17 260 F
5 Sai 30 EE 16-03-20 310 F
6 Appu 34 BE 15-06-17 250 F
7 Minnu 23 CS 29-01-18 480 M
MEDLEYS
257 | P a g e
medley_id | color | fruit | rating
============================
1 red apple 25
2 blue pear 5
3 green apple 12
4 red apple 10
5 purple kiwi 5
6 purple kiwi 50
7 blue kiwi 3
8 blue pear 9
II) Write a COMMAND to delete the column DOP from the table
VEHICLE. Table have five columns V_ID, OWNER_NAME, ADDRESS,
MODEL_NO, COLOUR, DOP.
29. Write a python program using function to find the largest element in a list 3
and then reverse the list contents and display it. Don’t use in-built functions
for the program.
30. Write a code for the STACK PUSH and POP implementation. 3
a)Write functions AddPlayer(player) and DeletePlayer(player) in python to
add and remove a player by considering them as push and pop operations
in a stack.Write a function to display the stack elements.
OR
Vedika has created a dictionary containing names and marks as key-value pairs
of 5 students. Write a program, with separate user-defined functions to
perform the following operations:
Push the keys (name of the student) of the dictionary into a stack, where the
corresponding value (marks) is greater than 70.
Pop and display the content of the stack.
The dictionary should be as follows:
258 | P a g e
SECTION D
i. Suggest the most suitable place (i.e., building) to house the server of
this organization. Also give a reason to justify your suggested
location.
259 | P a g e
ii. Suggest the placement of the following devices with justification:
a. Repeater.
b. Switch.
iii. Suggest a cable layout of connections between the buildings inside
the campus.
iv. The organization is planning to provide a high speed link with its
head office situated in Mumbai using a wired connection. Which
of the following cables will be most suitable for this job.
• Optical Fiber
• Co-axial Cable
• Ethernet Cable
v. While connecting the devices two modems are found to
be defected. What is the function of modem?
32. a) Write the output of the code 2+3
def L1(D):
CNT = 3
TOTAL = 0
for C in [7,5,4,6]:
T = D[CNT]
TOTAL = float (T) + C
print(TOTAL)
CNT-=1
TXT = ["20","50","30","40"]
L1(TXT)
b)The program to illustrate Insertion of records to database in Python is given
below. Note the following to establish connectivity between Python and
MYSQL:
• Username is root
• Password is tiger
• The table exists in a MYSQL database named Company.
import mysql.connector as mysql
try:
det=ps.connect(host='localhost',user='root',password='tiger',database='
Company')
cmd=_________ #Statement 1
pid=input("Enter Product Id:")
pn=input("Enter Product Name:")
pr = input("Enter Product Rate:")
md = input("Enter Mf. Date:")
query="insert into products values('{}','{}',{},'{}')"
260 | P a g e
.format(pid,pn,pr, md)
____________ #Statement 2
____________ #Statement 3
det.close()
print("Record Submitted")
except Exception as e:
print(e)
OR
OR
What is aBinary File? Give examples.
The detail of marks of class XII are stored in file named RESULTS.CSV.
Raman, the Maths teacher wants to search the details of one student. Write
a program to search the details based on name .
SECTION E
262 | P a g e
34. Consider the following DEPT and WORKER tables. Write SQL queries for 4
(i) to and (iv) find outputs for queries ©v) to (viii):
(i) To display Wno, Name, Gender from the table WORKER in descending
order of Wno.
(ii) To display the Name of all the FEMALE workers from the table
WORKER
.
(iii) Write statements
a) To display the Wno and Name of those workers from the table WORKER
who are born between '1987-01-01' and '1991-12-01'.
b) To count and display MALE workers who have joined after '1986-01-
01"..
OR(only for part iii)
263 | P a g e
35.
Arun, during Practical Examination of Computer Science, has been assignedan 4
incomplete search() function to search in a pickled file student.dat. The
Filestudent.dat is created by his Teacher and the following information is
knownabout the file.
• File contains details of students in [roll_no,name,marks] format.
• File contains details of 10 students (i.e. from roll_no 1 to 10) and
separate list of each student is written in the binary file using dump().
Arun has been assigned the task to complete the code and print details of
rollnumber 1.
def search():
f = open("student.dat",____)#Statement-1
____: #Statement-2
while True:
rec = pickle.____#Statement-3
if(____): #Statement-4
print(rec)
except:
pass
f.close()
II). Identify the suitable code to be used at blank space in line marked as
Statement2
a) if(rec[0]==1)
264 | P a g e
b) for i in range(10)
c) try
d) pass
IV). What will be the suitable code for blank space in line marked as
Statement-4.
a) rec[0]==2
b) rec[1]==2
c) rec[2]==2
d) rec[0]==1
Computer Science(083)
Sample Question Paper – III Marking Scheme
SECTION A
1) Find output generated by the following code: 1
p=10
q=20
p*=q//3
q+=p=q**2
print(p,q)
Answer: 60,480
2) A database can have only one table(True/False) 1
Answer False
265 | P a g e