0% found this document useful (0 votes)
32 views9 pages

SET-1 QP

The document is a pre-board examination paper for Class XII Computer Science under Kendriya Vidyalaya Sangathan, Bhubaneswar Region for the academic year 2023-24. It consists of 35 questions divided into five sections, covering various topics in computer science and programming, specifically using Python. The paper includes multiple-choice questions, programming tasks, and SQL queries, with a total maximum mark of 70.
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)
32 views9 pages

SET-1 QP

The document is a pre-board examination paper for Class XII Computer Science under Kendriya Vidyalaya Sangathan, Bhubaneswar Region for the academic year 2023-24. It consists of 35 questions divided into five sections, covering various topics in computer science and programming, specifically using Python. The paper includes multiple-choice questions, programming tasks, and SQL queries, with a total maximum mark of 70.
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/ 9

KENDRIYA VIDYALAYA SANGATHAN : BHUBANESWAR REGION

CLASS XII, PRE-BOARD EXAMINATION 2023-24


COMPUTER SCIENCES (083)
TIME: 3 HOURS SET-3 M.M.70
General Instructions:
1. Please check this question paper contains 35 questions.
2. The paper is divided into 4 Sections- A, B, C, D and E.
3. Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark.
4. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
8. All programming questions are to be answered using Python Language only.

Q. No. SECTION A Marks


1. State True or False: 1
“None is a special data type with a single value. It is used to signify the absence of value in a
situation. None supports no special operations, and it is neither same as False nor 0 (zero).”

2. In a table in MYSQL database, an attribute ABC of datatype int with constraint NOT NULL and 1
another attribute XYZ of datatype varchar(10) with constrain UNIQUE. Which attribute will
allow duplicate data values during insertion of records?
a. ABC b. XYZ c. both ABC and XYZ d. None of these
3. What will be the output of the following statement: 1
print(pow(2,3)//8*(1+2)+3**2**2)
a. 0 b. 84.0 c. 84 d. 0.0

4. Select the correct output of the code: 1


str1=" PM SHRI "
str2=" KV is My ViDyalaya"
str3=str1.strip()+str2.replace("D", "d").lstrip()
print(str3.partition("My"))
a. ['PM SHRIKV is ', 'My', ' ViDyalaya'] b. ('PM SHRIKV is ', 'My', ' Vidyalaya')
c. ['PM SHRIKV is ', 'My', ' Vidyalaya'] d. ('PM SHRIKV is ', 'My', ' ViDyalaya')
5. In MYSQL database, if a table, STUDENT with attributes (admno, name, address, phone, 1
scode) and another table, REGS with attributes (scode, sub1, sub2, sub3, sub4, sub5, sub6,
sub7, regfee). Which of the following attribute can be used for join operation through
NATURAL JOIN clause?
a. name b. admno c. regfee d. scode
6. Purushottam is having an internet connection between his office and server room through an 1
Ethernet cable (i.e. twisted pair). But the network speed is very poor and need to amplify/boost
the signal. Which of the following device is required as a booster to amplify the signal?
a. Gateway b. router c. modem d. repeater
7. Which of the following python statement will delete all the items in the dictionary named 1
INDEX and make it empty?
a. INDEX.popitem() b. INDEX.pop() c. INDEX.clear() d. del INDEX

Page 1 of 9
8. Consider the statements given below and then choose the correct output from the given 1
options:
x = 'PM Shri KV'
str1=x[::-1]
for y in str1:
print(y,end='')
x.lower()

a.KV PM Shri b. PM Shri KV c. vk irhs mp d.VK irhS MP

9. Which of the following statement(s) would give an error during execution of the following code? 1
tuple1 = (10,20,30,40,50,60)
list1 =list(tuple1) # Statement -1
new_list = [] # Statement -2
for i in list1:
if i%3==0:
new_list.append(i) # Statement -3
new_list.append(tuple1)
print(new_list[3]) # Statement -4

a. Statement-1 b. Statement -2 c. Statement- 3 d. Statement-4

10. What possible outputs(s) will be obtained when the following code is executed? 1
import random
List = ['CTC', 'BBSR', 'KDML', 'PURI']
for y in range (4):
x = random.randint (1,3)
print (List[x], end = '#')

Options are:
a) KDML#PURI#BBSR#PURI# b) KDML#KDML#PURI#PURI#

