0% found this document useful (0 votes)
456 views

Coimbatore Sahodaya Schools Complex

Uploaded by

S. Cheran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
456 views

Coimbatore Sahodaya Schools Complex

Uploaded by

S. Cheran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

A

COIMBATORE SAHODAYA SCHOOLS COMPLEX


TERM I COMMON EXAMINATION (SEP–2024)
GRADE: XII MARKS:70
DATE : COMPUTER SCIENCE TIME :3 HRS

General Instructions:
➢ Read the instructions carefully.
➢ This question paper has 5 Sections : Section - A, B, C, D & E.
➢ Section A has 18 questions carrying 1 mark each.
➢ Section B has 7 Very Short Answer (VSA) type questions carrying 2 marks each.
➢ Section C has 5 Short Answer (SA) type questions carrying 3 marks each.
➢ Section D has 2 Long Answer (LA) type questions carrying 4 marks.
➢ Section E has 3 Source-based/Case-based/Passage-based questions carrying 5 marks each .

Q. NO QUESTIONS MARKS

SECTION A

Predict the output:


marks = {"Ashok":98.6, "Ramesh":95.5}
1 print(list(marks.keys())) 1

Write the output for the following code snippets:


def Disp(A=4,B='2',C=2):
2
if type(C)==int:
print(A*C*B, end='#') 1

else:
print(A*B+C)
Disp()
Disp(3,'*','10')

Given is a Python string declaration: str="CBSE Examination@2024". Write the output of:
3
print(str[ -6: : -1]).
1

The output of the code will be :


4 1
s='Wonders of World'
print(s.count('O') + s.index('o'))

Find and write the output of following python code:


5
a=100
def show():
global a
1
a=-80
def invoke(x=5):
global a
a=50+x
show()
invoke(2)
invoke()
print(a)

Consider the given expression:


6
True and not AAA and not True or True
1
Which of the following will be correct output if the given expression is evaluated with AAA as
False?
a) True b) False c) NONE d) NULL

What will the following expression be evaluated to in Python?


7 1
print(15 // 4 + (8 // 3)/5)

Which function usage is used to display the total number of non-null values in a column “Sub”
8
from a table in a database?
1
a) unique(sub) b) sum(Sub) c) count(Sub) d) count(distinct sub)

Suppose you have two columns named student_name and student_department inside table
9
student_details and need to update the value of these two columns where ID=4. Select the
correct statement.
a) UPDATE student_details SET Student_name="ram", Student_department = 1

'Chemical' WHERE ID='4';


b) UPDATE table student_details SET column_name Student_name="ram",
Student_department = 'Chemical' WHERE ID='4';
c) UPDATE student_details SET Student_name="ram" and Student_department
='Chemical' WHERE ID='4';
d) UPDATE table student_details SET Student_name="ram", Student_department
= 'Chemical' WHERE ID='4';

Which command is used to change the definition of the existing table?


10 1
a) ALTER b) UPDATE c) SELECT d) MODIFY

What is the minimum maximum value that can be obtained by the variable b when the
11
following code is executed?
1
import random
a = random.random()
b = a + random.randint(1,4)
a) 1, 4.9999 b) 1, 5 c) 0, 4.9999 d) 0, 3.9999

Which of the following is used to read n characters from a file object “StuFile” ?
12 1
a)StuFile.read(n) b) StuFile(2) c) StuFile (read,2) d) All of the above

Which of the following is used to receive emails over the Internet?


13 1
a) SMTP b) POP3 c) PPP d) VoIP

Which of the following python statements will bring the read pointer to the 10th character from
14
the end of a file containing 100 characters, opened for reading in binary mode?
1
a) File.seek(10,0) b) File.seek(-10,2) c) File.seek(-10,1) d) File.seek(10,2)

Which of the following statements is True?


15
a) There can be only one Foreign Key in a table
1
b) There can be only one Unique key is a table
c) There can be only one Primary Key in a table
d) A table must have a Primary Key

Which of the following is a valid sql statement?


