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

SAHODAYA SCHOOL COMPLEX KOCHI,

MODEL EXAMINATION 2023-2024

Time: 3 Hours Std XII – COMPUTER SCIENCE [083] Max. Marks:70


_________________________________________________________________

General Instructions:
 Please check this question paper contains 35 questions.
 The paper is divided into 5 Sections- A, B, C, D and E.
 Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark.
 Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
 Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
 Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
 Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
 All programming questions are to be answered using Python Language only.

SECTION A
1 State True or False. 1
Python loops can have an else clause. (True/False)
2 Ananya had created a table called “friends” to store the details of her friends. 1
After some days, she wanted to enter the data in the table, but could not
remember the column names and data types she had used while creating the
table. Which command in MySQL will help her to view these?

a. show table friends; b. desc friends;


c. select friends; d . describe table friends;
3 What will be the output of the following statement: 1
print (10 - 2**3 + 4%5+2//3)

a. 6 b. 516
c. 4 d . 6.6
4 What will be the output of s.capitalize() , if s=”computer science”? 1

a. COMPUTER SCIENCE b. Computer Science


c. Computer science d. cOMPUTER Science

5 A relation P has 5 rows and 3 columns and a relation Q has 4 rows and 4 1
columns. What will be the cardinality and degree of the relation which is
obtained as the Cartesian product of P and Q (i.e. PxQ)

a. 20,7 b. 20,12
c. 9,12 d. 9,7

1
6 140.154.214.220 is an example for______ 1

a.MAC address b.IP address


c.URL d.Domain name

1
7 Which statements in the following program will print the same results?
tup = (1,2, 3,4, 5, 6, 7, 8, 9)
print(tup[-4:-1]) # statement(1)
print(tup[5]) # statement(2)
print(tup[5:]) # statement(3)
print(tup[-4:8]) # statement(4)

a. 1 and 2 b. 1 and 4
c. 2 and 3 d. 1, 3 and 4

8 Consider the following code. Identify the correct output. 1

for i in "EXAM":
print([i.lower()], end= "#")
a. e#x#a#m# b. [‘exam’] #
c. [‘exam#’] d . ['e']#['x']#['a']#['m']#

1
9 Which of the following statement(s) would give error after executing the
following code?

s1='must' #statement 1
s2='try' #statement 2
n1=10 #statement 3
n2=3 #statement 4
print(s2*s1) #statement 5
print(s1+s2) #statement 6
print(s1+n1) #statement 7

a. statement 4 b. statement 6
c. statement 5 and 7 d. No Error
10 What possible output(s) is/are not expected to be displayed on screen at the 1
time of execution of the program from the following code?

import random
val=[80,70,60,50,40,30,20,10]
start=random.randint(1,3)
end=random.randint(start,4)
for i in range(start,end+1):
print(val[i],'*',end='')
a. 50 * b. 70* 60 * 50 *
c. 60 * 50 * 40 * d. 50 * 40 * 30*
2
11 1
_____________is a network device that regenerates and retransmit the whole
signal.
a. Modem b. Hub
c. Repeater d. Bridge

12 What will be the output of the following code? 1

def my_func(x=10,y=5):
x*=20
y=y-5
return x+y
print (my_func(3),my_func())

a. 60 60 b. 60 200
c. 200 200 d. 200 60
13 When is the ‘finally’ block executed? 1

a. When there is no exception.


b. When there is an exception
c. Only if some condition that has been specified is satisfied.
d. Always
14 Which statement is appropriate to change the first name "Madhur" to "Mridul" in 1
the "FName" column in the 'Student' table?

a. UPDATE Student SET FName='Mridul' WHERE FName='Madhur' ;


b. MODIFY Student SET FName='Madhur' INTO FName='Mridul ;
c. UPDATE Student SET FName='Madhur' INTO FName='Mridul' ;
d. UPDATE Student SET FName='Madhur' WHERE FName='Mridul' ;
15 What kind of transmission medium is most appropriate to carry data in a 1
computer network that is exposed to electrical interferences?

a. Unshielded twisted pair b. Microwave


c. Coaxial cable d. Optical Fiber
16 Consider the statements given below: 1
fobj = open(‘student.txt’, ‘r’)
fobj.seek(10,0)
Choose the statement that best explains the second statement.
a. It will place the pointer at 10 bytes ahead of the current file
pointer position.
b. It will place the pointer at 10 bytes behind from the end-of file.
c. It will place the pointer at 10 bytes from the beginning of the file.
d. It returns 10 characters from the 0th index
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

3
(c) A is True but R is False
(d) A is false but R is True
17 Assertion (A): The function definition Calculate(a, b, c=1,d) will give error. 1
Reasoning (R): All the non-default arguments must precede the default
arguments.
18 Assertion (A): A binary file in python is used to store collection objects like lists 1
and dictionaries that can be later retrieved in their original form using pickle
module.
Reasoning (R): A binary files are just like normal text files and can be read using
a text editor like notepad.
SECTION B
19 a. Expand the following terms: 2
1. SMTP 2. URL
b. Write two points of difference between Twisted Pair Cables
and Optical fiber.

OR
a. Expand the following terms:
1. WiFi 2. ARPANET
b. Explain Voice over Internet Protocol (VoIP)
20 The code given below checks whether a number is positive if not converts the 2
number to positive. Observe the following code carefully and rewrite it after
removing all syntax and logical errors. Underline all the corrections made.

def function()
x = input("Enter a number:")
if (abs(x)= x):
print("You entered a positive number")
else:
x=*-1
print("Number made positive : ",x)

function()
21 Write definition of a method FIND(CITIES) to display all the city names from a 2
list of cities, which are starting with alphabet A.

For eg: If the list CITIES contain [“AGRA”,”AHMEDABAD”,”BOMBAY”,”KOCHI”]

The following should get displayed


AGRA
AHMEDABAD
OR
Write a Python method/function Count3and7(N) to find and display the count of
all those numbers which are in between 1 and N, which are either divisible by 3
or 7.

For example: If the value of N is 15 The count should be displayed as 7 as


3,6,7,9,12,14,15 are in between 1 to 15 which are divisible either by 3 or 7.

4
22 Predict the output of the Python code given below: 2

st = "python programming"
count = 4
while True:
if st[0]== "p":
st = st[2:]
elif st[-2]=="n":
st = st[:4]
else:
count+=1
break
print(st)
print(count)

23 Write the equivalent Python statement for the following. 2


a. Insert an element 10 to the 2nd index of the list L
b. Delete the dictionary D along with its contents from the memory.

OR
Rahul wants to round a number down to the nearest smallest integer. Write the
Python commands to import the required module (using built-in function) and
display the nearest smallest integer to the given number x.
24 Ms. Shalini has just created a table named “Employee” containing columns Ename, 2
Department, Salary with Ename as the primary key. After creating the table, she
realized that she has forgotten to add Empid in the table. Help her in writing SQL
command to add a column Empid of integer type and set it as the primary key
column.
OR
Ms. Sharma created a table student with the following fields: Rollno, Name. While
creating the table Student, Ms. Sharma forgot to include the column Marks. Help
her to write a command to insert the Marks column with integer data type of size
3 into the Student table.
In Marks column of ‘Student’ table, for Rollno 2, the Class Teacher entered the
marks as 45. However there was a totalling error and the student has got her
marks increased by 5. Write the MySQL command to change the marks of Rollno 2
in ‘Student’ table.
25 Predict the output of the following code: 2

def Diff(N1,N2):
if N1%N2:
return N1-N2
else:
return N2-N1

NUM= [11, 25, 22, 45, 33 ,67]


for CNT in range (4,0,-1):
A=NUM[CNT]-1
B=NUM[CNT-1]
print(Diff(A,B),'#', end=' ')
5
SECTION C

26 Predict the output of the Python code given below: 3

def Display(str):
t=' '
for i in range(0,len(str)):
if(str[i].isupper()):
t=t+str[i+1].lower()
elif str[i].islower():
t=t+str[i-1].upper()
else:
if i%2==0:
t=t+str[i]
else:
t=t+'#'
print(t)

Display('Pre Board-2023')

27 Write the output of the queries (a) to (c) based on the table Result given below: 3

Table: Result
Name Stipend Subject Marks Class
Amal 200 English 38 Third
Uma 450 Mathematics 67 First
Tharun 300 Physics 56 Second
Vijay 550 Chemistry 40 Third
Vinayak 400 Physics 62 First
Alok 600 Computer 90 First
Beena 450 Physics

a. Select avg(Marks) “Class Average ” from Result where Subject=’Physics’;


b. Select Name from Result where Stipend<=400 and Class=’Third’;
c. select Name, Class from Result where Name like ‘%A%’ and
Subject in (‘Mathematics’, ’Computer’);

28 Write a method LINECOUNT() in Python to the read lines from a text file 3
‘STORY.TXT’ and display the number of lines which are starting with any
vowel.
OR

Write a function ETCount() in Python, which should read the content 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).

6
29 Consider the Table Furniture given below: 3
Table: Furniture
Fcode Fname Price Type Scode
1001 Table 4000 W03 105
1002 Chair 2050 W01 103
1003 Sofa 35000 W02 105
1004 Stand W02 101
1005 Cabinet 18000 W03 102

Based on the given table, write MySQL queries for the following:
a. Display the name and price of all furniture of type W03 and
price >15000 in alphabetical order of name.

b. Display the supplier code (Scode) and number of furniture supplied by


each supplier (from the table furniture) only if the number=1

c. Change the price of items to 0 if it is having the value NULL.

30 A list named Marks stores the marks of the students in Model1 and Model2. Write 3
functions to do the following:
i) stack_Push() -To add the best of the 2 Models to a stack named ResultStack
ii) stack_Pop() - To delete/remove a mark from the ResultStack
iii) stack_Display() - To display all the marks in the ResultStack
Eg: Marks = [ [ 67,68 ] , [ 35,46 ] , [ 61, 59 ] , [ 50, 60 ] , [ 25, 34] ]
After pushing the best mark, the ResultStack will be :[ 34, 60 , 61 , 46 , 68 ]