c) BBSR#KDML#BBSR#KDML# d) All of these 3 options are possible

11. A Router is a network device that forwards data packets along networks. A _______________ 1
is networking device that connects computers in a network by using packet switching to
receive, and forward data to the destination.
a. Hub b. Switch c. Repeater d. Modem

12. Consider the statements given below and then choose the correct output from the given options: 1
def fun2():
global x
print(x, end=":")
x=500
print(x, end=":")
x=x+1

x=5 # global var


print(x, end=":")
fun2()
print(x,end=":") # 501

a. 5:5:500:501: b. 501:500:5:5: c. 5:5:501:500: d. 500:501:5:5:

Page 2 of 9
13. try: 1
n=int(eval(input("Enter any value: ")))
if n<=0:
raise Exception("Zero/Negative ")
else:
print(" Positive Number")
_______________
print("Zero Entered/ Negative Number")
finally:
print("End of try ..... except with finally clause ")

a. catch b. else: c. exception: d. except:

14. Which of the following statements is TRUE about keys in a relational database? 1
a. The number of tuples/rows in a relation is called the Degree of the relation.
b. The number of attribute/columns in a relation is called the Cardinality of the relation.
c. Primary key allows Unique and Null values only.
d. Domain is a set of values from which an attribute can take a value in each row. Usually, a
data type is used to specify domain for an attribute.

15. ____________ is a set of rules that need to be followed by the communicating parties in 1
order to have successful and reliable data communication.

16. Which of the following File Open modes opens the file in append and read mode. If the file 1
doesn’t exist, then it will create a new file.
a. “a+” b. “r+” c. “a+r” d. “r+a”

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

17. Assertion (A):- A Python sequence is an ordered collection of items, where each item is 1
indexed by an integer.
Reasoning (R):- The Strings, Lists and Tuples are not sequence data types available in Python.

18. Assertion (A):- A function may or may not return a value when called. The return statement 1
returns the values from the function.
Reasoning (R):- The return statement does the following: • returns the control to the calling
function. • return value(s) or None.

SECTION B

19. (i) Expand the following terms: SMTP , PPP 1+1=


(ii) Give one difference between Web browser and Web Server. 2
OR
(i) Define network device Gateway with respect to computer networks.
(ii) How is ARPANET different from NSFNET?

20. The given Python code to print all Prime numbers in an interval (range) inclusively. The given 2
code accepts 02 number (low & high) as arguments for the function Prime_Series() and
return the list of prime numbers between those two numbers inclusively. Observe the following
code carefully and rewrite it after removing all syntax and logical errors. Underline all the
corrections made.

Page 3 of 9
def Prime_Series(low, high)
primes = []
for i in range(low, high + 1):
flag = 0
if i < 2:
continue
if i = 2:
primes.append(2)
continue
for x in range(2, i):
if i % x == 0:
flag = 1
break
if flag == 0:
primes.append(x)
return primes
low=int(input("Lower range value: "))
high=int(input("High range value: ")
print(Prime_Series(low, high))

21. Write a function seq_to_dict(ls, tp) in Python that takes one list and one tuple as two 2
arguments. The function will return a dictionary with an update of key-value pairs with keys
from a list and values from a tuple.
For example, Consider the following:
List ls=[1,2,3,4] Tuple tp=("Pranay", "Shuvam", "Snehant","Swasat"))
The returned dictionary will be: {1: 'Pranay', 2: 'Shuvam', 3: 'Snehant', 4: 'Swasat'}
OR
Write a function dict_seq(dict) in Python that takes a dictionary (keys as numbers and values
as strings) as an argument and returns a list and a tuple. The list will have keys from the
dictionary, and the tuple will have values from the dictionary, but the values from the
dictionary should be converted to upper case if those are in lower case and uppercase if
those are in lowercase.

