QP Xii CS Set 2

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

KENDRIYA VIDYALAYA SANGATHAN: BHUBANESWAR REGION

PRE-BOARD EXAMINATION 2023-24


CLASS XII
COMPUTER SCIENCES (083) SET-2
TIME: 3 HOURS 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. SECTIONA Marks
No.
1. State True or False 1
“Variable declaration is implicit in Python”
2. Which SQL command is used to change some values in existing rows? 1
a) update b) insert c) alter d) order
3. Consider the following expression : 5+2**6<9+2-16//8 1
Which of the following will be correct output if the given expression is evaluated?
(a) 127 (b) True (c) False (d) Invalid expression
4. Which of the following refers to mathematical function? 1
a) sqrt b) rhombus c) add d) rhombus
5. In MYSQL database, if a table, Alpha has degree 5 and cardinality 3, and another table, Beta 1
has degree 3 and cardinality 5, what will be the degree and cardinality of the Cartesian product
of Alpha and Beta?
a) 5,3 b) 8,15 c) 3,5 d) 15,8
6. ……………. Protocol is used to send the email to another email user. 1
a) FTP b) POP c) IMAP d) SMTP
7. What will be the output of the following Python code snippet? 1

a) 1 b) 2 c) 4 d) Error, the keys can’t be a mixture of letters and numbers


8. Select the correct output of the code: 1

1
(a)COMPUTER-students-ARE-very-SMART (b) COMPUTER-STUDENTS-ARE-very-SMART
(c) computer-students-are-very-SMART (d) COMPUTER-STUDENTS-ARE-VERY-SMART
9. Which of the following statement(s) would give an error during execution of 1
the following code?
tup = (60,120,25,40,70,99)
print(tup) #Statement 1
tup [4] =80#Statement 2
print (tup [3] +50) #Statement 3
print(min(tup)) #Statement 4
Options:
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

a. RAMAN** b.
SHIVAJI** SHIVAJI**
TAGORE** SHIVAJI**TAGORE**
c. d.
SHIVAJI** SHIVAJI** ASHOKA**
TAGORE** TAGORE** SHIVAJI*SHIVAJI*
TAGORE* TAGORE* TAGORE*
11. Fill in the blank: 1
The modem at the sender’s computer end acts as a ____________.
a. Modelb. Modulatorc. Demodulatord. Convertor
12. What will be the output of the following Python code? 1

a) 65 b) error c) 75 d) 85
13. State True or False 1
An try block may have more than except blocks to handle exception.
14. Select correct collection of DDL Command? 1

2
(a) CREATE, DELETE, ALTER, MODIFY (b) CREATE, DROP, ALTER, UPDATE
(c) CREATE, DROP, ALTER, TRUNCATE (d) CREATE, DELETE, ALTER, UPDATE
15. A________is a set of rules that governs data communication. 1

16. Which statement is used to retrieve the current position within the file: 1
a) fp.seek() b) fp.tell() c) fp.loc d) fp.pos
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. Assertion(A): List is an immutable data type 1
Reasoning(R): When an attempt is made to update the value of an immutable variable, the old
variable is destroyed and a new variable iscreated by the same name in memory.
18. Assertion (A): A function is a block of organized and reusable code that is usedto perform a 1
single related action.
Reason (R): Function provides better modularity for your application and ahigh degree of code
reusability.
SECTIONB
19. (i) Expand the following terms 1+1=2
IMAP DNS
(ii) Write two points of difference between Switch and Router.
OR
(i) Define the term bandwidth with respect to networks
(ii) Write two points of difference between Web Server and Web Browser
20. The code given below accepts a number as an argument and checks whether the given 2
number is perfect number or not. Observe the following code carefully and rewrite it after
removing all syntax and logical errors. Underline all the corrections made.

21. Write a function countNow (DAYS) in Python, that takes the dictionary, DAYS as an argument 2
and displays the names (in lowercase) of the days whose names are longer than 7 characters.
For example, Consider the following dictionary
DAYS={1:"MONDAY",2:"TUESDAY",3:"WEDNESDAY",4:"THURSDAY",5:"FRIDAY",6:”
SATURDAY”,7:”SUNDAY”}

3
The output should be:
wednesday
thursday
saturday
OR
Write a function, lenWords(STRING), that takes a string as an argument and returns a list
containing length of each word of a string.
For example, if the string is "we are writing preboard exams ", the
list will have [2, 3, 7, 8, 5]
22. Predict the output of the following code: 2

