0% found this document useful (0 votes)
75 views10 pages

CS QP 4

Question Paper

Uploaded by

kvfwteachers
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)
75 views10 pages

CS QP 4

Question Paper

Uploaded by

kvfwteachers
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/ 10

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

Kendriya Vidyalaya Sangathan, Kolkata Region


वितीय प्री - बोडड परीक्षा / 2nd Pre-Board Examination 2024-25
कक्षा/ Class - XII अविकतम अंक/ Maximum Mark - 70
विषय/ Subject - संगणक विज्ञान/ Computer Science समय / Time - 03 घंटे/ 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 the case of MCQ, the text of the correct answer should also be written.

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

1. State which of the following is a valid identifier:


(1)
true and _123

2. Identify the output of the following code snippet:


text = "PYTHONPROGRAM"
print(type(text.partition('Y')))
(A) tuple (1)
(B) list
(C) No Output
(D) Syntax Error
3. Which of the following expressions always evaluates to True for a Boolean data a?
(A) a and a’
(B) a or a’ (1)
(C) a and a
(D) a or a
4. What is the output of the expression?
country="School art competition"
print(country.split("o"))
(1)
(A) ['Sch', ' ', 'l art c', 'mpetiti', 'n']
(B) ['Sch', 'l art c', 'mpetiti', 'n']
(C) (‘Sch’,’o’,’ol art competition’)
(D) Error

Page 1 of 10
5. What will be the output of the following code snippet?
message= "World Health Organization" (1)

print (message [-2::2])

6. Which of the following lines will give error and why? Write None if there is no
error
t1=1,2 #line1
t2=t1 #Line2
t1 += 4 #line3 (1)

7. Shubham, a student of class 11 is running the below code and is encountering an


error. Identify the cause?

my_dict = {['apple']: 10, 'banana': 20, 'banana': 30}


(1)
(A) Dictionary can’t be declared with same keys
(B) The type of keys must be same for all element
(C) List cannot be kept as key
(D) String cannot be kept as key

8. What does the sorted(list) do in Python?


(A) Sorts the element in ascending order by default.
(B) Sorts the element in descending order by default. (1)
(C) Returns another list in ascending order by default.
(D) Returns another list in descending order by default.
9. In SQL, the FOREIGN KEY of one table is the PRIMARY KEY of another tabl e.
(A) True
(B) False
(1)
10. Ankita when executes the below code observes there is anomaly in the below
code. Choose the correct anomaly.
file = open("example.txt","r+")
data = file.write(“KV”) (1)
file.close()

(A) There is syntax error


(B) First 2 characters replaced by KV.
(C) KV is added at last.
(D) KV is not at all added.
11. State whether the following statement is True or False:
The except block in Python is executed only if an exception occurs in the try
(1)
block.

Page 2 of 10
12. What will be the output of the following code?
c = 10
def add():
c = 90
c=c+2
print(c,end='#')
add() (1)
print(c,end='%')
(A) 12%10#
(B) 12#12%
(C) 92#10%
(D) Syntax Error
13. Kangkana wants to ensure that a column must not contain duplicate values. (1)
However, the column may contain blank values. Which constraint should she
enable?

14. How many rows will the below query generate if the product has 4 rows and
orders has 3 rows?
SELECT * FROM products, orders;
(A) 12 (1)
(B) 7
(C) 4
(D) Error as there is no join condition
15. Which of the following commands is used to delete columns from a table?
(A) Delete <colname> from <tab name>
(B) Alter table <tabname> drop <colname>
(1)
(C) Drop <colname> from <tabname>
(D) Update <tabname> drop <colname>
16. Which of the following commands can change the cardinality of a table?
(A) Insert command
(B) Delete command (1)
(C) Update command
(D) Both A and B
17. ______________ provides access to virtual terminals of remote systems on local
area networks or the Internet.

(A) TELNET
(B) FTP (1)
(C) HTTP
(D) HTTPS
18. Which network device is used for broadcasting?
(A) Router
(B) Hub
(1)
(C) Switch
Page 3 of 10
(D) Repeater

19. Arindam wants to set up a cable connection within his own city. Which of the
following types of network (LAN/MAN/PAN/WAN) should he use? (1)

Q20 and Q21 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): If a function has a local variable with the same name as global
variable then global variable is accessed.
Reasoning (R): Local variables are the variables whose access is limited within (1)
the function body.
Assertion (A): The sequence of operations starting with select, where, group by,
21.
having and order by must be followed while writing a SQL query.
(1)
Reasoning (R): A Single Query may have where, group by, having, order by all at
the same time.
Q No Section-B (7 x 2=14 Marks) Marks

22. Given a list L= [12, 34, 22, 11, (9,98,34)].


(2)
Which of the following statements will run? Justify.

a) L [-1] =L [-1] +(90,98)

b) L [-1] [0] = 890

