CS-QP-3

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

केन्द्रीय विद्यालय संगठन, कोलकाता संभाग

KENDRIYA VIDYALAYA SANGATHAN, KOLKATA REGION


अभ्यास सेट-II / PRACTICE SET-II : 2024-25
कक्षा / CLASS : XII अविकतम अंक / MAX. MARKS : 70
विषय / SUB : COMPUTER SCIENCE (083) समय / TIME : 03 घंटे / Hours

General Instructions:
 This question paper contains 37 questions.
 All questions are compulsory. However, internal choices have been provided in some questions.
Attempt only one of the choices in such questions
 The paper is divided into 5 Sections- A, B, C, D and E.
 Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
 Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
 Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
 Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
 Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
 All programming questions are to be answered using Python Language only.
 In case of MCQ, text of the correct answer should also be written.

Section A

1· State True or False: An exception is caught in the try block and handles in except block. 1

2· Identify the output of the following code snippet: 1


WORDS = "DYD YYDYD DYD"
WORDS = WORDS.replace('YD', 'DY')
print(WORDS)
(a) DYD YYDYD DYD (b) DDY YYDYD DYD
(C) DDY YYDYD DDY (d) DDY YDYDY DDY

3· Which of the following expressions evaluates to True? 1


(a) not(True) and not(True or False) (b) not(not False or not(True and False))
(c) not(not True and not(False or True)) (d) not(not True or not(False and True))

4· What is the output of the expression? 1


MyTarget = 'Computer Science is 100%'
print(MyTarget.partition("e"))
(a) ('Comput', 'e', 'r Science is 100%') (b) ('Comput', 'r Sci', 'nc', ' is 100%')
(c) ['Comput', 'e', 'r Science is 100%'] (d) ['Comput', 'r Sci', 'nc', ' is 100%']

5· What will be the output of the following code snippet? 1


SUB = "Computer Science"
print(SUB[-2::-4])

Page 1 of 8
6· What will be the output of the following code? 1
LIST = [11, 22, 33]
TUPLE = (11, 22, 33)
VALUE = tuple(LIST)
print(VALUE is TUPLE)
(a) True (b) False (c) (11, 22, 33) (d) ERROR

7· If My_Sub is a dictionary as defined below, then which of the following statements will raise an
exception? 1
My_Sub = {'083': 'CS', '041': 'MATHS', '322': 'SANSKRIT CORE'}
(a) My_Sub.pop('041') (b) My_Sub.popitem('041')
(c) My_Sub.get('041') (d) My_Sub.items()

8· What does the STRING.find(str, start, end) method do in Python? 1


(a) Returns the first occurrence of index of substring str occurring in the given string and if the
substring is not present in the given string, then the function returns -1.
(b) Returns number of times substring str occurs in the given string.
(c) Returns the first occurrence of index of substring str occurring in the given string but
raises an exception if the substring is not present in the given string.
(d) Returns all the occurrence of index of substring str occurring in the given string.

9· If a table which has one Candidate key and one Primary Key. How many Alternate keys will this
table have? 1
(a) 0 (b) 1 (c) 2 (d) 3
10· Write the missing statement to complete the following code to get the desired output: 1
Consider the notepad : BOOK.txt and the Output:
Computer Science Science
Physics
Chemistry
Code: file = open("BOOK.txt", "r")
data = file.readline()
________________ # Move the file pointer to the desired position of the file
print(file.read(7))
file.close()
11· State whether the following statement is True or False: 1
Raising an exception involves interrupting the normal flow of the program execution and
jumping to the exception handler.
12· What will be the output of the following code? 1
G = 10
L = 20
def NOTES():
global G
G=G+L
print(G, end = '&')
L=L+G
NOTES()
print(L, end = '=')
(a) 40&30= (b) 30&30= (c) 30&50= (d) ERROR
Page 2 of 8
13· Which SQL command can change the cardinality of an existing relation? 1
14· What will be the output of the query? 1
SELECT * FROM TABLEA, TABLEB;
(a) Cartesian Product on two tables – TABLEA and TABLEB
(b) Equi-join of two tables – TABLEA and TABLEB
(c) Natural join of two tables – TABLEA and TABLEB
(d) ERROR
15· Which two constraints when applied together will produce a Primary Key constraint? 1
16· Consider the Table SCHOOL_FEES:
+--------------+ What will be the output of the following query: 1
| FEE_PAID | SELECT AVG(FEE_PAID) FROM SCHOOL_FEES;
+--------------+
| 2800 ---| (a) 2175
| 3600 ---| (b) 2900
| NULL ---| (c) 3200
| 2300 ---| (d) 2300
+-------------+
17· Which protocol is used for establishing secure web communication? 1
(a) HTTP (b) FTP (c) PPP (d) HTTPS
18· Which network device is used for conversion between analog signals and digital bits? 1
(a) Repeater (b) Switch (c) Gateway (d) Modem
19· Which switching technique the following statements refers to? 1
Before a communication starts, a dedicated path is identified between the sender and the
receiver. This path is a connected sequence of links between network nodes. All packets follow
the same path established during the connection.

