Nothing Special   »   [go: up one dir, main page]

CS-SQP-Set 2-Ranchi

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

KENDRIYA VIDYALAYA SANGATHAN

RANCHI REGION
SAMPLE QUESTION PAPER (2022-23)
CLASS: XII MAX TIME: 3:00 Hrs.

SUBJECT: Computer Science (CODE - 083) MAX MARKS: 70

General Instructions:
i) This question paper contains five sections, Section A to E.
ii) All questions are compulsory.
iii) Section A have 18 questions carrying 01 mark each.
iv) Section B has 07 Very Short Answer type questions carrying 02 marks each.
v) Section C has 05 Short Answer type questions carrying 03 marks each.
vi) Section D has 03 Long Answer type questions carrying 05 marks each.
vii) Section E has 02 questions carrying 04 marks each. Question no 35 has internal choice in
part c.
viii) All programming questions are to be answered using Python Language only.

SECTION A

1. Name the Python modules which need to be imported to invoke the following functions. [1]

a) dump() b) connect()

2. What would be the output of the following declaration? [1]

A = “Hello”
print(list(A))

a) [‘H’, ‘e’, ‘l’, ‘l’, ‘o’] b) [‘Hello’]


c) “Hello” d) None

3. Identify the type of the following SQL statement. [1]

INSERT INTO Student values(1,’a’);

a) DDL b) DCL c) DML d) Integrity Constraint

4. Write the statements to print the first and the last appointment from the following tuple declaration.
[1]

Appointment = (3, 4.5, 1.25, 1.30, 3.50, 2.30, 4)

5. Which of the following cannot be used as identifier? [1]


Page 1 of 9
a) __init__ b) in c) it d) on

6. What will be the output of the following code? [1]

a = (1,2,3,4)
del(a[2])
print(a)

a) (1,2,4) b) (1,3,4) c) (3, 4) d) Error

7. Which one of the following returns the floor division? [1]

a) / b) // c) % d) None of the above

8. Write SQL statement to round off value 15.193 to nearest ten’s. [1]

9. What is the output when following statements are executed? [1]

st = “Computer Science”
st.sialnum()

a) True b) False c) TypeError d) None of these

10. Which of the following is not a text function? [1]

a) TRIM() b) TRUNCATE() c) LEFT() d) MID()

11. What will be returned by the given query? [1]

SELECT MONTH(‘2020-05-11’);

a) 5 b) 11 c) May d) November

12. Which type of error will be returned by the following code? [1]

abc = [‘A’:’Apple’, ‘B’:’Boy’, ‘C’:’Cat’]


print(abc[2])

a) Not Found Error b) Key Not Found Error

c) Syntax Error d) Key Error

13. If the following code is executed, what will be the output? [1]

names = [‘ABCD’, ‘EFGH’, ‘HJKL’, ’MNOP’]


print(name[-1][-1])

a) P b) MONOP c) A d) ERROR

14. ___________ is the key that has not been selected to be the primary key from the candidate keys.
[1]
Page 2 of 9
15. A combination of bus and star topologies is called a __________ topology. [1]

a) Combination b) Hybrid c) Mesh d) Tree

16. In SQL, which command can be used to see structure of a tables SCHOOL? [1]

Question number 17 and 18 are ASSERTION AND REASONING based questions and carry 1
Marks each. 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) A is false but R is True

17. Assertion(A): The positional parameters receive the values irrespective of the corresponding order of
the arguments in the function header.

Reason(R): It means if three arguments are to be passed to the function, the first argument will be
assigned to the first parameter, second argument to the second parameter and the third argument to the
third parameter.

18. Assertion(A): The CSV file is a simple text file format that is used to store data in tabular form.

Reason(R): The binary file stores data in machine readable form. This file is more reliable and secure
when data transfer takes place from one device to other. This is the reason why most of the fields are
written in binary mode.

SECTION B

19. Evaluate the following expressions: [2]

a) 25 * 3 + 25 % 4 – 50 ** 2 // 2

b) True and True or False and not True or False

20. Differentiate between GPRS and GSM in context with mobile communications. [2]

Or

Differentiate between Internet Mail Access Protocol and Simple Mail Transfer Protocol. [2]

