[go: up one dir, main page]

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

XII Computer Science SET I QP

This document is a question paper for the First Pre-Board examination in Computer Science for Class XII under Kendriya Vidyalaya Sangathan, Mumbai Region. It consists of 37 questions divided into five sections, covering various topics in Python programming, SQL, and data structures, with a total of 70 marks. The paper includes multiple-choice questions, programming tasks, and theoretical questions, all requiring answers in Python.

Uploaded by

sasi
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)
267 views9 pages

XII Computer Science SET I QP

This document is a question paper for the First Pre-Board examination in Computer Science for Class XII under Kendriya Vidyalaya Sangathan, Mumbai Region. It consists of 37 questions divided into five sections, covering various topics in Python programming, SQL, and data structures, with a total of 70 marks. The paper includes multiple-choice questions, programming tasks, and theoretical questions, all requiring answers in Python.

Uploaded by

sasi
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

Subject Code 0 8 3 Roll No.

KENDRIYA VIDYALAYA SANGATHAN, MUMBAI REGION


FIRST PRE-BOARD (SESSION 2024-25)
(SET-I)
Subject: Computer Science (Theory) Class: XII
Time Allowed: 3:00 Hours Max. Marks - 70

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.

Q. No. SECTION-A (21 x 1 = 21 Marks) Marks


1. State True or False: 1
“The is operator checks the identity of two variables, not the equality of
their values.”
2. Identify the output of the following code snippet: 1
thought="work is worship"
p=thought.partition("or")
print(p)
A. [‘work’, ‘is’, ‘worship’]
B. ('w', 'or', 'k is worship')
C. [‘w’, ‘or’, ‘k is worship’]
D. (‘work’, ‘is’, ‘worship’)
3. Which of the following expressions evaluates to True? 1
A. False or not True==1
B. not 3>4 and 5 and False
C. 4**3 and 0 or False
D. 12!=5 or not True
4. What is the output of the given expression? 1
pride="Assembly Elections@2024"
L=pride.split('s')
print(L[::-2])

A. ['@2024', ''] B. [‘@2024’, ‘A’]


C. [‘embly Election’] D. ‘40@nicl lmsA’

Page 1 of 9
5. What will be correct output for the following: 1
R = (4.5, 5), (5,4), (8.2,7), (8,7,3)
print(max(R))

A. Error B. (8.2, 7)
C. (8, 7, 3) D. (4.5, 5, 8.2, 8)
6. Select the correct output of the following code: 1
S = "Motivational thought"
print(S.find("hou", 4, 13))

A. True B. 4
C. 14 D. -1
7. Which of the following statement(s) would give an error after executing the 1
following code ?

Stud= { "Kiran": 70, "Jaya": 95} # Statement 1


print (Stud[95]) # Statement 2
Stud ["Arvind"]=60 # Statement 3
print(Stud.pop()) # Statement 4
print(Stud) # Statement 5

A. Statement-2 B. Statement-3
C. Statement-4 D. Statement-2 and 4
8. What does the list.append(x) method do in Python? 1
A. Inserts the element x at the beginning of the list
B. Inserts the element x at the end of the list
C. Inserts the element x in between two elements in the list
D. It merges the two lists and creates another list
9. If a table which has one Primary key and two alternate keys. How many 1
Candidate keys will this table have?
A. 1 B. 2 C. 3 D. 4
10. Write the missing statement to complete the following code: 1
f = open("Essay.txt", "r")
data = f.read(80)
cur_pos = ______ # Get the current position of the file pointer
print(“Current position is: ”, cur_pos)
f.close()
11. State True or False: 1
The try block in Python can contain multiple except blocks to handle
different types of exceptions.
12. What will be the output of the following code? 1
p=6
def Demo():
global p
p**=2
print(p, end='+')
Demo()
print(p, end='@')

