0% found this document useful (0 votes)
253 views

SQP 2

This document is the question paper for the Computer Science subject exam with a total of 70 marks. It contains 5 sections (A-E) with various types of questions worth different marks. Section A contains 18 multiple choice questions worth 1 mark each. Section B has 7 short answer questions worth 2 marks each. Section C has 5 short answer questions worth 3 marks each. Section D has 3 long answer questions worth 5 marks each. Section E has 2 questions worth 4 marks each, with an internal choice in question 35c. All programming questions must be answered using Python.

Uploaded by

somarshidubey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
253 views

SQP 2

This document is the question paper for the Computer Science subject exam with a total of 70 marks. It contains 5 sections (A-E) with various types of questions worth different marks. Section A contains 18 multiple choice questions worth 1 mark each. Section B has 7 short answer questions worth 2 marks each. Section C has 5 short answer questions worth 3 marks each. Section D has 3 long answer questions worth 5 marks each. Section E has 2 questions worth 4 marks each, with an internal choice in question 35c. All programming questions must be answered using Python.

Uploaded by

somarshidubey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

CLASS: XIl MAX MARKS:70

SUBJECT: COMPUTER SCIENCE TIME:3 HOURS

General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is given in
Q35 against part c only.
8. All programming questions are to be answered using Python Language only

SECTIONA
1. State True or False
"Python has a set of keywords that can also be used to declare variables"

2. Which of the following is not a valid python operator?


a) % b) in c)# d**

3. What will be the output of the following python dictionary operation?


data {'A':2000, 'B':2500, 'C':3000, 'A':4000
print(data)
a)A:2000, 'B':2500, 'C:3000, 'A':4000}
b) {'A:2000, 'B':2500, 'C':3000}
c) F'A4000, 'B':2500, 'C:3000
d) It will generate an error.

4.
print(True or not True and False)
Choose one option from the following that will be the correct output after
executing the above python expression.
a) False b) True c) or d) not

5. Select the correct output of the following python code:


str="My program is program for you"
t-str.partition("program")
print(t)
a) ('My' 'program', 'is', 'program', 'foryou')
b) ('My,'program,' is program for you')
c) ('My'"is program for you')
d) ('My', 'is', 'for you')
6. Which of the file opening mode will open the file for reading and writing in 1
binary mode.
a) rb b) rb+ c) wb d) a+

. Which of the following statements is True?


a) There can be only one Foreign Key in a table.
b) There can be only one Unique key is a table
c)There can be only one Primary Key in a Table
d) A table must have a Primary Key.

8. Which of the following is not part of a DDL query?


a) DROP
b) MODIFY
c) DISTINCT
d) ADD

9. Which ofthe following operations on a string will generate an error? 1


a) "PYTHON"2
b) "PYTHON"+ "10"
c)"PYTHON"+10
d) "PYTHON"+ "PYTHON"

10 Keyword is used to obtain unique values in a SELECT query 1


a) UNIQUE
b) DISTINCT
c) SET
d) HAVING

11 Which of the following python statement will bring the read pointer to 10th
character from the end of a file containing 100 characters, opened for
reading in binary mode.
a) File.seek{10,0)
b) File.seek(-10,2)
c) File.seek(-10,1)
d) File.seek(10,2)
12 Which statement in MySql will display all the tables in a database?
a) SELECT* FROM TABLES;
b) USE TABLES;
c)DESCRIBE TABLES;
d) SHOW TABLES;

13 Which of the following is used to receive emails over Internet?


a) SMTP b ) POP c) PPP d) VolP
14 What will be the output of the following python expression?
print(2**3**2)
a) 64 b) 256 c) 512 d) 32

15 Which ofthe following is a valid sql statement?


a) ALTER TABLE student SET rollno INT(5);
b) UPDATE TABLE student MODIFY age = age +10;
c)DROP FROM TABLE student;
d) DELETE FROM student;
16 Which of the following is not valid cursor function while performing database 1
operations using python. Here Mycur is the cursor object?
a) Mycur.fetch()
b) Mycur.fetchone()
c) Mycur.fetchmany(n)
d) Mycur.fetchall()
Q17 and 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) Ais false but Ris True
17 Assertion (A): A variable declared as global inside a function is visible with 1
changes made to it outside the function.
Reasoning (A): All variables declared outside are not visible inside a function
tillthey are redeclared with global keyword.
18 Assertion (A): A binary file in python is used to store collection objects like
lists and dictionaries that can be later retrieved in their original form using
pickle module.
Reasoning (A): A binary files are just like normal text files and can be read
using a text editorlike notepad.
SECTION B
19 Sameer has written a python function to compute the reverse of a number. 2
He has however committed a few errors in his code. Rewrite the code after
removing errors also underline the corrections made.
define reverse(num):
rev 0
While num> 0:
rem== num %10
rev rev*10 + rem
num = num//10