21. Rewrite the following code in Python after removing all syntax error(s). Underline each correction
done in the code. [2]
Page 3 of 9
M = [43,44,45)
X = 0
while X < M:
if X % 2 <> 0:
print(M*4)
elseif X % 5 = 0:
print(X**3)
print(X*10)
X + = 1
22. Write the output of the following SQL command. [2]

a) SELECT instr(‘Preoccupied’, ‘cup’);

b) SELECT left(‘Preoccupied’, 4);

23. Write two SQL statement for MID and SUBSTR using string “India is great”. [2]

24. Expand the following terms. [2]

a) Kbps b) Mbps c) Gbps d) Tbps

25. What do you mean by function in Python? Explain with its types in Python? [2]

Or

Differentiate between break and return statement in Python. Give an example of each. [2]

SECTION C

26. Consider a list of employees containing empNo, empName and empSalary. Write a function in
Python PUSH(Stack, List), to push only those records from a list whose salary is more than 50000/-.
At every insertion return the current location of TOP. [3]

27. Write a function Count() in Python, which should read text file “ALPHA.TXT” to count and return
the total number of consonants present in it. [3]

28. Assuming that NUM is a list of variables, write a function manipulate(NUM) in Python to divide all
the elements of list by 10 which are divisible by 5 and multiply the other list elements by 2. Elements
of the list can be changed to float as a result of division by 10. [3]

29. a) Write SQL command to view all the databased of MYSQL. [1]

b) Write the outputs of the SQL queries (i) to (ii) based on the relations Employees and Package given
below: [2]

Page 4 of 9
Table: Employees
Emp_No FirstName LastName Designation City
M001 Monika Verma Manager Delhi
D001 Ritu Singh Director Noida
C001 Neha Sharma Clerk Noida
C002 Shelly Sharma Clerk Faridabad
M002 Kavita Kapoor Manager Jaipur

Table: Package
Emp_No Basic HRA TA
D001 1200000 9500 8000
M001 1000000 9400 9000
M002 1050000 13450 9000

i) SELECT FIRSTNAME, DESIGNATION, BASIC FROM EMPLOYEES, PACKAGE


WHERE EMPLOYEES.EMP_NO = PACKAGE.EMP_NO;
ii) SELECT FIRSTNAME, CITY, (BASIC+HRA+TA) AS SALARY FROM
EMPLOYEES, PACKAGE WHERE EMPLOYEES.EMP_NO = PACKAGE.EMP_NO;
iii) SELECT DESIGNATION, COUNT(*) FROM EMPLOYEES GROUP BY
DESIGNATION;
iv) SELECT FIRSTNAME, LASTNAME FROM EMPLYEES WHEREN LASTNAME IN
(“VERMA”, “SHARMA”);

30. Write the outputs of the SQL queries (a) to (d) based on the relations Employees and Package given
below:

Table: OldStock
SNO Name Type Qty Price Discount
1 Little Ones Baby Cot 5 5000 10
2 Wooden Study Table 7 4000 10
3 Royal Sofa 4 20000 15
4 Wooden Chairs 4 12000 15
5 Royal Couch 2 22000 20

Table: FreshStock
SNo Name Type Price
1 Little Ones Chairs 30000
2 Blue Lotus Sofa 25000
3 Royal Couch 10000

a) What will be the output of the following statement? [1]

Page 5 of 9
SELECT OS.NAME, OS.TYPE, FS.NAME, FS.TYPE FROM OLDSTOCK OS,
FRESHSTOCK FS WHERE OS.SNO = FS.SNO;

b) Write the output of the queries (i) to (iv) based on the tables given above. [2]
i) SELECT NAME, TYPE FROM FRESHSTOCK ORDER BY TYPE;
ii) SELECT AVG(PRICE) FROM OLDSTOCK WHERE NAME = “WOODEN”;
iii) SELECT DISTINCT NAME FROM OLDSTOCK;
iv) SELECT MIN(QTY) FROM OLDSTOCK GROUP BY TYPE HAVING PRICE
> 4000;

SECTION D

31. What is the difference between text and CSV file? Write a program in python with following two
functions and make call of them within the program: [5]

i) ADD() – To accept grocery code, name, price and quantity and store the data permanently in the
“groceries.csv” file.

ii) DISPLAY() – To display the all the content of “groceries.csv” file.

32. a) Write the output of the following code. [2]

import random
def week_days():
days = [“Mon”, “Tue”, “Wed”, “Thu”, “Fri”]
v = random.randrange(len(days) – 1)
for I in range(v, 0, -1):
print(days[i], “-“, i+1)