23. Write the Python statement for each of the following tasks using BUILT-IN functions / 1+1=2
methods only:
(i) To update dictionary d1 with dictionary d2
(ii) To convert only starting letter in string named, message into uppercase letter.
OR
A list named studentMarks stores marks of students of a class. Write the Python comm and
to import the required module and (using built-in function) to display average value from the
given list.
24. Mr. Raja has just created a table named “Employee” containing columns Ename, 2
Department and Salary. After creating the table, he realized that he has forgotten to add a
primary key column in the table. Help him in writing an SQL command to add aprimary key
column EmpId of integer type to the table Employee. Thereafter, write the command to insert
the following record in the table:
EmpId- 999 ,Ename- Shweta ,Department: Production, Salary: 26900
OR
A music store MySports is considering to maintain their inventory using SQL to store the data.
The detail is as follow:
Table: SPORTS
SCODE SPORTNAME NOOFPLAYERS COACHNAME
S001 CRICKET 21 RAHUL DRAVID
S002 FOOTBALL 25 ROSHAN LAL
S003 HOCKEY 40 SRADAR SINGH
S004 CRICKET 19 CHETAN SHARMA
S005 ARCHERY 12 LIMBARAM
S006 SHOTTING 17 DEEPIKA KUMARI

Write an SQL statement to modify the no of players to 60 whose SCode is “S006”


25. Find and write the output of the following Python code: 2

4
SECTION C
26. Predict the output of the Python code given below: 3

27. Write the outputs of the SQL queries (i) to (iii) based on the relation COURSE 1*3=3
CID CNAME FEES STARTDATE TID
C201 AGDCA 12000 2018-07-02 101
C202 ADCA 15000 2018-07-15 103
C203 DCA 10000 2018-10-01 102

5
C204 DDTP 9000 2018-09-15 104
C205 DHN 20000 2018-08-01 101
C206 O LEVEL 18000 2018-07-25 105

(i) SELECT DISTINCT TID FROM COURSE;


(ii) SELECT TID, COUNT (*), MIN(FEES) FROM COURSEGROUP BY TID HAVING COUNT
(*)>1;
(iii) SELECT COUNT (*), SUM(FEES) FROM COURSEWHERE STARTDATE< ‘2018-09-15’;
28. Write a function COUNT_AND () in Python to read the text file “STORY.TXT” and count the 3
number of times “AND” occurs in the file. (include AND/and/And in the counting)
OR
Write a function DISPLAYWORDS( ) in python to display the count of words starting with “t” or
“T” in a text file ‘STORY.TXT’
29. Write SQL commands for the following queries (i) to (iii) on the basis of relationMobile Master 1*3=3
and Mobile Stock. MOBILE STOCK
S_Id M_Id M_Qty M_Supplier
S001 MB004 450 NEW VISION
S002 MB003 250 PRAVEEN GALLERY
S003 MB001 300 CLASSIC MOBILE
S004 MB006 150 A-ONE MOBILE
S005 MB003 150 THE MOBILE
S006 MB006 50 MOBILE CENTRE

MOBILE MASTER
M_Id M_Company M_Name M_Price M_Mf_Date
MB001 SAMSUNG GALAXY 4500 2013=02-12
MB003 NOKIA N1100 2250 2012-04-15
MB004 MICROMAX UNITE3 4500 2016-10-17
MB005 SONY XPERIAM 7500 2017-11-20
MB006 OPPO SELFIEEX 8500 2010-08-21

(i) Display the Mobile Company, Name and Price in descending order of their manufacturing
date
ii) List the details of mobile whose name starts with “S” or ends with “a”
iii) Display M_Id and sum of Moble quantity in each M_Id.
30. Two list Lname and Lage contains names of persons and age of persons respectively. A list 3
named Lnameage is empty. Write functions as details given below
(i) Push_na() :- it will push the tuple containing pair of name and age from Lname and Lage
whose age is above 50
(ii) Pop_na() :- it will remove the last pair of name and age and also print name and age of
removed person. It should also print “underflow” if there is nothing to remove
For example, the two lists have following data
Lname=[‘narender’, ‘jaya’, ‘raju’, ‘ramesh’, ‘amit’, ‘Piyush’]
Lage=[45,23,59,34,51,43]
After Push_na() the contains of Lnameage stack is
[(‘raju’,59),(‘amit’,51)]
The output of first execution of pop_na() is
The name removed is amit
The age of person is 51