Q.20 and Q.21 are Assertion(A) and Reason(R) 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) A is False but R is True

20· Assertion(A) : Python sets are mutable data type 1


Reason(R) : The first character has the index 0 and the last character has the index n-1
where n is the length of the set.

21· Assertion(A) : ALTER TABLE statement in SQL can change the degree of an existing relation.
Reason(R) : ALTER TABLE statement is used to make changes in the structure of a table like
adding, removing or changing data type of column(s).

Section B

22· How is == (relational operator) different from is (identity operator) in Python? 1


Identify the valid identifiers from the following: 1
(a) _TRUE (b) 1True (c) True% (d) True

Page 3 of 8
23· Write name of the modules that are to be import in Python to execute following functions: 2
(a) floor() (b) writer() (c) mode() (d) load()

24· The following code is typed in Interactive Mode of Python. Complete the missing outputs: 2
>>> L1 = ["CS", "PHY", "CHEM"]
>>> L2 = [len(L1[2]), len(L1[1]), len(L1[0])]
>>> L3 = L1.extend(L2)
>>> print(L3) # (a)
__________________________________
>>> print(L1) # (b)
__________________________________
>>> print(sorted(L2)) # (c)
__________________________________
>>> print(2 * L2) # (d)
__________________________________

Or,

24· If L1 = ["CS", "PHY", "CHEM"] and L2 = [4, 3, 2], then 2


(a) Write a Python statement to get the following output:
['CHEM', 'PHY', 'CS']
(b) Write a Python statement to get the following output:
[4, 3, 2, 'CS', 'PHY', 'CHEM']

25· Identify the correct output(s) of the following code. Also write the minimum and the maximum
possible values of the variable planets. 2
import random
ecliptic = "Zodiac"
planets = random.randint(1,6)
for luck in range(0, planets, 2):
print(ecliptic[luck], end = '100%')
(a) Z100% (b) Z100%i100% (c) Z100%d100%a100% (d) Z100%a100%