Page 2 of 9
A. 6+36@
B. 72@
C. 36+36@
D. 36+6@
13. Fill in the blanks: 1
The SELECT statement when combined with __________ clause, returns
records without repetition.
14. Which function in SQL is used to count the total number of records 1
regardless of NULL from table in a database?
A. sum(*) B. total(*)
C. count(*) D. count( )
15. The degree and cardinality of a table named SONG are 2 and 4, respectively. 1
The degree and cardinality of another table named SINGER are 3 and 5,
respectively. There is one common field in both tables. After performing the
Cartesian product of both tables, what will be the new degree and
cardinality of the resultant table?
A. 4 and 20 B. 5 and 20
C. 5 and 9 D. 4 and 9
16. A result set is extracted from the database using a cursor object by giving 1
the following statement:
records=mycursor.fetchall( )
What will be the data type of records,after the execution of above
statement?
A. tuple B. string
C. dictionary D. list
17. Which of the following protocols is used for remote login: 1
A. VoIP B. HTTP
C. IMAP D. TELNET
18. _________ is used for point-to-point communication or unicast 1
communication such as radar and satellite.
A. Infrared B. Bluetooth
C. Microwaves D. Radio waves
19. Which network device converts digital data from a computer into analog 1
signals for transmission over phone lines?
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): The return statement in a Python function is optional. 1
Reason (R): If no return statement is used, the function returns None by
default.
21. Assertion (A): In SQL, the GROUP BY clause is used to arrange identical 1
data into groups.
Reason (R): The GROUP BY clause is mandatory when using aggregate
functions like SUM() or AVG().

Page 3 of 9
SECTION-B ( 7 x 2=14 Marks)
22. Define dynamic data typing in python. Write an example to illustrate 2
your answer.
23. i. Define Operator Associativity. 2
ii. Write the following operators in descending order (Higher precedence
to lower precedence in order of operation) of their operator
precedence:
or, **, and, +, *, ==
24. If M1=[60,25,30,……] and M2=[3,6,9,12, …….], then 2
Write the Python statements for each of the following tasks using Built-in
functions/methods only:
i.
A. To delete an element 25 from the list M1.
OR
B. Write a statement to add an element 85 in the list M2 between the
elements 9 and 12.

ii.
A. Write a statement to sort the elements of list M1 in descending
order.
OR
B. Write the statement to delete the last element of list M2.
25. Look at the following python code and find the possible output(s) from the 2
options (i) to (iv) following it. Also, write the highest and lowest values that
can be pointed by label VALUE.

import random
for y in range(4):
VALUE = random.randrange(4,11) + y
print(VALUE, "#", end=" ")
i. 6 # 7 # 12 # 13 # ii. 5 # 11 # 8 # 11 #
iii. 4 # 7 # 12 # 14 # iv. 9 # 15 # 8 # 6 #
26. The code provided below is intended to search an element from a list. 2
However, there are syntax and logical errors in the code. Rewrite the
code in python after removing all error(s). Underline each correction done
in the code.

