SQP 75 - QP

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

12COM02QP

KENDRIYA VIDYALAYA SANGATHAN, CHENNAI REGION


PRE-BOARD EXAMINATION – II 2023-24
Class: XII Computer Science (083) Theory
Time allowed: 3 Hours Maximum Marks: 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.
SECTION-A
1 State True or False 1
In Dynamic Typing the datatype attached with the variable can change during the
program run.
2 Which of the following is/are invalid identifier(s) in Python? 1
(a) _number (b) None (c)123int (d)decimal
3 What will be the output of the following Python code: 1
try:
a = 10
b=0
c = a/b
print ("a/b =", c)
except Exception as error:
print(error)
else:
print ("No Error")
a)0 b)No Error c) Value Error d) division by zero
4 Expand the following terms: 1
(i) PPP (ii) VoIP
5 Give the output of code snippet given below: 1
L=[1,2,3]
L2=L.append(4)
print (L2)
a) [1,2,3] b) None c) TypeError d) [1,2,3,4]
6 What is the primary function of a router in a network? 1
a) Forwards data packets between devices within the same network
b) Connects devices within the same local area network (LAN)
Page 1 of 8
c) Connects different networks and makes decisions based on IP addresses
d) Amplifies and regenerates signals in a network
7 Given the below code snippet, which of the following options would create a 1
variable called final_string that is assigned to the word “yelling”?
string1= "yellow"
string2= "screaming"
(a) final_string = string1[:4] + string2[6:]
(b) final_string = string1[:3] + string2[6:]
(c) final_string = string1[:3] + string2[6: -1]
(d) final_string = string1[:4]. append(string2[-3:])
8 Network in which every computer is capable of playing the role of a client, or a 1
server or both at same time is called
a) local area network b) peer-to-peer network
c) dedicated server network d) wide area network
9 Which of the following statements is TRUE about keys in a relational database? 1
a) A candidate key is not eligible to become a primary key.
b) A primary key uniquely identifies the attributes in a relation.
c) A candidate key that is not a primary key is a foreign key.
d) A foreign key is an attribute whose value is derived from the primary key of
another relation
10 What is the purpose of the SQL JOIN clause? 1
a) To create a new table
b) To combine rows from two or more tables based on a related column
c) To delete records from a table
d) To update data in a table
11 Study the following program and select the possible output(s) from the options 1
(i) to (iv) following it.
import random
X= random.random()
Y= random.randint(0,4)
print(int(X),":",Y+int(X))
a) 0 : 0 b) 1 : 6 c) 2 : 4 d) 0 : 3
12 Write the output:- 1
myTuple = ("John", "Peter", "Vicky")
x = "#".join(myTuple)
print(x)
a) #John#Peter#Vicky b) John#Peter#Vicky
c) John#Peter#Vicky# d) #John#Peter#Vicky#
13 Given the following dictionaries 1
dict_fruit={"Kiwi":"Brown", "Cherry":"Red"}
dict_vegetable={"Tomato":"Red", "Brinjal":"Purple"}
Which statement will merge the contents of both dictionaries?
a) dict_fruit.update(dict_vegetable) b) dict_fruit + dict_vegetable
c) dict_fruit.add(dict_vegetable) d) dict_fruit.merge(dict_vegetable)
14 Which of the following file opening mode in Python, generates anerror if the file 1
does not exist?

Page 2 of 8
a) a b) r c) w d) w+
15 If a function is defined by the line "defcalculate(p, q=100, r=10):", which of the 1
following istrue?
a) p is an optional parameter
b) q and r are optional parameters
c) q will always have value 100 in the function
d) the above line will cause a syntax error
16 Which of the following SQL statements is used to open a database named 1
“SCHOOL”?
a) CREATE DATABASE SCHOOL;
b) USE DATABASE SCHOOL;
c) USE SCHOOL;
d) SHOW DATABASE SCHOOL;
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): Python's pass statement is used for documentation purposes. 1
Reason (R): The pass statement does nothing and acts as a placeholder.
18 Assertion (A): In Python, a variable defined inside a function is local to that 1
function.
Reason (R): Local variables can be accessed outside the function they are
defined in.
SECTION-B
19 a=int{input("ENTER FIRST NUMBER")} 2
b=int(input("ENTER SECOND NUMBER"))
c=int(input("ENTER THIRD NUMBER"))
if a>b and a>c
print("A IS GREATER")
if b>a and b>c:
Print(" B IS GREATER")
if c>a and c>b:
print(C IS GREATER)
20 Differentiate between server side script and client side script. Write one example 2
of each.
Or
What are protocols? Name protocols for sending and receiving e-mail.
21 Differentiate between Alter and Update. 2
Or,
Differentiate between where and having
22 a) Given is a Python string declaration: 2
str="CBSE Examination@2024"
Write the output of: print(str[-1:-15:-2])
(b) Write the output of the code given below:

Page 3 of 8
d = {"name": "Akash", "age": 16}
d['age'] = 27
d['city'] = "New Delhi"
print(d.items())
23 Write the output of the following code: 2
a=20
def calling(x):
global a
if a%3!=0:
x+=a
else :
x-=a
return(x)
print (calling(45),end="&&")
print (calling(35),end="@@")
24 Write a suitable Python statement for each of the following tasksusing built-in 2
functions/methods only:
a) To delete an element Mumbai:50 from Dictionary D.
b) To display words in a string S in the form of a list
OR
Write a Python Program to display alternate characters of a stringmy_str.
For example, if my_str = "Computer Science"
The output should be Cmuecec
25 Write a Python Program containing a function FindWord(STRING,SEARCH), 2
that accepts two arguments : STRING and SEARCH, andprints the count of
occurrence of SEARCH in STRING. Writeappropriate statements to call the
function.
For example, if STRING = "Learning history helps to know abouthistory with
interest in history" and SEARCH = 'history', the functionshould display
The word history occurs 3 times.
SECTION-C
26 a) Differentiate between Natural join and Equi join. 1+
b) Table : Employee 2
EmployeeId Name Sales JobId
E1 SumitSinha 110000 102
E2 Vijay SinghTomar 130000 101
E3 Ajay Rajpal 140000 103
E4 Mohit Kumar 125000 102
E5 Sailja Singh 145000 103
Table: Job
JobId JobTitle Salary
101 President 200000
102 Vice President 125000
103 Administrator Assistant 80000
104 Accounting Manager 70000
105 Accountant 65000
Page 4 of 8
106 Sales Manager 80000
Give the output of following SQL statement:
(i) Select Name, JobTitle, Sales from Employee, Job
where Employee.JobId=Job.JobId and JobId in (101,102)
(ii) Select JobId, count(*) from Employee group by JobId
27 Write a function in python named SwapHalfList(Array), which accepts a list 3
Array of numbers and swaps the elements of 1st Half of the list with the 2nd
Half of the list, ONLY if the sum of 1st Half is greater than 2nd Half of the list.
Sample Input Data of the list
Array= [ 100, 200, 300, 40, 50, 60],
Output Array = [40, 50, 60, 100, 200, 300]
28 Write a function ETCount() in Python, which should read eachcharacter of a text 3
file “TESTFILE.TXT” and then count and displaythe count of occurrence of
alphabets E and T individually (includingsmall cases e and t too).
Or,
Write a method/function DISPLAYWORDS() in python to read lines from a text
file POEM.TXT, and display those words, which are less than 4 characters.
29 Tulasi creates a table RESULT with a set of records to maintain themarks 3
secured by students in Term1, Term2, and their divisions.After the creation of
the table, he entered data of 7 students in thetable.
ADNO ROLLNO SNAME TERM1 TERM2 DIVISION
123 101 KARAN 366 410 I
245 102 NAMAN 300 350 I
128 103 ISHA 400 410 I
129 104 RENU 350 357 I
234 105 ARPIT 100 75 IV
187 106 SABINA 100 205 II
181 107 NEELAM 470 450 I
Based on the data given above answer the following questions:
a) Identify the columns which can be considered as candidate keys?
b) If one more columns are added and 3 rows are deleted from the table
result, what will be the new degree and cardinality of the above table?
c) Write a statement to increase the TERM2 marks by 3% for the students
securing marks between 70 to 100.
30 A nested list contains the data of visitors in a museum. Each of the inner 3
listscontainsthe following data of a visitor:
[V_no (int), Date (string), Name (string), Gender (String M/F), Age (int)]
Write the following user defined functions to perform given operations on the
stacknamed "status":
(i) Push_element(Visitors) - To Push an object containing Gender of visitor who
are in the age range of 15 to 20.
(ii) Pop_element() - To Pop the objects from the stack and count the display the
number of Male and Female entries in the stack. Also, display “Done” whenthere
are no elements in the stack.
For example: If the list Visitors contains:
[['305', "10/11/2022", “Geeta”,"F”, 35],

Page 5 of 8
['306', "10/11/2022", “Arham”,"M”, 15],
['307', "11/11/2022", “David”,"M”, 18],
['308', "11/11/2022", “Madhuri”,"F”, 17],
['309', "11/11/2022", “Sikandar”,"M”, 13]]
The stack should contain
F
M
M
The output should be:
Done
Female: 1
Male: 2
SECTION-D
31 A csv file “Book.csv” has structure [BookNo, Book_Name, Author, Price]. 2+
a. Write a user defined function CreateFile() to input data for a record and add to 2
Book.csv .
b. Write a function CountRec(Author) in Python which accepts the Author name
as parameter and count and return number of books by the given Author are
stored in the file “Book.csv”
32 Write SQL queries for (a) to (d)on the basis of tables given below 4
Table : TRAINS
TNO TNAME START END
11096 Ahimsa Express Pune Junction Ahmedabad Junction
12015 Ajmer Shatabdi New Delhi Ajmer Junction
1651 Pune Hbj Special Pune Junction Habibganj
13005 Amritsar Mail Howrah Junction Amritsar Junction
12030 SwarnaShatabdi Amritsar Junction New Delhi

Table : PASSENGERS
PNR TNO PNAME GENDER AGE TRAVELDATE
P001 13005 R N AGRAWAL MALE 45 2018-12-25
P002 12015 P TIWARY MALE 28 2018-11-10
P003 12015 S TIWARY FEMALE 22 2018-11-10
P004 12030 S K SAXENA MALE 42 2018-10-12
P005 12030 S SAXENA FEMALE 35 2018-10-12

a) To display total number of MALE and FEMALE Passengers


b) To display details of all Trains which Start from Pune Junction
c) To display details of all Passengers travelling in Trains whose TNO is 12030
d) To display the PNR, PNAME, GENDER and AGE of all Passengers whose
AGE is above 50
SECTION-E
33 Piccadily Design and Training Institute is setting up its centre in Jodhpur with 5
four specialised units for Design, Media, HR and Training in separate buildings.
The physical distances between these units and the number of computers to be
installed in these units are given as follows.
Page 6 of 8
Shortest distances between various locations in metres :
Design Unit to Media Unit 60
Design Unit to HR Unit 40
Design Unit to Training Unit 60
Media Unit to Training Unit 100
Media Unit to HR Unit 50
Training Unit to HR Unit 60

Number of computers installed at various locations are as follows :


Design Unit 40
Media Unit 50
HR Unit 110
Training Unit 40

You as a network expert, have to answer the queries as raised by the


administrator as given in (a) to (e).
a) Suggest by drawing the cable layout for effective network connectivity.
b) Suggest the most suitable location to install the main server.
c) Suggest the devices to be installed in each of these buildings for
connecting computers installed within each of the units out of the
following :
Modem, Switch, Gateway, Router
d) Suggest an efficient as well as economic wired medium to be used within
each unit for connecting computer systems out of the following network
cable :
Co-axial Cable, Ethernet Cable, Single Pair Telephone Cable
e) Is there a requirement of a repeater in the given cable layout? Why/Why
not?
34 a) Write any two difference between text file and binary file. 2+
b)Mayur is a student, who has a binary file called STUDENT.DAT containing 3
information- sid, name and age of each student. [sid, name , age]
Write the user defined function Get_Stud() to display the name and age of those
student who have a age greater than 18 year. In case there is no student having
age >18 the function displays message “There is no student who is greater than
18 year”

Page 7 of 8
35 a) What is the difference between a Candidate Key and an Alternate Key. 1+
b) Manoj has created a table named TRAVELS in MySQL: 4
Tour_ID – string
Destination – String
Geo_Cond– String
Distance – integer (In KM)
Note the following to establish connectivity between Python and MYSQL:
 Username is root
 Password is kvs
 The table TRAVELS exists in a MYSQL database named TOUR.
The details Tour_ID, Destination, Geo_Cond and Distance are to be accepted
from the user.
Manoj wants to display All Records of TRAVELS relation whose Geographical
condition is hilly area and distance less than 1000 KM. Help Manoj to write
program in python.
Or,
(i) Write one point of difference between PRIMARY KEY and UNIQUE KEY
in SQL.
(ii) Aarya has created a table named Emp in MySQL:
EmpNo – integer
EmpName – string
Age– integer
Salary – integer
Note the following to establish connectivity between Python and MYSQL:
 Username - root
 Password - kvs
 Host - localhost
 The Emp table exists in a MYSQL database named company.
 The details of Emp table (EmpNo, EmpName, Age and Salary)
Aarya wants to display All Records of Emp relation whose age is greater than
55. Help Aarya to write program in python.

END OF THE PAPER. BEST WISHES

Page 8 of 8

You might also like