For example, if dict= {1: 'PRANAY', 2: 'shuvam', 3: 'snehant', 4: 'SWASAT'}


The returned List will be: [1,2,3,4] and Tuple: ("pranay", "SHUVAM", "SNEHANT",
"swasat")

22. Find the output of the following python code: 2


def even_odd(tup):
res = [ ]
for k in range(len(tup)):
if tup[k] % 2 == 0:
res.append(tup[0-k-1])
if k % 2 == 0:
res.append(tup[0- k-1])
print(res)
return None

even_odd ((9,10,11,13,13,14))

Page 4 of 9
23. Write the Python statement for each of the following tasks using BUILT-IN functions/methods 1+1=
only: 2
(i) To counts and return how many times a value 98 is occurred in a tuple TP.
(ii)To replace all the occurrences of the old string “THE” with the new string “the” in the string
named LINE.
OR
An arithmetic expression is required to calculate the area of the circle as (Area=πr2) with r as
the radius of 8cm. Write the Python command to import the required module and use the built-
in function or object to find the area of the circle.
24. Mr. Pranaya has just created a table named “DEPARTMENT” containing columns Deptno, 2
Dname, Location, and Phone. After creating the table, he realized that he needed to remove
the Phone column from the table. Help him to write a SQL command to remove the column
Phone from “DEPARTMENT” table. Thereafter, write the command to modify the location of
Deptno-101 as “ Odisha” in the table:
OR
Mr. Swasat is working as a database administrator in Micron Semiconductor MNC. He wants
to create a database named “MICROINDIA”. After creating the database, he will create a table
named MICRONSW with the following descriptions:
Field Name Type with (size) Constraints
ENO INTEGER ( 4) PRIMARY KEY
ENAME VARCHAR (15) NOT NULL
JOB CHARACTER (10) UNIQUE
SALARY FLOAT(10,2) DEFAULT VALUE 5000
25. Predict the output of the Python code Given below: 2

def Sum(N1,N2):
if N1>N2:
return N1-N2
else:
return N2-N1

lst= [20,25,24,34,35]
for C in range (3,0,-1):
A=lst[C]
B=lst[C-1]
print(Sum(A,B),end='#')
else:
print("\nend of the program".title())

SECTION C
26. Predict the output of the Python code Given below: 3
def fun_para(x=5,y=10,z=1005):
z=x/2
res=y//x+z
return res
a,b,c=20,10,1509
print(fun_para(),fun_para(b),sep='#')
res=fun_para(10,20,6015)
print(res, "@")
print(fun_para(z=999,y=b,x=5), end="#@")

Page 5 of 9
27. Consider the table GAMES given below and write the output of the SQL queries that follow. 1*3=
TABLE: GAMES 3
GCODE GNAME STADIUM P_NO P_MONEY DATE
1001 Relay Star Annex 16 10000 2001-01-23
1002 High Jump Super Power 12 12000 2003-02-14
1003 Shot Put Star Annex 11 8000 2002-07-07
1008 Discuss Throw Star Annex 12 9000 2003-03-19
1005 Long Jump Super Power 10 11000 2002-12-20
(i) SELECT MAX(P_MONEY), MIN(P_MONEY) FROM GAMES;
(ii) SELECT GCODE, GNAME FROM GAMES
WHERE PNO IN (16,12,11) AND DOJ>’2001-01-23’;
(iii) SELECT DISTINCT STADIUM FROM GAMES WHERE GNAME NOT LIKE “H%d”;
28. Write a function, WordCount() in Python to read a text file, “story.txt”, and display those words 3
in it that begin with consonants and end with vowels. Also, the function will count those words
and return how many such numbers are in the same text file.
OR
Write a function, LineCount(), in Python to count and return the number of lines in “letter.txt”
that have a numeric value. Also, the function will display those lines in the same text file.

