Preboard #3
Preboard #3
PREBOARD #3 2020-2021
SUB: COMPUTER SCIENCE (083)
Maximum Marks: 70 Time Allowed: 3 hours
General Instructions:
1. This question paper contains two parts A and B.
2. Each part is compulsory.
3. Both Part A and Part B have choices.
4. Part-A has 2 sections:
a. Section – I is short answer questions, to be answered in one word or one line.
b. Section – II has two case studies questions. Each case study has 4 case-based
subparts. An examinee is to attempt any 4 out of the 5 subparts.
Part-A
Section-I
Select the most appropriate option out of the options given for each question.
Attempt any 15 questions from question no 1 to 21.
1 Find the invalid identifier from the following: 1
a) Comp b) comp c) _comp d) 83comp
2 Given the list li=[1,2,5,6,7,8,9,55,66] ,write the output of print(li[::3]) 1
3 What is cursor? 1
4 Which among the following list of operator has the highest precedence? 1
a) << ,>> b) ** c) | d) %
5 What will be the output of following python code? 1
Cs=(45,67,89)
P=Cs*2
print(p)
(a) (45,67,89) (b) (45 ,45, 67, 67, 89 ,89)
( c)(45,67,89,45,67,89) (d) Error
6 What would the following code print ? 1
D={‘spring’ :’ autumn’ , ’autumn’ : ’fall’ ,’fall’ :’spring’}
print(D[‘autumn’])
(a) autumn (b) fall
(c ) spring (d) Error
20. Which of the following is not a legal constraint for a create table command? 1
a) Primary key b) Foreign Key c) Unique Key d) Distinct
21 Network device which connect a dissimilar networks. 1
a)hub b)switch c)router d) Gateway
Section-II
Both the Case study-based questions are compulsory. Attempt any 4 sub parts from
each question. Each question carries 1 mark
22 Consider the following tables Product and Client. Write SQL commands for the
23. Ranjan Kumar of class 12 is writing a program to create a CSV file “user.csv” which
will contain user name and password for some entries. He has written the following
code. As a programmer, help him to successfully execute the given task.
import _____________ # Line 1
newFileWriter = csv.writer(f)
newFileWriter.writerow([UserName,PassWord])
f.close()
print (row[0],row[1])
newFile.______________ # Line 4
addCsvFile(“Arjun”,”123@456”)
addCsvFile(“Arunima”,”aru@nima”)
addCsvFile(“Frieda”,”myname@FRD”)
readCsvFile() #Line 5
(a) Name the module he should import in Line 1. 1
(b) In which mode, Ranjan should open the file to add data into the file 1
(c) Fill in the blank in Line 3 to read the data from a csv file. 1
(d) Fill in the blank in Line 4 to close the file. 1
(e) Write the output he will obtain while executing Line 5. 1
Part – B
Section-I
24. Evaluate the following expressions: 2
(i) b+c>=a or not a+c>2*c and a+b<4*c if a=5,b=3,c=2
(ii) z+= x//y+x%y+y//x+y%x if x=5,y=3,z=2
25. Rewrite the following code in Python after removing all syntax error(s). Underline each 2
correction done in the code.
STRING=""HAPPY NEW YEAR"
for S in range[0,8]:
print(STRING(S))
print( S+STRING)
26. Find and write the output of the following Python code: 2
def fun(s):
k=len(s)
m=" "
for i in range(0,k):
if(s[i].isupper()):
m=m+s[i].lower()
elif s[i].isalpha():
m=m+s[i].upper()
else:
m=m+'bb'
print(m)
fun('school2@com')
27. Study the following program and select the possible output(s) from the options (i) to (iv) 2
following it. Also, write the maximum and the minimum values that can be assigned to
the variable Y.
import random
X= random.random()
Y= random.randint(0,4)
print(int(X),":",Y+int(X))
Section- II
34. Define a function avg( ) that will find the average value from a list of integers. 3
35. Write a program that will read the content of the text file THREE.txt and display the lines 3
starting with ‘A’.
Or
Write a function in python to count the number of words in a text file ‘acdc.txt’ starting
with an alphabet ‘B’ or ‘b’
36. Define pop( ) function on a stack STK where the function returns the deleted item. 3
Or
Define delete( ) function on a list LST.
37. Write output of following SQL queries based on the relations FACULTY and 3
COURSES.
FACULTY
F_ID Fname Lname Hire_date Salary
COURSES
C_ID F_ID Cname Fees
38. Refer the table FACULTY and COURSES in question no 37 and write SQL queries for 5
the following questions:-
(i)To display details of those Faculties whose salary is greater than 12000.
(ii)To display the details of courses whose fees is in the range of 15000 to 50000
(both values included)
(iii)To increase the fees of all courses by 500.
(iv)To display details of those courses which are taught by ‘Sulekha’.
(v)To arrange the content of the COURSES table in decreasing order of Fees.
39. Riana Medicos Centre has set up its new centre in Dubai. It has four buildings as shown 5
in the diagram given below:
Distances between various buildings are
as follows:
40. Write a program in python that will write records of 5 employees in the binary data file 5
employee.dat. (Format of record is : {empid – name-salary}) and display the records of
those employees whose salary is greater than Rs. 10,000/-. Sample data is given
below: -
{'empid':1001,'name':'John','salary':12000}
{'empid':1002,'name':'Sonu','salary':15000}
{'empid':1003,'name':'Deepak','salary':8000}
{'empid':1004,'name':'Rony','salary':18000}
{'empid':1005,'name':'Tina','salary':7000}
Or
Write a function show_st( ) in python that will read the content of the binary data file
student.dat and display the records of those students whose marks is greater than
90.The program should also diplay the number of students and average marks obtained
by the students.
Format of record is : (Roll – Name-Marks)