Nothing Special   »   [go: up one dir, main page]

Preboard - 1 2023 Nov

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

ARMY PUBLIC SCHOOL , DHAULA KUAN

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

1. Which is an unordered collection of elements in python? [1]


2. Identify the invalid variable name from the following.
Adhar@Number, none, 70outofseventy, mutable [1]
3. Consider the coding given below and fill in the blanks: [1]
Dict_d={„BookName‟:‟Python‟,‟Author‟:”Arundhati Roy”}
Dict_d.pop() # Statement 1
List_L=[“java”,”SQL”,”Python”]
List_L.pop() # Statement 2
(i) In the above snippet both statement 1 and 2 deletes the last element from the object
Dict_d and List_L. (True/False)
(ii) Which statement alone deletes the last element in its object?
4. Evaluate the following expression. [1]
False and bool(15/5*10/2+1)
5. Write the output for the following python snippet. [1]
LST=[1,2,3,4,5,6]
for i in range(6):
LST[i-1]=LST[i]
print(LST)
6. Which file mode opens the file and delete all its contents and place the file pointer at the
beginning of the file? [1]

7. _________ command is used to make an existing column as a primary key. [1]

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]

14. Consider the following directory structure: [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="")

(i) 40 @50 @ (ii) 10 @50 @70 @90 @


(iii) 40 @50 @70 @90 @ (iv) 40 @100 @

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.

22. (a) Expand the following: [2]


(i) IMAP (ii) HTTPS
(b) What is meant by webserver?

23. Find output of the following: [2]


def Quo_Mod (L1):
L1.extend([33,52])
for i in range(len(L1)):
if L1[i]%2==0:
L1[i]=L1[i] /5
else:
L1[i]=L1[i]%10
L=[100,215,310]
print(L)
Quo_Mod (L)
print(L)

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

(i) SELECT MAX(FEES),MIN(FEES) FROM SPORTS.


(ii) SELECT COUNT(DISTINCT SNAME) FROM SPORTS.
(iii) SELECT SNAME,SUM(No_of_Players) FROM SPORTS GROUP BY SNAME.
(iv) SELECT AVG(FEES*No_of_Players) FROM SPORTS WHERE
SNAME=”Basket Ball”.
26. Write a function named COUNT_CHAR() in python to count and display number of times
the arithmetic operators(+,-,*,/) appears in the file “Math.txt” . [3]
Example: Solve the following:
1.(A+B)*C/D
2.(A-B)*(A+B)/D-(E/F)
3. A+B+C/D*(E/F)
The function COUNT_CHAR() must display the output as
Number of “+” sign is 4
Page 4 of 9
Number of “-“ sign is 2
Number of “*” sign is 3
Number of “/” sign is 5
OR
Write a function V_COUNT() to read each line from the text file and count number of lines
begins and ends with any vowel.
Example: Eshwar returned from office and had a cup of tea. Veena and Vinu were good friends.
Anusha lost her cycle. Arise! Awake! Shine.
The function must give the output as:
Number of Lines begins and ends with a vowel is 3

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

30. Find Output [3]


def LST_ARG(L1): def OUTER(Y,ch):
L2=L1 global X,NUM
L3=[0,0,0,0] Y=Y+X
print("L2->",L2) X=X+Y
print("L3->",L3) print(X,"@",Y)
j=0 if ch==1:
L1.append(51) X=inner_1(X,Y)
for i in range(len(L1)): print(X,"@",Y)
if L1[i]%5==0: O elif ch==2:
L2[j]=L2[j]*L2[j] R NUM=inner_2(X,Y)
L3[j]=L2[j]%5 def inner_1(a,b):
j+=1 X=a+b
print("L1->",L1) b=b+a
print("L2->",L2) print(a,"@",b)
print("L3->",L3) return a
def inner_2(a,b):
L1=[10,15,20] X=100
Page 6 of 9
LST_ARG(L1) X=a+b
print("L1->",L1) a=a+b
b=a-b
print(a,"@",b)
return b
X=100
NUM=1
OUTER(NUM,1)
OUTER(NUM,2)
print(NUM,"@",X)

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]

CONFERENCE HUMAN FINANCE


BUILDING RESOURCE BUILDING
BUILDING

Page 7 of 9
Distance between Blocks in (Mtrs)
Human Resources - Conference 60
Human Resources - Finance 60
Conference - Finance 120

Expected Number of Computers to be installed in each block:


Block Computers
Human Resources 125
Conference 25
Finance 60
(a) What will be the most appropriate block where the organization should plan to install their
server?
(b) Draw a block-to-block cable layout to connect all the buildings in the most appropriate
manner for efficient communication.
(c) What will be the best possible connectivity out of the following to connect the new set-up of
offices in Chennai with its London base office?
(i) Infrared (ii) Satellite Link (iii) Ethernet Cable
(d) Which of the following devices will you suggest to connect each computer in each of the
above buildings? (i) Gateway (ii) Switch (iii) Modem
(e) Which network security device monitors all incoming and outgoing traffic and based on a
defined set of security rules it accepts, rejects or drops that specific traffic.

33. What is the use of seek() function ? [1+4=5]


Write a python program that defines and calls the following user defined functions.
Add_book() – To read the details of the books from the user and write into the csv file named
“book.csv”. The details of the books stored in a list are book_no,name,author.
Search_book() - To read author name from the user and display the books written by that author.
OR
Write a python program that defines and calls the user defined functions given below.
Add_rating() – To read product name and rating from the user and store the same into the csv file
“product.csv”
Display() – To read the file “product.csv” and display the products where the rating is above 10.
SECTION E
34. (a) What is the difference between LIKE and IN operator in MYSQL. Give an example

[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

You might also like