23. Given a list L=[12,78,91,43,12,11,91]. Write the build in user defined function to
(2)
a) Count the occurrence of 12 in the list.
b) Print the position of first occurrence of 91

24. Write a function lenWords(STRING), that takes a string as an argument and


returns a tuple containing length of each word of a string. For example, if the string
is "Come let us have some fun", the tuple will have (4, 3, 2, 4, 4, 3)
(2)
OR

Write a function to remove the duplicate elements from the main list and print
the list with unique elements.

Page 4 of 10
25. Write at least 2 possible output(s) for the following code.

import random

a= {0:” Orange”,1:” Apple”,2:” Grapes”,3:” Guava”4:” Pineapple”}


b= random.randint(1,4)
(2)
for i in range(0,b,2):

print(a[i],end='#')

26. Rao has written a code to input a number and check whether it is prime or not.
His code is having errors. Rewrite the correct code and underline the
corrections made.

def prime ():

n=int (input ("Enter number to check: ")


(2)
for i in range (2, n//2):

if n%i=0:

print ("Number is not prime \n")

break

else:

print ("Number is prime \n’)

27. A. Differentiate between count () and count (*) functions in SQL with
appropriate examples.
OR
B. Survi mistakenly added ‘name’ as the primary key instead of ‘id’. Write the
code on behalf of Survi to add the ‘id’ as primary key for the table
employee. (2)
28. A. In this topology all devices are connected to a central hub or switch. Which
topology is being referred to here? Write one advantage and one
disadvantage for the same topology. (2)

OR

B. Mahananda wants to send an email to Keerti. Which protocol is used at


senders end and receivers end? Write a brief note on how the protocols work.
Q No. Section-C (3 x 3 = 9 Marks) Marks

29. A. Write a method COUNTLINES () in Python to read lines from text file
‘TESTFILE.TXT’ and count the lines which are not starting with any vowel.
Example: (3)
If the file content is as follows:
An apple a day keeps the doctor away.

Page 5 of 10
We all pray for everyone’s safety.
A marked difference will come in our country.

The COUNTLINES () function should display the output as:


The number of lines not starting with any vowel - 1
OR
B. Write a Python function that displays all the words having a vowel from a text
file "Words.txt".

30. A. Priyanka has created a dictionary 'employee_data' containing EmpCode and


Salary as key value pairs for 5 Employees of Cyber Intratech. Write a user
defined function, as mentioned below, to perform the following operations:
a. push_emp(employee_data): Push all those EmpCode, where the
Salary is less than 25000, from the dictionary into a stack 'stk_emp'
b. pop_emp(): Remove all the elements from the stack, one at a time, in
a Last-In-First-Out(LIFO) manner and display them. It also displays
'Stack is empty' once all the elements have been removed.
For Example:
If the sample content of the dictionary is as follows: (3)
{'E001':15000,'E002':27000,'E003':30000,'E004':15000,'E005':19000}, then
the stack 'stk_emp' will contain EmpCode E001, E004, E005 after
push_emp().
pop_emp() will pop and display employee records in LIFO fashion and display
'Stack is empty' at last.

OR
B. A school stores records of Class XII students using a list that contains
multiple lists as its elements. The structure of each such element is
[Student_Name, Marks, MainSubject]. Create user-defined functions to
perform the operations as mentioned below:
a. Push_student(): To push the Student_Name and Marks of all those
students, who have Science as MainSubject, into a Stack StudentInfo.
b. Pop_student(): To delete all items (one at a time) from the stack
StudentInfo in LIFO order and display them. Also display "Empty
Stack" when there are no items remaining in the stack.
For Example:
If the stored information is:
[['Akansha',98,"Mathematics"],["Priti",96,"Science"],["Garima",99,"Science"],
["Ayushi",78,"English"]]
The stack should contain:
["Garima",99]
["Priti",96]
Page 6 of 10
The output should be:
["Garima",99]
["Priti",96]
Empty Stack

31. A. Predict the output of the following code:


s="India Growing"
n = len(s)
m=""
for i in range (0, n):
if(s[i] >= 'a' and s[i] <= 'm'):
m=m+s[i].upper()
elif(s[i] >= '0' and s[i] <= 'z')
m=m+s[i-1]
elif (s[i].isupper()): (3)
m=m+s[i].lower()
else:
m=m+'@'
print (m)
OR

B. Predict the output of the following code:


p=5
def sum(q,r=2):
global p
p=r+q**2
print(p, end= '#')
a=10
b=5
sum(a,b)
sum(r=5,q=1)
Q No. Section-D (4 x 4 = 16 Marks) Marks

32. A. Write the desired SQL Query to extract the below information.

ID Name Dept Sex Experience


101 Amit ENT Male 12
104 Nitin Medicine Male 8
107 Rakshit Cardiology Male 14
109 Rashmi ENT Female 11
(4)
105 Sulekha Medicine Female 10

ID Basic Allowance Consultation


101 12000 1000 300
104 32000 700 400
107 42000 1700 800
109 21700 500 450
Page 7 of 10
105 55000 750 500

a) Display NAME of all doctors who are in the MEDICINE department


having more than 10 years’ experience from the table DOCTOR.
b) Display the minimum ALLOWANCE of female doctors.
c) Display the min and maximum salary gender wise, salary is calculated as
basic +Allowance +Consultation.
d) Increase the basic of doctors by 10% where ID is 114 and 130.

