12 CS Preboard Set-I QP 2023-24

You might also like

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

SET-I

DELHI PUBLIC SCHOOL RUBY PARK, KOLKATA


PREBOARD (2023-24)
CLASS XII
Time allowed: 3 hours Subject: Computer Science (083) Maximum Marks: 70

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

SECTION-A

1. State True or False: [1]


“Tuple is data type in Python which contain data in key-value pair.”

2. In a table in MYSQL database, an attribute A of data type varchar(20) has the value “Rahul”. The [1]
attribute B of data type char(30) has value “Akash”. How many characters are occupied by attribute A and
attribute B?
(a) 20,5 (b) 5,30 (c)5,5 (d)20,30

3. What will the output for the following expression be evaluated in Python? [1]
print ( round (100.0 / 4 + (3 + 2.55) , 1 ) )
(a) 30.0 (b) 30.55 (c) 30.6 (d) 31

4. Select the correct output of the given code: [1]


s='mail2me@medestiny.me.in'
s=s.split('me')
op = s[0] + "@me" + s[2]
print(op)
(a) mail2@medestiny (b) mail2@destiny. (c) mail2@medestiny. (d) mail2medestiny.

5. Which function is used to display the total number of records from a table in a database? [1]
(a) total() (b) total(*) (c) return(*) (d) count(*)

CL-XII/PREBOARD /2023-24/Computer Science/Set-I/Page 1 of 8


6. Fill in the blank: [1]
_________________ is a communication methodology designed to deliver both voice and multimedia
communications over Internet protocol.
(a) SMTP (b) VoIP (c) PPP (d) HTTP

7. Which of the following statement(s) would give an error after executing the following code? [1]
D={'rno':32,'name':'Ms Archana','subject':['hindi','english','cs'],'marks':(85,75,89)} #S1
print(D) #S2
D['subject'][2]='IP' #S3
D['marks'][2]=80 #S4
print(D) #S5
(a) S1 (b) S3 (c) S4 (d) S3 and S4

8. What will be the output of the following string operation? [1]


str="PYTHON@LANGUAGE"
print(str[2:12:2])
(a)YHNLNU (b)TO@AG (c)TO@AGA (d)None of these

9. Which of the following will be correct output if the given expression is evaluated? [1]
not ((True and False) or True)
(a) True (b) False (c) NONE (d) NULL

10. Which switching technique follows the store and forward mechanism? [1]
(a)Circuit switching (b) Message switching (c) Packet switching (d) All of these

11. State whether the following statement is True or False? [1]


An exception may be raised even if the program is syntactically correct.

12. Fill in the blank: [1]


The SELECT statement when combined with ________ clause, returns records without repetition.
(a) DISTINCT (b) DESCRIBE (c) UNIQUE (d) NULL

13. The correct syntax of seek() function is: [1]


(a) seek(offset [, reference_point]) (b) seek(offset, file_object)
(c) seek.file_object(offset) (d) file_object.seek(offset [, reference_point])

14. In order to open a connection with MySQL database from within Python using mysql.connector [1]
package, __________ function is used.
(a) open() (b) connect() (c) database() (d) connectdb()

15. Fill in the blank: [1]


____________ is a non-key attribute, whose values are derived from the primary key of some other table.
(a) Primary Key (b) Candidate Key (c) Foreign Key (d) Alternate Key

CL-XII/PREBOARD /2023-24/Computer Science/Set-I/Page 2 of 8


16. What possible outputs(s) are expected to be displayed on screen at the time of execution of the program from
the following code? [1]
from random import randint
L=[5,10,15,20,25,30,35,40,45,50,60,70]
a = randint(3,8)
b = randint(4,9)
print(L[a],"#", L[b],"#")
(a) 20#70# (b) 30#40# (c) 15#60# (d) 35#70#

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
(c) A is True but R is False
(d) A is false but R is True

17. str1= “Class” + “Work” [1]


Assertion(A): Value of str1 will be “ClassWork”.
Reasoning(R): Operator ‘+’ adds the operands, if both are numbers & concatenates the string if
both operands are strings.

18. Assertion(A): Python Standard Library consists of various modules. [1]


Reasoning(R): A function in a module is used to simplify the code and avoids repetition.

SECTION-B

19.(i)Expand the following term. [1]


(a) POP (b)VoIP
(ii) Write two points of difference between Bus topology and star topology. [1]

20. Vivek has written a code to input a number and check whether it is even or odd number. His code is having
errors. Rewrite the correct code after removing the logical and syntactical errors and underline the correction
made. [2]
Def checkNumber(N):
status = N%2
return
num=int(input(“Enter a number to check :))
k=checkNumber(num)
if k = 0:
print(“This is EVEN number”)
else:
print(“This is ODD number”)