26· The code provided below is intended to find the factorial of an integer. However, there are
syntax and logical errors in the code. Rewrite it after removing all errors. Underline all the
corrections made. 2
def factorial_function(n):
if n < 0
return "Factorial is not defined for negative numbers."
result = 1
for i in range(2, n + 1):
result =* i
return result
number = int(input("Enter a number: ")
print("Factorial of", number "is:", factorial_function(number))

Page 4 of 8
27· (i) (a) Write SQL command to display the maximum value in the SALARY column (attribute)
of the MANAGEMENT table. 1
Or,
(b) Write an SQL command to remove the Primary Key constraint from a table, named
MANAGEMENT. EMP_ID is the primary key of the table. 1

(ii) (a) Write SQL command to determine the count of rows in the MANAGEMENT table. 1
Or,
(b) Write an SQL command to make the column EMP_ID the Primary Key of an already
existing table, named MANAGEMENT. 1

28· (a) Illustrate with an example to show the difference between Star and Bus topologies. 2
Or,
28· (b) What is the use of VoIP ? Give any one example VoIP applications. 2

Section C

29· (a) Write a Python function RECORD_C( ) that displays all the words with exactly 5 characters
and starts with C or, c from a text file "COLLECTION.txt". 3
Or,
29· (b) Write a Python function RECORD_E() that finds and displays all the words longer than 4
characters and ends with ‘e’ or, ‘E’ from a text file "Words.txt".

30· (a) (i) Write the definition of a user-defined function PUSH_CCA(PARTICIPANTS) which 3
accepts a list of students with details of each as [NAME, HOUSE, RANK] in a
parameter PARTICIPANTS and pushes all those students details whose RANK = 1
from the list PARTICIPANTS into a Stack named PRIZE.
(ii) Write function POP_ CCA() to pop the topmost student details from the stack and
returns it. If the stack is empty, the function should display "Empty".
(iii) Write function DISPLAY_CCA() to display all element of the stack without deleting
them. If the stack is empty, the function should display 'None'.
For example:
If PARTICIPANTS = [['ARYAN','RED',2],['SWATI','BLUE',1],['ADRIJA','GREEN',3],
['DAVIDA','RED',1],['SHAURYA','YELLOW',1]]
Then the stack PRIZE should store:
['SWATI', 'BLUE', 1]
['DAVIDA', 'RED', 1]
['SHAURYA', 'YELLOW', 1]
If the top element pop out is ['SHAURYA', 'YELLOW', 1]
Then the stack will display as:
['DAVIDA', 'RED', 1]
['SWATI', 'BLUE', 1]

Or,

(b) You have a stack named ELIGIBLE that contains records of students. Each student record is
represented as a list containing STUDENT_NAME, MOBILE_NUM, and
ATTENDANCE_PERCENT. Write the following user-defined functions in Python to perform
the specified operations on the stack ELIGIBLE: 3

Page 5 of 8
(i) PUSH_EXAM(): This function asks for the student data one by one till records exist
and if the ATTEDANCE_PERCENT > 75 then the student record pushes to the stack
ELIGIBLE.
(ii) POP_EXAM(): This function pops the topmost student record from the stack. If the
stack is empty, the function should display "Underflow".
(iii) TOP_EXAM(): This function displays the topmost element of the stack without
deleting it. If the stack is empty, the function should display 'None'.

31· Predict the output of the following code: 3


mS = ('CS','PHYSICS','CHEM','ENG','MATHS')
VALUE = (len(mS), len(mS[-4]), len(mS[0]))
for OPTION in VALUE:
for NEXT in range(1, OPTION%len(VALUE)):
print(NEXT, end = '#')
print(OPTION)

Or,
31· Predict the output of the following code:
MOBILE = {"Samsung":"Galaxy S24 Ultra","Apple":"iPhone 16 Pro"}
BRAND = str()
for DATA in MOBILE:
BRAND = BRAND + MOBILE[DATA]
SHOW = BRAND[::-1]
print(SHOW)
print(len(BRAND))

Section D

32· Consider the table FINANCE as given below

(a) Write the following queries: 4


(i) To display the total FEE for each STREAM, excluding STREAM where total FEE is less
than 3000.
(ii) To display the FINANCE table sorted by FEE in descending order.
(iii) To display the distinct student names from the FINANCE table.
(iv) Display the sum of FEE of all the STUDENTS for which the NUM_OF_MONTHS is null.

Or,

(b) Write the output: 4


(i) SELECT S_NAME, SUM(FEE) AS TOTAL_FEE FROM FINANCE GROUP BY S_NAME;
(ii) SELECT * FROM FINANCE WHERE S_NAME LIKE “%N%E%” ;
(iii) SELECT S_UID, S_NAME, STREAM, FEE FROM FINANCE WHERE FEE BETWEEN 3000
AND 4000;
(iv) SELECT AVG(FEE) FROM FINANCE;
Page 6 of 8
33· A csv file "ACHIEVERS.csv" contains the Students data. Each record of the file contains the
following data:
● Name of the Student
● Class
● Admission Number
● Result in percentage
For example, a sample record of the file may be:
[‘Aseema Sahu’, 12, 4865, 98]
Write the following Python functions to perform the specified operations on this file: 4
(i) DISPLAY() - Read all the data from the file in the form of a list and display all those records
for which the result percentage is more than 90.
(ii) COUNT_RECORDS() - Count the number of records in the file.

34· (a) Write an SQL statement to create a table named STUDENTS, with the following
specifications: 2

(b) Write SQL Query to insert the following data in the Students Table:
1, Supriya, Singh, 2010-08-18, 75.5 1

(c) Write an SQL Command to delete the table STUDENTS. 1

35· A table, named TC_DETAILS, in SCHOOL database, has the following structure:
Field Type
Adm_Num Integer(5)
Student_Name Varchar(25)
FEE_PAID Float
TC_NUM Integer(5)
Write the following Python function to perform the specified operation: 4
NEWTC() : To input details of a student taking TC and store it in the table TC_DETAILS. The
function should then retrieve and display all records from the TC_DETAILS table where the
TC_NUM is greater than 10000.
Assume the following for Python-Database connectivity:
Host: localhost, User: root, Password: Tc2000

Section E

36· AAM Enterprise has been established as a premier autonomous testing organisation to conduct online/
offline examination in different schools. The organisation needs to manage the records of various
candidates. For this, the organisation wants the following information of each candidate to be stored:
 Student_ID – integer (Admission Number)
 Student_Name – string
 Exam_Opt – string (Online/ Offline)
 Class – integer (12, 11, 10, 9 and so on) 5
Page 7 of 8
You, as a programmer of the organisation, have been assigned to do this job. Write the following
functions to execute the program:
(i) EXAM_INPUT() - A function to input the data of the students those are interested to appear for the
exam and append it in a binary file – “STUDENT_EXAM.dat”. Exam_Opt will be Offline for all.
(ii) EXAM_UPDATE() - A function to update the data of students (“STUDENT_EXAM.dat”) who are in
Class 12 and change their Exam_Opt to "Online".
(iii) EXAM_SHOW() - A function to read the data from the binary file and display the data of all those
candidates who are in Class 11 and 12.

37· Ayansh Pvt. Ltd., a multinational technology company, is looking to establish its Indian Head
Office in Bengaluru, and a regional office branch in Lucknow. The Bengaluru head office will be
organized into four departments: HR, FINANCE, TECHNICAL, and SUPPORT.
As a network engineer, you have to propose solutions for various queries listed from (a) to (e). 5

The shortest distances between the departments/offices are as follows:

The number of computers in each department/office is as follows:

(a) Suggest the most suitable department in the Bengaluru Office Setup, to install the server.
Also, give a reason to justify your suggested location.
(b) Draw a suitable cable layout of wired network connectivity between the departments in
the Bengaluru Office.
(c) Which networking device would you suggest the company to purchase to interconnect all
the computers within a department in Bengaluru Office?
(d) The company is considering establishing a network connection between its Bengaluru Head
Office and Lucknow regional office. Which type of network—LAN, MAN, or WAN—will be
created? Justify your answer.
(e) Is there a requirement of a repeater in the given cable layout? Why/ Why not?

Page 8 of 8

You might also like