29. Consider the table FURNITURE given below:. 1*3=


FID NAME TYPE COST DISCOUNT 3

F001 DOUBLE BED WOODEN 45000 10


F002 DINING TABLE WOODEN 51000 5
F003 SINGLE BED WOODEN 22000 NULL
F004 CHAIR WOODEN 12000 3
F005 TABLE WOODEN 15000 12
F006 DOUBLE BED IRON 18000 5
F007 SINGLE BED IRON 10000 NULL
F008 DINING TABLE IRON 26000 10
Based on the given table, write SQL queries for the following:
(i) Modify the record with the furniture name ‘CHAIR’ to ‘ARAM CHAIR’ and its price to 10%
more.
(ii) Display TYPE and the number of items of each type with a price greater than 10000 and
DISCOUNT is not NULL.
(iii) Delete all the records with NAME that begin with the character ‘S’ and end with ‘D’ and
Type is ‘IRON’;

30. A dictionary, StudRec, contains the records of students in the following pattern: 3
{admno: [m1, m2, m3, m4, m5]}, i.e., Admission No. (admno) as the key and 5 subject
marks in the list as the value.
Each of these records is nested together to form a nested dictionary. Write the following user-
defined functions in the Python code to perform the specified operations on the stack named
BRIGHT.
(i) Push_Bright(StudRec): it takes the nested dictionary as an argument and pushes a list of
dictionary objects or elements containing data as {admno: total (sum of 5 subject marks)}
into the stack named BRIGHT of those students with a total mark >350.
(ii) Pop_Bright(): It pops the dictionary objects from the stack and displays them. Also, the
function should display “Stack is Empty” when there are no elements in the stack.

Page 6 of 9
For Example: if the nested dictionary StudRec contains the following data:
StudRec={101:[80,90,80,70,90], 102:[50,60,45,50,40], 103:[90,90,99,98,90]}
Thes Stack BRIGHT Should contain: [{101: 410}, {103: 467}]
The Output Should be: {103: 467}
{101: 410}
If the stack BRIGHT is empty then display: Stack is Empty

SECTION D
31. Table Name: TRADERS 4
TCODE TNAME CITY
T01 RELIANCE DIGITAL MUMBAI
T02 TATA DIGITAL BHUBANESWAR
T03 BIRLA DIGITAL NEW DELHI

Table name: STOCK


SCODE SNAME QTY PRICE BRAND TCODE
1001 COMPUTER 90 45000 DELL T01
1006 LCD PROJECTOR 40 42000 NEC T02
1004 IPAD 100 55000 APPLE T01
1003 DIGITAL CAMERA 160 15000 SAMSUNG T02
1005 LAPTOP 600 35000 HP T03

Write SQL queries for the following:

(i) Display the SNAME, QTY, PRICE, TCODE, and TNAME of all the stocks in the STOCK
and TRADERS tables.

(ii) Display the details of all the stocks with a price >= 35000 and <=50000 (inclusive).

(iii) Display the SCODE, SNAME, QTY*PRICE as the “TOTAL PRICE” of BRAND “NEC” or
“HP” in ascending order of QTY*PRICE.
(iv) Display TCODE, TNAME, CITY and total QTY in STOCK and TRADERS in each TCODE.

32. Mr. Snehant is a software engineer working at TCS. He has been assigned to develop code 4
for stock management; he has to create a CSV file named stock.csv to store the stock details
of different products.

The structure of stock.csv is : [stockno, sname, price, qty], where stockno is the stock serial
number (int), sname is the stock name (string), price is stock price (float) and qty is quantity
of stock(int).

Mr. Snehant wants to maintain the stock data properly, for which he wants to write the following
user-defined functions:

AcceptStock() – to accept a record from the user and append it to the file stock.csv. The
column headings should also be added on top of the csv file. The number of records to be
entered until the user chooses ‘Y’ / ‘Yes’.

StockReport() – to read and display the stockno, stock name, price, qty and value of each
stock as price*qty. As a Python expert, help him complete the task.