def Linear_Search(L)
item=int(input("Enter the value that you want to search: ")
for i in range(len(L)):
if L[i]==item:
print("Element found at index: " i)
break
else:
print("Element not found")
Linear_Search([25,78,45,36,21,10])
27. i. 2
A. What constraint should be applied on a table column so that NULL is
not allowed in that column, but duplicate values are allowed.
OR
B. Categorize the following commands as DDL and DML:
INSERT, UPDATE, ALTER, DROP

Page 4 of 9
ii.

A. Write an SQL command to change a column name from


Date_of_Birth to DOB of date data type in Employee table.
OR
B. Write an SQL command to change a table name from Employee to
Emp.
28. Write two points of difference between XML and HTML. 2
OR
Write two points of difference between Circuit Switching and Packet
switching.
Section-C ( 3 x 3 = 9 Marks)
29. Write a function Show_Words( ) in python to read the content of a text file 3
“NOTES.TXT” and display those words in capital letters which start with any
vowel.
Example, if the file contains:
“Comparing apples to oranges”
Then the function should display the output as:
APPLES
ORANGES
OR
Write a function count_my( ) in python to read the text file “DATA.TXT” and
count the number of times the word “my” (Including uppercase and
lowercase) occurs in the file.
For example, if the file “DATA.TXT” contains:
“This is MY website. I have displayed my preferences in the CHOICE
section”
The count_my( ) function should display the output as :
The word my occurs :2 times
30. You have a stack named MovieStack that contains records of movies. Each 3
movie record is represented as a list containing movie_title,
director_name, and release_year.
Write the following user-defined functions in Python to perform the specified
operations on the stack MovieStack:
i. add_movie(MovieStack, new_movie): This function takes the stack
MovieStack and a new movie record new_movie as arguments and
pushes the new movie record onto the stack and display the stack.
ii. remove_movie(MovieStack): This function removes the topmost
movie record from the stack and returns it. If the stack is already
empty, the function should display "Underflow".
iii. view_top(MovieStack): This function displays the topmost element of
the stack without deleting it. If the stack is empty, the function should
display 'None'.
OR
Stationery_Item is a dictionary containing the details of stationary items.
Write a user defined function PUSH_DATA(Stationery_Item), to push the
name of those items into the stack named as PriceStack which have price
more than 75 and display stack. Also display the number of elements
pushed into the stack.
For example: If the dictionary contains the following data:
Stationery_Item={"Pen":106,"Pencil":59,"Notebook":80,"Eraser":25}
The stack should contain
Page 5 of 9
['Pen', 'Notebook']
The output should be:
Number of elements in stack: 2
31. Predict the output of the following code 3
s="science"
L=[1,3,4,8,7,18]
d={}
for i in range(len(L)//2):
if i%2==0:
d[L.pop()]=s[i]
else:
d[L.pop()]=i*2
for k,v in d.items():
print(k,v,sep="-")

OR
Write the output of the code given below:
def FindOutput(p, q=2, r=40):
x=p**2*4
y=x+r
print(x, "@", y)
return y
c=FindOutput(q=5, r=7,p=4)
a,b=4,3
c=FindOutput(b,a,c)
print(a,"@",b,"@",c)
Section-D ( 4 x 4 = 16 Marks)
32. Consider a table TRAIN as given below: 4
TNo TName Train_Type Source Destination Fare
12001 Rajdhani Express Superfast Delhi Mumbai 3000
12625 Shatabdi Express Superfast Delhi NULL 1200
12501 North East Express Express Guwahati Delhi 1500
16159 Kanyakumari Exp Express Kanyakumari Delhi 2500
20814 Jodhpur-Puri Exp Express Jodhpur Puri 2800
19412 Sabarmati Express Express Sabarmati NULL 1100

A) Write the following queries:


i. Display type of train and total fare of each type of train.
ii. Display Train Number, Train Name and Fare of those trains whose
name starts with the alphabet letter ‘S’.
iii. Display train number, train name and source of those trains whose
destination is NULL.
iv. Count the number of trains which have train type as superfast and
source is ‘Delhi’.
OR
B) Write the output:
i. Select TNAME, Fare from TRAIN Where Fare<2000 order by TName;
ii. Select avg(fare) from TRAIN group by Train_Type;
iii. Select TName, Destination, Fare from TRAIN where fare <>2500
and destination IS NULL;
iv. Select min(fare) from TRAIN where Train_Type= “Express”;
Page 6 of 9
33. Mr. Ankit is a python programmer working in a software company. He has 4
to develop a simple inventory management system of all employees
working in an educational institute. He has created a csv file named
record.csv, to store the details of employees. The structure of record.csv
is:
[employee_id, emp_name, salary]
Mr. Ankit wants to write a Program in Python that defines and calls the
following user defined functions:
i. ADD() – To accept and add data of 6 employees to a CSV file
‘record.csv’.
ii. COUNTR() – To count the number of records present in the CSV file
named ‘record.csv’.
34. Ms. Nishi has been entrusted with the bank Database. She needs to access 4
some information from LOAN and BORROWER tables for a survey analysis. Help
her to extract the following information by writing the desired SQL queries
as mentioned below.
Table: LOAN
loan_number branch_name Amount
L123 Nagpur 45000
L456 Pune 60000
L347 Delhi 80000
L987 Delhi 25000
L901 Pune 45000