21. Write a function lenFOURword(L), where L is the list of elements (list of words) passed as argument to the
function. The function returns another list named ‘indexList’ that stores the indices of all four lettered word of L.
For example:
If L contains [“DINESH”, “RAMESH”, “AMAN”, “SURESH”, “KARN”] [2]
The indexList will have [2, 4]

CL-XII/PREBOARD /2023-24/Computer Science/Set-I/Page 3 of 8


22. Predict the output of the Python code given below: [2]
L=[1,2,3,4,5]
Lst=[]
for i in range(len(L)):
if i%2==1:
t=(L[i],L[i]**2)
Lst.append(t)
print(Lst)

23. A list named “studentAge” stores age of students of a class. Write the Python command to import the required
module and (using built-in function) to display the most common age value from the given list. [2]

24. Zack is working in a database named SPORT, in which he has created a table named “Sports” containing
columns SportId, SportName, no_of_players, and category. [2]
After creating the table, he realized that the attribute, category has to be deleted from the table and a new attribute
TypeSport of data type string has to be added. This attribute TypeSport cannot be left blank. Help Zack write the
commands to complete both the tasks.

25. Find output for the following snippets: [2]


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

SECTION-C

26. Predict the output of the code given below: [3]


def expression(p,q=5):
p=q*50
q=p//q
print(p,"*",q)
return(p)
m=10
n=5
m=expression(m,n)
print(m)
print(m,"$",n)

CL-XII/PREBOARD /2023-24/Computer Science/Set-I/Page 4 of 8


27. Write the output of the queries (i) to (vi) based on the table given below: [3]
TABLE: CHIPS
BRAND_NAME FLAVOUR PRICE QUNATITY
LAYS ONION 10 5
LAYS TOMATO 20 12
UNCLE CHIPS SPICY 12 10
UNCLE CHIPS PUDINA 10 12
HALDIRAM SALTY 10 20
HALDIRAM TOMATO 25 30

(i) Select BRAND_NAME, FLAVOUR from CHIPS where PRICE <> 10;
(ii) Select * from CHIPS where FLAVOUR=”TOMATO” and PRICE > 20;
(iii) Select BRAND_NAME from CHIPS where PRICE> 15 and QUANTITY < 15;
(iv) Select count( distinct (BRAND_NAME)) from CHIPS;
(v) Select PRICE , PRICE *1.5 from CHIPS where FLAVOUR = “PUDINA”;
(vi) Select distinct (BRAND_NAME) from CHIPS order by BRAND_NAME desc;

28. Write a function countINDIA() which read a text file ‘myfile.txt’ and print the frequency of the words ‘India’
in it (ignoring case of the word). [3]
Example: If the file content is as follows:
INDIA is my country. I live in India. India has many states.
The countIndia() function should display the output as:
Frequency of India is 3

29(a).Consider the table ‘PERSONS’ is given below. Write commands in SQL for (i) to(iv). [2]
Pid SurName FirstName Gender City PinCode BasicSalary
1 Sharma Geeta F Udhamwara 182141 50000
2 Singh Surinder M Kupwara Nagar 193222 75000
3 Jacob Peter M Bhawani 185155 45000
4 Alvis Thomas M Ahmed Nagar 380025 50000
5 Mohan Garima M Nagar Coolangatta 390026 33000
6 Azmi Simi F New Delhi 110021 40000
7 Kaur Manpreet F Udhamwara 182141 42000

(i) Display the Sur Names, First Names and Cities of people residing in Udhamwara city.
(ii) Display the Person Ids (PID), cities and Pin codes of persons in descending order of Pincodes.
(iii) Display the First Names and cities of all the females getting Basic Salaries above 40000.
(iv) Display First Names and Basic Salaries of all the persons whose First Names starts with “G”.

(b)Write the command to view all tables in a database. [1]

CL-XII/PREBOARD /2023-24/Computer Science/Set-I/Page 5 of 8


30. A list contains following record of a student: [StudentName, MobileNumber ,Class, Section] [3]

Write the following user defined functions to perform given operations on the stack named ‘Stud’:
(i) pushElement() - To Push an object containing name and mobile number of students who belong to class XII
and section ‘A’ to the stack.
(ii) popElement() - To Pop the objects from the stack and display them. Also, display “Stack Empty” when there
are no elements in the stack.

For example:
If the lists of students details are:
[“Rajveer”, “99999999999”,”XI”, “B”]
[“Swatantra”, “8888888888”,”XII”, “A”]
[“Sajal”,”77777777777”,”VIII”,”A”]
[“Yash”, “1010101010”,”XII”,”A”]