return rev

printfreverse(1234)
20 Mention two differences between a Hub and a switch in networking.

OR

Mention one advantage and one disadvantage of Star Topology.

21 a) What will be the output of the following string operation.


str="PYTHON@LANGUAGE"
print(str[2:12:2])

b) Write the output of the following code.


data = [1,2,4,5]
for x in data:
X=X+ 10
print(data)
22 Mention two differences between a PRIMARY KEY and a UNIQUE KEY.

23 a) Expand the following abbreviations:


i)URL ii) TCP

b) What is the use of VoIP?


24 Predict the output of the following python code:
def foo(s1,s2):
11=]
12=[1
for x in s1:
11.append(x)
for x in s2:
12.append(x)
return 11,12
a,b=foo("FUN", 'DAY')
printfa,b)
OR
Predict the output of the following python code
data - [2,4,2,1,2,1,3,3,4,4

d {}
for x in data:
if x in d:
dx=dx]+1
else:
dx]=1
print(d)
25 AMysQL table, sales have 10 rows. The following queries were executed on 2
the sales table.
SELECT COUNT(*) FROM sales;
COUNT()
10

SELECTCOUNT(discount) FROM sales;


COUNT(discount)
6
Write a statement to explain as to why there is a difference in both the
Counts.

OR

What is the difference between a Candidate Key and an Alternate Key

SECTION C
26 a) Consider the following tables Emp and Dept: 1+2
Relation: Emp
deptid Salary
Relation: Dept
empcode ename | deptid dname
1001 TOM 10 10000

11
10 Physics
1002 BOB 8000
1003 SID 10 9000 11 Chemistry
1004 JAY 12 9000 12 Biology
1005 JIM 11 10000

What will be the output of the following statement?


SELECT FROM Emp NATURAL JOIN Dept WHERE dname='Physics';

b) Write output of the queries (i) to (iv) based on the table Sportsclub
Table Name: Sportsclub
playerid pname sports country rating salary
10001 PELE SOCCER BRAZIL A | 50000

10002
FEDERER TENNIS SWEDEN A 20000
10003 VIRAT CRICKET INDIA A 15000

10004 SANIA TENNIS INDIA B 5000

10005 NEERAJ ATHLETICSs INDIA A 12000

10006 BOLT ATHLETICS JAMAICA A 8000


10007 PAUL SNOOKER | USA B 10000

(i)SELECT DISTINCT sports FROM Sportsclub;


(ii) SELECT sports, MAX(salary) FROM Sportsclub GROUP BY sports
HAVING sports<>'SNOOKER';
(ii) SELECT pname, sports, salary FROM Sportsclub WHERE
country='NDIA' ORDER BY salary DESC;
(iv) SELECT SUM(salary) FROM Sportsclub WHERE rating="B';

27 A pre-existing text file data.txt has some words written in it. Write a python
function displaywords() that will print all the words that are having length
greater than 3.
Example:
For the fie content:
A man always wants to strive higher in his life
He wants to be perfect.

The output after executing displayword() will be:


Always wants strive higher life wants perfect

OR

A pre-existing text file info.txt has some text written in it. Write a python
function countvowel() that reads the contents of the file and counts the
occurrence of vowels(A,E,J,0,U) in the file.

28 Based on the given set of tables write answers to the following questions.
Table: flights
flightidmodel Company
10 747 Boeing
12 320 Airbus
15 767 Boeing
Table:Booking
ticketno passenger | source destination quantity priceFlightid
10001 ARUN BAN DEL 7000 10
10002 ORAM BAN KOL 7500 12
10003 SUMITA DEL MUM 6000 15

10004 ALI MUM KOL 5600 1 2


10005 GAGAN MUM DEL 5000 10
a) Write a query to display the passenger, source, model and price for all
bookings whose destination is KOL
b) ldentify the column acting as foreign key and the table name where it
is presentin the given example.
29 Write a function modilst(L) that accepts a list of numbers as argument and
increases the value of the elements by 10 if the elements are divisible by 5.
Also write a proper call statement for the function.

For example:
If list Lcontains [3,5,10,12,15]
Then the modilist() should make the list L as |3,15,20,12,25]

30 |A dictionary contains the names of some cities and their population in crore. 3