16
a) ALTER TABLE student SET rollno INT(5);
1
b) UPDATE TABLE student MODIFY age = age + 10;
c) DROP FROM TABLE student;
d) DELETE FROM student;

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 of A
b) Both A and R are true and R is not the correct explanation of A
c) A is True but R is False
d) A is False but R is True

Assertion (A): If the arguments in a function call statement match the number and order of
17 arguments as defined in the function definition, such arguments are called positional arguments. 1
Reasoning (R): During a function call, the argument list first contains default argument(s)
followed by positional argument(s).

Assertion (A): A variable declared as global inside a function is visible with changes made to it
18 outside the function.
Reasoning (R): All variables declared outside are not visible inside a function till they are
1
redeclared with global Keyword.

SECTION B

Find the output of the following code:


19
a=[1,2,3,4]
s=0
for a[-1] in a: 2

print(a[-1])
s+=a[-1]
print('sum=',s)

Write the python statement for each of the following tasks using BUILT-IN functions/methods
20
only:
(i) To remove an element at index 2 in a list L
(ii) To check whether a string named text has ‘th’ in the beginning. 2

Mr. Sarthak has just created a table name ‘Wrestling’ containing columns PlayerId, Pname,
21
Style and WeightCategory. After creating the table he realized that he had forgotten to add a
primary key column in the table. Help him in writing an SQL command to add a primary key
column PlayerId of integer type to the table Wrestling. Thereafter write the command to insert 2

the following record in the table:


PlayerId – 999, Pname – Tyler, Style – BJJ, WeightCategory – 75

a) Expand the following abbreviations: i) URL ii) TCP


22 2
b) What is the use of VoIP?

Shifa has written a code to input a positive integer and display its factorial. Her code is having
23
errors. Rewrite the correct code and underline the corrections made. (factorial of a number n is
the product 1x2x3. . .n)
n=int(input("Enter a positive integer: ")
f=0 2
for i in range(n):
f*=i
print(f)
Predict the output of the following python code:
24
def disp(a1,a2):
2
b1=[]
b2=[]
for x in a1:
b1.append(x)
for x in a2:
b2.append(x)
return b1,b2
p,q=disp("FUN",'DAY')
print(p,q)
OR
Predict the output of the following python code:
data = [2,4,2,1,2,1,3,3,4,4]
d = {}
for x in data:
if x in d:
d[x]=d[x]+1
else:
d[x]=1
print(d)

Write a function count_city(CITY) in Python, that takes the dictionary, CITY as an argument
25
and displays the names (in uppercase) of the cities whose names are smaller than 6 characters.
For example, Consider the following dictionary
CITY = {1:"Ahmedabad", 2:"Pune", 3:"Baroda", 4:"Simla", 5:"Surat"} 2

The output should be: PUNE SIMLA SURAT


OR
Write a function Word_Len(text), that takes a text as an argument and returns a tuple containing
length of each word of a text. For example, if the text is "How are you Rohit", the tuple will
have (3, 3, 3, 4).

SECTION C

Consider the following tables ITEM and CUSTOMER . Write outputs for SQL queries:
26
TABLE : ITEM

TABLE : CUSTOMER

i) SELECT DISTINCT City FROM CUSTOMER ;


ii) SELECT ItemName, MAX(Price), COUNT(*) FROM Item GROUP BY ItemName;
iii) SELECT CustormerName, Manufacture FROM Item, Customer WHERE Item.Item_Id =
Customer.Item.I_Id;

Write a method SHOWLINES() in Python to read lines from text file ‘story.txt’ and display the
27
lines which do not contain 'text'.
Example: If the file content is as follows :
Write a function word_of_length(text). 3

That takes an argument and.


Returns a tuple containing length of each word of text.
This is your program.
The SHOWLINES() function should display the output as:
That takes an argument and.
This is your program.
OR
Write a function ETCount() in Python, which should read each character of a text file
“TESTFILE.TXT” and then count and display the count of occurrences of alphabets E and T
individually (including small cases e and t too).