The stack “Stud” should contain


[“Swatantra”, “8888888888”]
[“Yash”, “1010101010”]

The output should be:


[“Yash”, “1010101010”]
[“Swatantra”, “8888888888”]
Stack Empty

SECTION-D

31. Consider the following tables BOOKS and ISSUED in a database named “LIBRARY”. Write SQL commands
for the statements (i) to (iv). [4]
Table: BOOKS
BID BNAME AUNAME PRICE TYPE QTY
COMP 11 LET US C YASHWANT 350 COMPUTER 15
GEOG33 INDIA MAP RANJEET P 150 GEOGRAPHY 20
HIST66 HISTORY R BALA 210 HISTORY 25
COMP12 MY FIRST C VINOD DUA 330 COMPUTER 18
LITR88 MY DREAMS ARVIND AD 470 NOBEL 24

Table: ISSUED
BID QTY_ISSUED
HIST66 10
COMP1 15
LITR88 15

(i) Display book name and author name and price of computer type books.
(ii) To increase the price of all history books by Rs 50.
(iii) Show the details of all books in ascending order of their prices.
(iv) To display book id, book name and quantity issued for all books which have been issued.

CL-XII/PREBOARD /2023-24/Computer Science/Set-I/Page 6 of 8

otherwise it wont be able to understand which tables column ur asking for.... select books.bid where books.bid
whenever joining is required
32. Shreya is a Python programmer working in a Company. For the Annual Event, he has created a csv file named
Product.csv, to store the information of product. The structure of Product.csv is: [4]

[P_Id, P_Name, Qty, Price]


Where
P_Id is Product ID (integer)
P_name is Product Name (string)
Qty is Quantity of that product (integer)
Price is Price of that product

For efficiently maintaining data of the event, Shreya wants to write the following user defined functions:
Accept() – to accept a record from the user and add it to the file Product.csv. The column headings should also be
added on top of the csv file.
Increase() – to increase the price of those product by 10% which have quantity more than 100.

As a Python expert, help him complete the task.

SECTION-E

33.(a) Write a Program in Python that defines and calls the following user defined functions: [4]
(i) ADD() – To accept and add data of a teacher to a Binary file ‘teacher.dat’. Each record consists
of a list with field elements as tid, name and mobile to store teacher id, teacher name and teacher
mobile number respectively.

(ii) COUNTRECORD() – To count the number of records present in the Binary file named ‘teacher.dat’.

(b)What is the difference between Binary File and Text file in File handling? [1]

34.(a) What is the difference between drop and delete command in MySQL? Explain with example. [1]

(b) Rahul has created a table named Employee in MYSQL database, EMP: [4]
Eid(Employee ID )- integer
name(Name) - string
DOB (Date of birth) – Date
Salary – float

Note the following to establish connectivity between Python and MySQL:


Username - root
Password - lion
Host - localhost

Rahul, now wants to insert 5 records into table Employee and display those records of Employee whose Salary is
more than 50000.

Help Rahul to write the program in Python.

CL-XII/PREBOARD /2023-24/Computer Science/Set-I/Page 7 of 8


35. Meticulous EduServe is an educational organization. It is planning to setup its India campus at Chennai with
its head office at Delhi. The Chennai campus has 4 main buildings – ADMIN, ENGINEERING, BUSINESS and
MEDIA

Block to Block distances (in Mtrs.)

From To Distance
ADMIN ENGINEERING 55 m
ADMIN BUSINESS 90 m
ADMIN MEDIA 50 m
ENGINEERING BUSINESS 55 m
ENGINEERING MEDIA 50 m
BUSINESS MEDIA 45 m
DELHI HEAD CHENNAI 2175 km
OFFICE CAMPUS

Number of computers in each of the blocks/Center is as follows:

ADMIN 110
ENGINEERING 75
BUSINESS 40
MEDIA 12
DELHI HEAD 20

(a) Suggest and draw the cable layout to efficiently connect various blocks of buildings within the CHENNAI
campus for connecting the digital devices. [1]
(b) Which network device will be used to connect computers in each block to form a local area network? [1]
(c) Which block, in Chennai Campus should be made the server? Justify your answer. [1]
(d) Which fast and very effective wireless transmission medium should preferably be used to connect the head
office at DELHI with the campus in CHENNAI? [1]
(e) Is there a requirement of a repeater in the given cable layout? Why/ Why not? [1]

CL-XII/PREBOARD /2023-24/Computer Science/Set-A/Page 8 of 8

You might also like