6
OR
A dictionary stu contains rollno and marks of students. Two empty list stack_roll and
stack_mark will be used as stack. Two function push_stu() and pop_stu() is defined and
perfom following operation
(a) Push_stu() :- It reads dictionary stu and add keys into stack_roll and values
into stack_marks for all students who secured more than 60 marks.
(b) Pop_stu() :- it removes last rollno and marks from both list and print
“underflow” if there is nothing to remove
For example
stu={1:56,2:45,3:78,4:65,5:35,6:90}
values of stack_roll and stack_mark after push_stu()
[3,4,6] and {78,65,90}
SECTION D
31. Consider the tables STORE and SUPPLIERS given below: 4
TABLE: STORE
ITEM NO ITEM SCODE QTY RATE LASTBUY
2005 Sharpner 23 60 8 2009-01-31
Classic
2003 Ball Pen 0.25 22 50 25 2010-02+01
2002 Gel Pen 21 150 12 201-02-24
Premium
2006 Gel Pen 21 250 20 2009-03-11
Classic
2001 Eraser Small 22 220 6 2009-01-19
2004 Eraser Big 22 110 8 2009-12-02
2009 Ball Pen 0.5 21 180 18 2009-11-03

Table :Suppliers
Scode Sname
21 Premium Stationary
23 Soft plastics
22 Tetra Supply

i) To display ItemNo, Item Name and Sname from the tables with their corresponding matching
Scode.
ii) Display the structure of the table store.
iii) Display the average rate of Premium Stationary and Tetra Supply.
iv) Display the item, qty, and rate of products in descending order of rates
32. Asutosh Das is a Python programmer working in a school. For the preboard results, he has 4
created a csv file named Result.csvhas following structure
[rollno, name, marks].
i. Write a user defined function insertRec () to input data for a student and add to Result.csv.
ii. Write a function searchRollNo (r) in Python which accepts the student’s rollno as parameter
and searches the record in the file “Result.csv” and shows the details of student i.e., rollno,
name and marks (if found) otherwise shows the message as ‘No record found’
SECTION E

7
33. “Vidyadhara” an NGO is planning to setup its new campus at Bhubaneswarfor its web-based 1*5=5
activities. The campus has four (04) UNITS as shown below:

ADMIN TRAINING
UNIT UNIT

RESOURCE
FINANCE UNIT
UNIT

Distance Between above Units are given heres under


UN IT-1 UNIT-2 DISTANCE(In mtrs)
ADMIN TRAINING 65
ADMIN RESOURCE 120
ADMIN FINANCE 100
FINANCE TRAINING 60
FINANCE RESOURCE 40
TRAINING RESOURCE 50
No Of Computers in various UNITs are:
UNIT NO OF COMPUTERS
ADMIN 150
FINANCE 25
TRAINING 90
RESOURCE 75

a) Suggest topology and draw the cable layout to efficiently connect various blocks of buildings
within the Bhubaneswar campus for connecting the digital devices.
b) Which network device will be used to connect computers in each block to form a local area
network?
c) Which block, in Bhubaneswar Campus should be made the server? Justify your answer.
d) Is there a requirement of a repeater in the given cable layout? Why/Why not?
e) NGO is planning to connect its Regional Office at Delhi, Rajasthan. Which out of the
following wired communication, will you suggest for a very high-speed connectivity?
(a) Twisted Pair cable (b) Ethernet cable (c) Optical Fiber
34. i) Differentiate between r+ and a+ file modes in Python. 2+3=5
(ii) Consider a file, SPORTS.DAT, containing records of the following structure:
[SportName, TeamName, No_Players, No_matcheswon]
Write a function, copyData (), that reads contents from the file SPORTS.DAT and copies the
records with Sport name as “Cricket” to the file named CRICKET.DAT. The function should
return the total number of records copied to the file CRICKET.DAT.

Or

8
i) Difference between seek() and tell() methods with syntax
ii)Consider a binary file emp.dat having records in the form of dictionary.
E.g {eno:1, name:” Rahul”, sal: 5000}
write a python function to display the records of above file for those employees who get salary
between 25000 and 30000
35. (i) Define the term Domain with respect to RDBMS. Give one example to support your 1+4=5
answer(ii) Karthik wants to write a program in Python to create student table in MYSQL
database, SCHOOL:
▪ rno (Roll number)- integer
▪ name (Name) - string
▪ DOB (Date of birth) – Date
▪ fees – float
Note the following to establish connectivity between Python and
MySQL:
▪ Username - root
▪ Password - root
▪ Host - localhost
Help Kabir to write the program in Python to create the above table.
OR

(i) Give one difference between unique constraint and primary key.
(ii) Rojalina Gamango has created a table named Student in MYSQL database,
SCHOOL:
• rno (Roll number)- integer
• name (Name) - string
• DOB (Date of birth) – Date
• Fee – float
Note the following to establish connectivity between Python and
MySQL:
• Username - root
• Password – root
• Host – localhost
Rojalina Gamango now wants to display the records of students whose fee is more than
3500. Rojalina Gamango to write the program in Python

-end-

You might also like