Table : BORROWER
customer_name loan_number
Ajit Das L456
Rohan Yadav L901
Suman Verma L123
Ayesha Tiwari L987
Saurav L347

i. To display customer name and branch name of those customers who


have taken loan from Delhi branch.
ii. To display loan number, customer name and amount of those
customers who have taken loan more than 40000.
iii. To display branch name and average amount of that branch which
has given average loan amount more than 50000.
iv.
A. To display customer name and amount in descending order of
amount.
OR
B. What will be degree of resultant table after performing natural
join of these two tables.

Page 7 of 9
35. Alok wants to create a table named BOOK in the LIBRARY database, which 4
should have the following structure:

Field Type Remarks


Book_ID int Primary Key
BName varchar(25) NOT NULL
Quantity int
Price float(6,2)
Author Varchar (20)
Write the following Python function to perform the specified operation:
• Create_and_ADD() : To create a table BOOK as per details given above
and after creating table, insert the following record in the table BOOK.
Book_ID:12, BName:“Godaan”,
Quantity:15,Price:210,Author:“Premchand”
Assume the following for Python-Database connectivity:
host: localhost, user: root, password: program
SECTION E (2 X 5 = 10 Marks)
36. Mr. Mohit is working on a school project to manage student records using 5
Python. The student data is stored in a binary file named STUDENT.DAT. The
binary file STUDENT.DAT contains each record in given format:
{“Admn_No”:admn, “SName”:name, “Marks”:marks}
Where
● Admn_No: Admission Number (integer)
● SName: Student Name (string)
● Marks: Marks (integer)

You as a programmer, help him to write following python functions:


i. ADD_Data() : To write 7 records in binary file STUDENT.DAT by taking
the values for each record from user.
ii. Display_Data() : Read all records from binary file and display them.
iii. Modify_Marks() : that updates the marks of a student in the file
STUDENT.DAT based on the admission number provided by the user. If
the admission number does not exist in the file, display an appropriate
message.
37. “MyTech Services” is planning to set up its India campus at Jaipur with its 5
Head Office at Mumbai. The Jaipur campus has 3-main blocks-HR,
Technical and Marketing. You as a network expert have to suggest the
best network related solutions for their problems raised in (i) to (v).

Jaipur Campus

HR Tech
nical

Head Office
Mark
eting
Mumbai

Page 8 of 9
Distance between various building blocks:
HR BLOCK to TECHNICAL BLOCK 45 m
HR BLOCK to MARKETING BLOCK 98 m
TECHNICAL BLOCK to MARKETING BLOCK 107 m
Head Office to JAIPUR Campus 1275 KM

Number of computers in each Block:


HR BLOCK 10
TECHNICAL BLOCK 105
MARKETING BLOCK 45

i. Suggest the most appropriate location of the server inside the JAIPUR
campus (out of the 3 blocks), to get the best connectivity for
maximum number of computers. Justify your answer.

ii. Which among the following devices will you suggest to be procured
by the company for connecting all the computers within each of their
offices?
● Switch/Hub
● Modem
● Bridge

iii. Suggest network type (out of LAN, MAN, WAN) for connecting each
of the following set of their offices:
a. HR and Marketing Block
b. Head Office and Jaipur office

iv. Which of the following communication medium, you will suggest to


be procured by the company for connecting their local offices in
Jaipur for very effective and fast communication?
● Telephone cable
● Optical fiber
● Ethernet cable

v.
A. In JAIPUR Campus, in between which offices repeater should be
installed? Justify the answer.
OR
B. Suggest and draw the cable layout to efficiently connect various
blocks within the JAIPUR campus for connecting the computers.

Page 9 of 9

You might also like