Page 7 of 9
SECTION E
33. The USA-based company, Micron, has selected Tata Projects to build the semiconductor 1*5=
assembly and test facility in Sanand Town, near Ahmedabad in Gujurat. It is planning to set 5
up its different units or campuses in Sanand Town and its head office campus in New Delhi.
Shortest distance between various locations of Sanand Town blocks and Head Office
at New Delhi:
Training Campus Research Campus 3 KM
Business Campus warehousing 4.5 KM
Manufacturing Research Campus 1.5 KM
Campus
Warehousing Training Campus 9.5 KM
Research Campus Business Campus 3.5 KM
Warehousing Campus Research Campus 2.6 KM
Research Campus New Delhi Head Office Campus 962KM
Number of computers installed at various locations are as follows:
Warehousing Campus 20 computers
Research Campus 200 computers
Business Campus 10 computers
Training Campus 25 computers
Manufacturing Campus 15 Computers
Ahmedabad Admin Campus 15 Computers
As a network consultant, you have to suggest the best network related solution for their
issues/problems raised :
(i) Suggest the most appropriate location of the SERVER to get the best and effective
connectivity. Justify your answer.
(ii) Suggest the best wired medium and draw the cable layout (location to location) to
efficiently connect various locations
(iii) Which hardware device will you suggest to connect all the computers within each
location?
(iv) Suggest a system (hardware/software) to prevent unauthorized access to or from the
network.
(v) Which type of network out of the following is formed by connecting the computers of New
Delhi Head Office and Sanand Town Units? a) LAN b) MAN c) WAN d) PAN

34. (i) What are the similarities and difference between a+ and w file modes in Python. 2+3=
5
(ii) (ii) A binary file “product.dat” has structure [PNO, PNAME, BRAND_NAME, PRICE] to
maintain and manipulate Product details.

*Write a user defined function CreateFile() to input data for a record and add to “product.dat”
file. The number of records to be entered until the user chooses ‘Y’ / ‘Yes’.
*Write a function CountData(BRAND_NAME) in Python which accepts the brand name as
parameter and count and return number of products by the given brand are stored in the binary
file “product.dat”.
OR
(i) What is the difference between seek() and tell()?

Page 8 of 9
(ii) A binary file “STUD.DAT” has structure (admission_number, Name, total_mark) with
student details.
 Write a user defined function WriteFile() to create a file input data for a record and write
to “stud.dat” file. The number of records to be entered until the user chooses ‘Y’ / ‘Yes’.

 Write a function ReadFile() in Python that would read the contents of the file
“STUD.DAT” and display the details of those students whose total mark is less than or
equal to 250 under the printed heading "REMEDIAL STUDENT LIST “. Also display
and the number of students scoring above 250 marks as Bright Student.

35. (i) What is the difference between degree and cardinality with respect to RDBMS. Give one 1+4=
example to support your answer. 5

(ii) Mr. Shuvam wants to write a program in Python to Display the following record in the table
named EMP in MYSQL database EMPLOYEE with attributes:
EMPNO (Employee Number ) - integer  ENAME (Employee Name) - string size(30)
 SAL (Salary) - float (10,2)  DEPTNO(Department Number) - integer

Note: The following to establish connectivity between Python and MySQL:


 Username - root  Password – admin  Host – localhost
The values of fields rno, name, DOB and fee has to be accepted from the user. Help Shuvam
to write the program in Python.

OR

(i) What is the difference between Primary and Foreign key?

(ii) Mr. Pranay wants to write a program in Python to update the particular record by accepting
its Department Number value in the table named DEPT in MYSQL database EMPLOYEE with
attributes:

DEPTNO (Department Number) – integer  DNAME (Department Name) – string size(15)


LOC(Location of the Department) – string size(15)

Note: The following to establish connectivity between Python and MySQL:


 Username - root  Password – admin  Host – localhost
The values of fields rno, name, DOB and fee has to be accepted from the user. Help Kabir
to write the program in Python.

-end-

Page 9 of 9

You might also like