OR

B. Write the output for the below queries


a) Select Dept, sum(Basic) as Main_Sal from Doctor, Salary where
Doctor.Id=Salary.Id group by Dept;
b) Select * from Doctors where Name like '%i%';
c) Select Name, Basic from Doctor, Salary where Doctor.Id=Salary.Id order
by Basic;
d) Select max(Basic + Allowance + Consultation) as maxSal from Salary;

Radha Shah is a programmer, who has recently been given a task to write a python
33.
code to perform the following CSV file operations with the help of two user defined
functions/modules:

A. CSVOpen() : to open a CSV file called BOOKS.CSV in append mode


containing information of books –
● Title,
● Author
● Price. (4)
Add only one record to it.

B. CSVRead (): to display the records from the CSV file called BOOKS.CSV
where the field title starts with 'Ra’.
34. Tejasvi Sethi, a car dealer, has stored the details of all cars in her showroom in a
table called CARMARKET. The table CARMARKET has attributes CARCODE which is a
primary key, CARNAME, COMPANY, COLOR, COST (in lakh rupees) of the car and
DOM which is the Date of Manufacture of the car.

CAR CARNAME COMPANY COLOR COST DOM


CODE
C01 BALENO SUZUKI BLUE 5.9 2019-11-07 (4)
C02 INDIGO TATA SILVER 12.90 2020-10-15
C03 GLC MERCEDES WHITE 62.38 2020-01-20
C04 A6 AUDI RED 58.55 2018-12-29
C05 WAGON-R TOYOTA BLACK 32.82 2017-11-10
C06 WAGON-R SUZUKI WHITE 12.11 2016-11-11
C07 BREZZA SUZUKI GOLDEN 9.80 2016-10-03

Page 8 of 10
Write the SQL Query to display:
a) Car name that begins with I and ends with A
b) Total numbers of cars for each company
c) The latest DOM (Most recent) company wise
d) Display the average cost of each company where the average is less than 30
Lakhs.
OR(Alternative between d and e)

e) If we delete C04 and C02 and add C09 what is the revised Cardinality and
degree for the table.
35. Write the MYSQL connector python code to display details of those mobiles
whose price is greater than 8000 for the following table.
Table Name: Mobile
Database: Product
Host: localhost
Username: Root
Password: P123
(4)

M_ID M_Company M_Name M_price M_Mf_Date


MB001 Samsung Galaxy 4500 2014-02-12
MB002 Nokia N1100 2250 2011-04-15
MB003 Sony Experia 9500 2017-11-20
MB004 Oppo SelfieEx 8500 2010-08-21

Q No. SECTION E (2 X 5 = 10 Marks) Marks

36. Mouparna is a teacher working in a School. She needs to manage the record of
various students. For this, she wants the following information of each Student to
be stored:
- Roll – integer
- Name – string
- Class – integer
- Percentage – float (5)

You, as a programmer, have been assigned to do this job for Mouparna.


a) Write a function to input the data of a Student and append it in a binary
file.
b) Write a function that requires roll number and percentage to be fetched
from the user and Updates Percentage.
c) Write a function to read the data from the binary file and display the data
of all those Students who scored more than 90.

Page 9 of 10
MakeInIndia Corporation, an Uttarakhand based IT training company, is planning to
37.
set up training centers in various cities in the next 2 years. Their first campus is
coming up in Kashipur district. At Kashipur campus, they are planning to have 3
different blocks for App development, Web designing and Movie editing. Each
block has some number of computers, which are required to be connected in a
Network for communication, data and resource sharing. As a network consultant of
this company, you have to suggest the best network related solutions for them for
issues/problems raised in question nos. (A) To (F), keeping in mind the distances
between various Blocks/locations and other given parameters.

(5)

A. Suggest the most appropriate block/location to house the SERVER in the


Kashipur campus (out of the 3 blocks) to get the best and effective
connectivity. Justify your answer.
B. Suggest a device/software to be installed in the Kashipur Campus to take
care of data security.
C. Suggest the best wired medium and draw the cable layout (Block to Block)
to economically connect various blocks within the Kashipur Campus.
D. Suggest the placement of the following devices with appropriate reasons:
i) Switch / Hub
ii) Repeater
E. Suggest a protocol that shall be needed to provide Video Conferencing
solutions between Kashipur Campus and Mussoorie Campus.
OR
F. What type of network (PAN, LAN, MAN, or WAN) will be set up among
the computers connected in Kashipur Campus

*****

Page 10 of 10

You might also like