SECTION D

31 Consider the tables CUSTOMER and TRANSACTION given below: 4

TABLE : CUSTOMER
Acc_No Cust_name Cust_City Cust_phone Balance
1001 Sunitha Delhi 9878956789 10000
1002 Vivek Mumbai 7869804512 14000
1003 Sandhya Delhi 8967412367 13000

TABLE: TRANSACTION
Trans_Id Acc_No Trans_Type Amount
T001 1001 Credit 2000
T002 1002 Credit 6000
T003 1002 Debit 7000
T004 1003 Credit 8000

7
a. Write a query to display customer’s name along with their transaction details.

b. Write a query to display the customers from Delhi whose Balance amount is
more than 10000.

c. Write a query to display the sum of the transaction amount of each


Transaction Type.
d. Remove the column Cust_phone from Table Customer.

32 Rohan is a Python programmer working in a school. For the Social Project, he 4


has created a CSV file named COUNTRY.CSV, to store the details of different
countries. The structure of COUNTRY.CSV is :

[C_Name, Capital, Population]

For efficiently maintaining data, Rohan wants to write the following user defined
functions:

i. Accept() – to accept n records from the user and add it to the file
COUNTRY.CSV. The column headings should also be added on top of
the CSV file.

ii.ShowRec() - To display all the records present in the CSV file named
COUNTRY.CSV

As a Python expert, help him complete the task.

SECTION E
33 Superior Education Society is an educational Organization. It is planning to setup 5
its Campus at Nagpur with its head office at Mumbai. The Nagpur Campus has 4
main buildings – ADMIN, COMMERCE, ARTS and SCIENCE. You as a network expert
have to suggest the best network related solutions for their problems, keeping in
mind the distances between the buildings and other given parameters:

Shortest distances between various buildings:


ADMIN to COMMERCE - 140 m
ADMIN to ARTS - 90 m
ADMIN to SCIENCE - 50 m
8
COMERCE to ARTS - 55 m
COMMERCE to SCIENCE - 50 m
ARTS to SCIENCE - 45 m
MUMBAI Head Office to NAGPUR Campus – 850 KM
Number of Computers installed at various buildings are as follows:
COMMERCE – 75
ARTS – 40
ADMIN – 110
SCIENCE – 12
MUMBAI Head Office – 20

a. Suggest and draw the cable layout to efficiently connect various


blocks of buildings within the Nagpur campus for connecting the
digital devices.
b. Suggest the most appropriate block/location to house the SERVER
in the Nagpur campus to get the best and effective connectivity.
Justify your answer
c. Suggest the placement of the following devices with appropriate
reasons.
a) Switch/Hub b) Repeater
d. Which fast and very effective transmission medium should
preferably be used to connect the head office at Mumbai with
the campus in Nagpur?
e. The organization is planning to link its study centers situated in various part of
the same city. Which type of network out of LAN,WAN, MAN will be formed?
Justify your answer.

34 a. Differentiate between 'a' and 'w' file modes in Python. 2+3


=5
b. Consider a file, STUDENT.DAT, containing records of the following
structure: [Sid, StudentName, Class, Marks]

Write a function, copyData(), that reads contents from the file


STUDENT.DAT and copies the records with marks above 33 to the file named
PASS.DAT. The function should also return the total number of students
promoted.
OR

a. Give any two points of difference between a text file and a binary file.

b. A Binary file, EMP.DAT has the structure: { EID:[NAME, JOB, SALARY] }


Where EID – Employee id, NAME – Employee Name, Job - Job Type and SALARY is
the salary earned.

9
Write a user defined function, findEmp(jb), that accepts jb as parameter and
displays all the records from the binary file EMP.DAT, that have the value of JOB
as jb and earns salary above 30000.

35 (i) Differentiate between CHAR and VARCHAR datatypes. 1+4


(ii) Karan wants to write a program in Python to insert the following =5
record in the table named STAFF in MySQL database, OFFICE:
 EmpID – integer
 Name – string
 Salary – integer
Note the following to establish connectivity between Python and MySQL:
 Username - root
 Password - sql
 Host - localhost
The values of fields EmpID ,Name ,Salary has to be accepted from the user. Help
Karan to write the program in Python.
OR

(i) Define the term NATURAL JOIN with respect to RDBMS.

(ii) Kavya has created a table named STAFF in MySQL database, OFFICE with
the following fields:
 EmpID – integer
 Name – string
 Salary – integer
Note the following to establish connectivity between Python and MySQL:
 Username - root
 Password - sql
 Host - localhost
Kavya, now wants to display the records of employees whose salary is more than
50000. Help Kavya to write the program in Python.

10

You might also like