Write the output of the code given below:


28
def change(Line):
alpha=str()
3
digi=str()
for ch in Line:
if(ch.isalpha()):
if(ch.islower()):
alpha=alpha+ch.upper()
elif(ch.isupper()):
alpha=alpha+ch.lower()
elif(ch.isdigit()):
alpha=alpha+ch+ch
print(Line)
print(alpha)
change("Vande 0 Bharat 9 Train 1")

Consider the Table Student give below :


29
Table : Student

Write the SQL queries for following :


(i) Increase 2 marks in Chemistry Subject.
(ii) Delete the record whose Roll Number is 1207.
(iii) Display the student name and subject whose marks is more than 90.

Anil has created a list, X containing marks of 5 students. Write a program, with separate user
30
defined function to perform the following operation:
PUSH() - Traverse the content of the List, L and push all the odd marks into the stack S.
POP() - Pop and display the content of the stack.
Example: If the content of the list is as follows: L=[81, 94, 63, 19, 62] 3
Then the output of the code should be: 19 63 81 empty
OR
Write a function in Python, Push(BItem) where , BItem is a dictionary containing the details of
bakery items– {Bname:price}.The function should push the names of those items in the stack S
which have prices less than 50.
For example: If the dictionary contains the following data:
Bitem={"Bread":40,"Cake":250,"Muffins":80,"Biscuits":25}
The stack should contain
Bread
Biscuits

SECTION D

Aryan is a Python programmer working in Infotech Ltd. For Ambica Furniture, he has created a
31
csv file named furniture.csv, to store the data of different furniture. Write User Defined
Functions in Python as per following requirements :
i) ADD () – To accept and add data of an item to a CSV file ‘furniture.csv’. Each record 4

consists of Fur_id, Description, Price, and Discount.


ii) COUNTR() – To count the number of records present in ‘furniture.csv’ whose price is less
than 5000.

Consider the table PRODUCT and CLIENT given below:


32 4

Write SQL Queries for the following:


i) Display the details of those clients whose city is DELHI.
ii) Increase the Price of all Bath soap by 10.
iii) Display the details of Products having the highest price.
iv) Display the product name, price, client name and city with their corresponding matching
product Id.
SECTION E

Oxford college, in Delhi is starting up the network between its different wings. There are four
33 5
Buildings named as SENIOR, JUNIOR, ADMIN and HOSTEL as shown below:

i) Suggest the cable layout of connections between the buildings.


ii) Suggest the most suitable place (i.e., building) to house the server of this college and provide
a suitable reason.
iii) Is there a requirement of a repeater in the given cable layout? Why/ Why not?
iv) Suggest the placement of hub/switch with justification.
v) The organization also has an inquiry office in another city about 50-60 km away in hilly
region. Suggest the suitable transmission media to interconnect to college and inquiry office out
of the following:

i) Define Pickling. Which function aids in serializing the python object? 2+3
34
ii) A binary file “salary.DAT” has structure [employee id, employee name, salary]. Write a
function countrec() in Python that would read the contents of the file “salary.DAT” and display
the details of those employees whose salary is above 20000.
OR
i) What is the difference between ‘r’ and ‘w’ mode in a Python file ?
ii) A binary file “STUDENT.DAT” has structure [admission_number,Name, Percentage]. Write
a function countrec() in Python that would read contents of the file “STUDENT.DAT” and
display the details of those students whose percentage is above 90. Also display the number of
students scoring above 90%.
i) Define the term Degree with respect to RDBMS.
35 1+4
ii) Sarithahas created a table Inventory in MYSQL database, warehouse:
Inv_No(Inventory Number )- integer
Inv_name(Name) – string
Inv_Entry(Date )
Inv_price – Decimal
Note the following to establish connectivity between Python and MySQL:
Username - root
Password - 12345
Host - localhost
Saritha now wants to delete the records of inventory whose price is more than 1000. Help
Saritha to write the program in Python.

You might also like