Write a python function push(stack, data), that accepts an empty list, which
is the stack and data, which is the dictionary and pushes the names of those
countries onto the stack whose population is greater than 25 crores.
For example:
The data is having the contents {'India':140, 'USA':50, 'Russia':25, 'Japan':10}
then the execution of the function push() should push India and USA on the
stack.

OR

A list of numbers is used to populate the contents of a stack using a function


push(stack, data) where stack is an empty list and data is the list of numbers.
The function should push all the numbers that are even to the stack. Also
write the function pop() that removes the top element of the stack on its
each call.

SECTION D
31 Magnolia Infotech wants to set up their computer network in the Bangalore 5
based campus having four buildings. Each block has a number of computers
that are required to be connected for ease of communication, resource
sharing and data security. You are required to suggest the best answers to
the questions i) to v) keeping in mind the building layout on the campus.

HR
Development

Admin
Logistics

Number of Computers.
Block Number of computers
Development 100
HR 120
Admin 200
Logistics 110
Distance Between the various blocks
Block Distance
Development to HR 50m
Development to Admin 75m

Development to Logistics 120m


HR to Admin 110m
HRto Logistics 50m
Admin to Logistics 140m

i) Suggest the most appropriate block to host the Server. Also justify
your choice.
ii) Suggest the device that should should be placed in the Server
building so that they can connect to Internet Service Provider to
avail Internet Services.
ii) Suggestthe wired medium and draw the cable block to block layout
to economically connect the various blocks.
iv) Suggest the placement of Switches and Repeaters in the network
with justification.
v Suggest the high-speed wired communication medium between
Bangalore Campus and Mysore campus to establish a data network.

32 a) Write the output ofthe following code: 2+3

def change(m, n=10):


globalx
X+=m
ntX
m=ntx

print(m,n,x)
x=20
change(10)
change(20)

OR (only in a part)

What will be the output of the following python program?


str="

name "9@Days"
for x in name:
if x in "aeiou":
str+=x.upper()
elif not x.isalnum():
str+="**"

elif x.isdigit():
pass
else:
str+=x.lower()
print(str)
b) Sumitra wants to write a program to connect to MySQL database using
python and increase the age of all the students who are studying in class 11
by 2 years.
Since she had little understanding of the coding, she left a few blank spaces
in her code. Now help herto complete the code by suggesting correct coding
for statements 1, 2 and 3.

import as myc #Statement 1

con myc.connect(host="locahost", user="root", passwd="",


database="mydb")
mycursor =. #Statement 2
sql "UPDATE student SET age=age+2 WHERE class="XI"
mycursor.execute(sql)
sql= "SELECT* FROM student"
mycursor=con.execute(sql)
result #Statement 3
for row in result:
print(row)
Statement 1:The required module to be imported
Statement 2: To initialize the cursor object.
Statement 3: To read all the rows from the cursor object

33 A binary file data.dat needs to be created with following data written it in the 2+3
formof Dictionaries.
Rollno Name Age
1001 TOM 17
1002 BOB 16

1003 KAY 16
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 age is 16.
34 Tarun created the following table in MySQL to maintain stock for the items 1+1+
he has. 2

Table:Inventory
Productid stock
pname company price rating
10001 Biscuit Parley 1000 15 C

10002 Toffee Parley 500 5

10003 Eclairs Cadbury 800 10

10004 Cold Drink Coca Cola 500 25 NULL


1005 Biscuit Britania 500 30 NULL
1006 Chocolate Cadbury 700
50 C
Based on the above table answer the following questions.

a) ldentify the primary key in the table with valid justification.


b) What is the degree and cardinality of the given table.
c) Write a query to increase the stock for all products whose company is
Parley.
OR (only for part c)
Write a query to delete all the rows from the table which are not
having any rating.
35 Sudheer has written a program to read and write using a csv file. He has
written the following code but failed to write completely, leaving some
blanks. Help him to complete the program by writing the missing lines by
following the questions a) to d)

#Statement 1
headings = ['Country','Capital",'Population']

data [['India', 'Delhi',130],['USA',Washington DC,50],[Japan,Tokyo,2]


f= open'country.csv,w', newline=")
cSVwriter= csv.writer(f)
csvwriter.writerow(headings)
#Statement 2
f.closel)
f open('country.csv,")
csvreader csv.reader(f)
head = . #Statement 3
print(head)
for x in #Statement 4
if inttx[2])>50:
printx)
a) Statement 1- Write the pythonstatement that willallow Sudheer
work with csvfiles.
b) Statement 2-Write a python statementthat will write the list
containing the data availableas a nestedlist in the csv file
c) Statement 3- Write a python statementto read theheader rowin too
the head object.
d) Statement 4- Writethe object that containsthe datathat has been
read from thefile.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy