Preboard - 1 2023 Nov
Preboard - 1 2023 Nov
Preboard - 1 2023 Nov
Examination : PREBOARD -1
CLASS : XI SET : A SUBJECT : COMPUTER SCIENCE
Time : 3 HRS M.M : 70
General Instructions :
• All Questions are compulsory
• Programming language: Python
8. In MYSQL state the commands used to delete a row and a column respectively [1]
(a) DELETE,DROP (b) DROP,DELETE (c) DELETE,ALTER (d) ALTER,DROP
9. Debug the following code and underline the corrections made: [1]
d=dict{}
n=input("enter number of terms")
for i in range(n):
a=input("enter a character")
d[i]=a
10. In MYSQL _____ clause applies the condition on every ROW and ______ clause applies the
condition on every GROUP. [1]
11. Complete the following snippet to open the file and create a writer object for a csv file
“emp.csv” with delimiter as pipe symbol „|‟ to add 5 more records into the file using the list
named “e_rec”. emp_file=___________
Page 1 of 9
csv_writer=csv.writer( ____________ ) [1]
12. _________ operator is used to compare NULL value in MYSQL table. [1]
13. Name the protocol used for video conferencing and sending emails. [1]
There are three directories under root directory ‘Admin’ . Identify the relative path name for the
‘Result1.xlsx’
a) …\Result1.xlsx b) Admin\Final\First Term\Result1.xlsx
c) ..\First Term\Result1.xlsx d) First Term \Result1.xlsx
15. Which command is used to display the structure of the table? Write the syntax of the
command. [1]
16. Which function of mysql.connector library lets you check if the connection to the database is
established or not? [1]
(a) connectionobject.is_connected() (b) mysql.connector,connect()
(c) mysql.connector() (d) mysql.connector
Q17 and Q18 are ASSERTION and REASONING based questions. Mark the correct choice as
(a) Both A and B 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) : When we open the file in write mode the content of the file will be erased if
the file already exist.
Reasoning(R): Open function will create a file if does not exist, when we create the file both in
append mode and write mode. [1]
18. Assertion(A): Keyword argument were the named arguments with assigned values being
passed in the function call.
Reasoning (R): Default arguments cannot be skipped while calling the function while keyword
arguments are in function call statement. [1]
SECTION B
19. What possible outputs are expected to be displayed on screen at the time of execution of the
program from the following code? Also specify the maximum value that can be assigned to each
of the variables L and U. [2]
import random
Page 2 of 9
Arr=[10,30,40,50,70,90,100]
L=random.randrange(1,3)
U=random.randrange(3,6)
for i in range(L,U+1):
print(Arr[i],"@",end="")
20. Write the output for the following python code: [2]
def Change_text(Text):
T=""
for K in range(len(Text)):
if Text[K].isupper():
T=T+Text[K].lower();
elif K%2==0:
T=T+Text[K].upper()
else:
T=T+T[K-1]
print(T)
Text="Good Go Head"
Change_text(Text)
21. What is the difference between Equi join and Natural join. Give an Example [2]
OR
Differentiate between BUS and STAR topology in networking.
Page 3 of 9
24. Mr. Gupta want to print the city he wants to visit and the distance to reach that place from his
native. But his coding is not showing the correct output debug the code to get the correct output
and state what type of argument he tried to implement in his coding. [2]
def Travel (d=3,c)
print(“Destination city is “,distance)
print(“Distance from native is “,city)
Travel(”Tiruchi”, 18)
SECTION C
25. (a) Consider the following tables FACULTY and STUDENT. Write the output for the
MYSQL statement given below and state what type of join is implemented. [3]
SELECT * FROM FACULTY,STUDENT
Table: FACULTY Table: STUDENT
Faculty_id Name Stu_id Stu_Name
F100 Govardhan 12101 Anitha
F101 Janet 12102 Vishnu
F102 Rithu
(b) Write the output for the queries (i) to (iv) based on the table. SPOTRS
S_I FEE START_ No_of_Play
D SNAME S DT ers
500
S1 Foot ball 0 1/10/2015 25
400 10/10/201
S2 Basket ball 0 6 30
500
S3 Volley ball 0 2/2/2017 25
550
S4 Kho-Kho 0 3/20/2017 40
600
S5 Basket ball 0 2/15/2016 50
27. Write the SQL Queries for (i) to (iii) based on the table EMPLOYEE and DEPARTMENT.
[3]
Table: EMPLOYEE Table: DEPARTMENT
EMP_I SALAR
D Name DEPT JOIN_DT Y DEPT D_NA
Vanith _ID ME
E1 a 101 1/1/2015 50000 Product
Karthik 101 ion
E2 a 102 2/1/2015 75000 102 Sales
Prathib Marketi
E3 a 103 1/5/2014 85000 103 ng
6/10/201
E4 Mihika 101 6 100000
Mridul 10/15/20
E5 a 102 14 95000
(i) To display department name and number of employees in each department where no
of employees is greater than one.
(ii) To display department name and sum of the salary spent by the department, where the
total amount spent by the department as salary is more than 100000.
(iii) To display the name of the employee in descending order of their seniority.
28. Write a function DIVI_LIST() where NUM_LST is a list of numbers passed as argument to
the function. The function returns two list D_2 and D_5 which stores the numbers that are
divisible by 2 and 5 respectively from the NUM_LST. [3]
Example:
NUM_LST=[2,4,6,10,15,12,20]
D_2=[2,4,6,10,12,20]
D_5=[10,15,20]
29. Mohammed has created a dictionary containing names and marks of computer science as
key,value pairs of 5 students. Write a program, with separate user defined functions to perform
the following operations: [3]
● Push the keys (name of the student) of the dictionary into a stack, where the corresponding
value (CS marks) are more than or equal to 90 .
Page 5 of 9
●Pop and display the content of the stack, if the stack is empty display the message as “UNDER
FLOW”. For example: If the sample content of the dictionary is as follows:
CS={"Raju":80, "Balu":91, "Vishwa":95, "Moni":80, “Govind":90}
The output from the program should be:
Balu Vishwa Govind
The pop operation must display
Govind
vishwa
Balu
UNDER FLOW
OR
Dev Anand have a list of 10 numbers. You need to help him create a program with separate user
defined functions to perform the following operations based on this list.
● Traverse the content of the list and push the numbers divisible by 5 into the stack.
● Pop and display the content of the stack, if the stack is empty display the message” STACK
EMPTY” For Example: If the sample Content of the list is as follows:
N=[2,5,10,13,20,23,45,56,60,78]
After the push operation the list must contain
5,10,20,45,60
And pop operation must display the output as
60
45
20
10
5
STACK EMPTY
SECTION D
OR
31. Naveen created a table SALES_DONE to maintain the sales made by his sales department.
The table consists of 10 employees records. To record every months sales he is adding a new
column with first three characters of that month. [1+1+2]
EMP_N ACCT_N
O NAME O Jan Feb
101 Naren Kumar 105231 150 300
102 Jaya Deep 510423 120 140
103 Naveen Kumar 20146 210 250
104 Srinikethan 698751 210 140
105 Tharun Venkat 564132 220 230
Based on the above table answer the following questions:
(i) Identify the candidate key, primary key from the above table.
(ii) He added two more employee in the month of February and if a new column is added
for each month, at the end of May month what is the degree and cardinality of the
table.
(iii) Write the SQL statement to do the following
(a) Insert the following record into the above table.
106,”Venkatesh Gour”,256489,200,300
(b) Change the name of the employee as Sri Nikethan” whose emp no is 104.
OR (option for part iii only)
(iii) Write the MYSQL statement for the following
(a) Add a new column Total_sales of type integer with NOT NULL constraint.
(b) Fill the column Tot_sales by adding values in Jan and Feb columns.
32. A professional consultancy company is planning to set up new offices in India with its hub at
Chennai. As a network adviser, you have to understand their requirements and suggest to them
the best available solutions. [5]
Page 7 of 9
Distance between Blocks in (Mtrs)
Human Resources - Conference 60
Human Resources - Finance 60
Conference - Finance 120
[1+3=4]
(b) Sartaj 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 - tiger Host – localhost
Sartaj, now wants to display the records of students whose fee is more than 5000. Help Sartaj to
write the program in Python.
OR (option for part (b) only)
Page 8 of 9
Sartaj 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 - tiger Host – localhost
Sartaj, now wants to rename the column name to sname. Help Sartaj to write the program in
Python.
35. (i) Differentiate between text and binary file in Python. [1+3=4]
(ii) Consider a file, SPORT.DAT, containing records of the following structure:
[SportName, TeamName, No_Players]
Write a function, countData(), that reads contents from the file SPORT.DAT and count and
return the total players of all teams stored in SPORT.DAT.
Page 9 of 9