week_days()

i) Thu – 4 ii) Wed – 3 iii) Wed – 3 iv) Fri – 5


Wed – 3 Tue – 2 Tue – 2 Thu – 4
Tue - 2

OR

def convert(x):
x = list(x)
n = len(x)
for i in range(0, n, 2):
w = x[i]
x[i] = x[i+1]
x[i+1] = w
Page 6 of 9
for i in range(1, n):
if x[i] ==’’:
x[i] = ‘-‘
elif x[i] > ‘a’ and x[i] < ‘z’:
x[i] = chr(ord(x[i]) – 32)
return x

x = ‘Board Exam’
print(convert(x))

b) Study the following code and answer the question given from i) to iii) [3]
import mysql.connector as sql

conn = sql.connect(host=’localhost’, user=’root’, passwd = ‘’,


database = ‘school’)
cursor = ____________ #Statement 1
records = ______________ #Statement 2
count = 0
for x in records:
count +=1
print(x)
print(“Total number of records are: “,count)
___________ #Statement 3

i) Write Python statement to create at cursor at the blank space marked as statement 1
ii) Write Python statement to read all the data from database to system memory at the blank
space marked as statement 2
iii) Write Python statement to close the database connection at the blank space marked as
statement 3

33. Hi Speed Technologies Ltd. Is a Delhi based organization which is expanding its office setup to
Chandigarh. At Chandigarh office campus, they are planning to have 3 different blocks for HR,
Accounts and Logistics related work. Each block has number of computers, which are required to
connected in a network for communication, data and resource sharing.

Chandigarh Office
Delhi
HR Block Account Block
Head Office
Logistics Block

Page 7 of 9
As a network consultant, you have to suggest the best network related solutions for them for
issues/problems raised in (i) to (v), keeping in mind the distances between various blocks/location and
other given parameters. [5]

Shortest distances between various blocks/locations:

HR Block to Accounts Blocks 400 meters


Account Block to Logistics Block 200 meters
Logistics Block to HR Block 150 meters
Delhi Head Office to Chandigarh Office 270 Km

Number of computers installed at various blocks are as follows

HR Block 70
Accounts Block 50
Logistics Block 40

a) Suggest the most appropriate block/location to house the server in the Chandigarh Office (out of
the 3 blocks) to get the best and effective connectivity. Justify your answer.

b) suggest the best wired medium and draw the cable layout (Block to Block) to effectively connect
various blocks with the Chandigarh office compound.

c) Suggest a device/software and its placement that would provide data security for the entire network
of Chandigarh office.

d) Which of the following kind of network, would it be?


PAN, WAN, MAN, LAN
e) Company is planning to get its website designed which will allow students to see their results after
registering themselves on its server. Out of the static or dynamic, which type of website will you
suggest?

SECTION E

34. Reema wants write a program in Python to copy the contents of list1 to list2 based on certain
condition. Help her to complete the code as instructed in question (i) to (iii)

import pickle
list1, list2 = [2, 3, 4, 5, 6, 7, 8, 9, 10], []
for i in list1:

Page 8 of 9
if
(i%2==0 and i%4==0):
list2.__________ #Statement 1
f = open("bin.dat","wb")
____________________ #Statement 2
f.close()
f = open("bin.dat", "rb")
data = ______________ #Statement 3
f.close()
for i in data:
print(i)

a) She wants to add I into the list2. Write the complete statement 1 to perform the task. [1]
b) She wants to write the content of the list2 into the disk file. Compete statement 2 for that.
[1]
c) Complete statement 3 so that she can perform rest of the task as written in code. [2]

35. Based on given table “PRODUCT” answer following questions.

PID PName Price Category Manufacturer


1 Nirma 40 Detergent Powder Nirma Group
2 Surf 80 Detergent Powder HL
3 Vim Bar 20 Disc washing Bar HL
4 Neem Face Wash 50 Face Wash Himalaya

a) Write SQL statement to display details of all the products not manufactured by HL. [1]
b) Write SQL statement to display name of the detergent powder manufactured by HL. [1]
c) Write SQL statement to display the name of the Product whose price is more than 0.5 hundred.
[2]
OR

c) Write SQL statement to display name of all such Product which start with letter ‘N’ [2]

----------------------------------------------------------*****-------------------------------------------------------

Page 9 of 9

You might also like