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

BANGALORE SAHODAYA SCHOOLS COMPLEX

ASSOCIATION

PRE-BOARD EXAMINATION (2023-2024)


Grade XII – SET II
Date: Max. Marks: 70
Subject: Computer Science (083) Time: 3 Hours

General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each. Three internal choice is
given in Q19, Q21 and Q24
5. Section C has 05 Short Answer type questions carrying 03 marks each. One internal choice is given in
Q28
6. Section D has 02 Long Answer type questions carrying 04 marks each.
7. Section E has 03 questions carrying 05 marks each. Two internal choice is given in Q34 and Q35.
8. All programming questions are to be answered using Python Language only.

SECTION - A
1 State True or False 1
“The characters of string will have two-way indexing.”
2 Which of the following is the valid variable name? 1
(a) f%2 (b) 20ans (c) ans (d) $ans
3 What will be the output of the following code? 1

a) {4:’Four’,5: ‘Five’}
b) Method update() doesn’t exist for dictionary
c) {1: “One”,2: “Two”, 3: “C”}
d) {1: “One”,2: “Two”, 3: “C”,4: ‘Four’,5: ‘Five’}
4 Evaluate the expression given below if A=16 and B=15. 1
A % B // A
a) 1 b) 0.0 c) 0 d) 1.0
5 Select the correct output of the following code : 1

1
a) [I#N#F#O#R#M#A#T#I#C#S]
b) [‘I’, ‘N’, ‘F’, ‘O’, ‘R’, ‘M’, ‘A’, ‘T’, ‘I’, ‘C’, ‘S’]
c) [‘I N F O R M A T I C S’]
d) [‘INFORMATICS’]
6 Which of the following are the modes of both writing and reading in binary format 1
in file?
a) wb+
b) w
c) w+
d) wb
7 Fill in the blank 1
command is used to modify the attribute datatype or size in a table
structure.
a) update b) alter c) insert d) None of these
8 Which of the following clause is used to sort records in a table? 1
a) GROUP
b) GROUP BY
c) ORDER BY
d) ORDER
9 Which of the following statement(s) would give an error after executing the 1
following code?

a) statement 1
b) statement 2
c) statement 3
d) statement 4
10 Fill in the blank: 1
constraint is used to restrict entries in other table’s non key attribute,
whose values are not existing in the primary key of reference table.
a) Primary Key
b) Foreign Key
c) Candidate Key
d) Alternate Key
11 A text file student.txt is stored in the storage device. Identify the correct option 1
out of the following options to open the file in read mode.
i. myfile = open('student.txt','rb')
ii. myfile = open('student.txt','w')
iii. myfile = open('student.txt','r')
iv. myfile = open('student.txt')
a) only i
b) both i and iv
2
c) both iii and iv
d) both i and iii
12 Fill in the blank: 1
define rules regarding the values allowed in columns and is
the standard mechanism for enforcing database integrity.
a) Attribute
b) Constraint
c) Index
d) Commit
13 State True or False: 1
A try block in Python must always be followed by an except block.
14 What will the following expression be evaluated to in Python? 1
print(6*3 / 4**2//5-8)
(a) -10 (b) 8.0 (c) 10.0 (d) -8.0
15 The operation whose result contains all pairs of tuples from the two relations, 1
regardless of whether their attribute values match.
a) Join
b) Intersection
c) Union
d) Cartesian Product
16 To create a connection between MYSQL database and Python application 1
connect() function is used. Which of the following are mandatory arguments
required to connect any database from Python.
a) Username, Password, Hostname, Database Name, Port
b) Username, Password, Hostname
c) Username, Password, Hostname, Database Name
d) Username, Password, Hostname, Port
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):- All the keyword arguments passed must match one of the 1
arguments accepted by the function
Reasoning (R):- You cannot change the order of appearance of the keyword.
18 Assertion (A): CSV file is a human readable text file where each line has a number 1
of fields, separated by commas or some other delimiter.
Reason (R): writerow() function can be used for writing into writer object.
SECTION – B

19 Write two points of difference between Switch and Router. 2


(OR)
Write two points of difference between Web Server and Web Browser.
20 Raman has written a code to find its sum of digits of a given number passed 2
as parameter to function sumdigits(n). His code has errors. Rewrite the
correct code and underline the corrections made.
def sumdigits(n):
d=0
for x in

3
str(n):
d=d+x
return d
n=int(input(‘Enter any number”))
s=sumdigits(n)
print(“Sum of digits”,s)
21 Write a function sumcube(L) to test if an element from list L is equal to the sum of 2
the cubes of its digits i.e. it is an "Armstrong number". Print such numbers in the
list.
Example:
If L contains [67,153,311,96,370,405,371,955,407]
The function should print 153,370,371,407

(OR)
Write a function called letter_freq(my_list) that takes one parameter, a list of
strings(mylist) and returns a dictionary where the keys are the letters from mylist
and the values are the number of times that letter appears in the mylist,
Example:
If the passed list is as: wlist=list("aaaaabbbbcccdde")
then it should return a dictionary as{“a”:5,”b”:4,‟c‟:3,‟d‟:2,‟e‟:1}
22 Predict the output of the following code: 2

23 Explain the use of ‘Primary Key’ in a Relational Database Management System. 2


Give example to support your answer.
24 Differentiate between char and varchar in SQL with appropriate examples. 2
(OR)
What are different types of SQL Aggregate Functions? Give two examples.
25 Predict the output of following code: 2

SECTION – C

4
26 Deduce the output of the following python code: 3

27 A vegetable store “Fresh Stock” maintains the inventory using a SQL table. The table
is given below for your view.

I. Name the column that can be suitable as a primary key. Justify.


II. Write a query to delete a column QTY from the above table.
III. Write a query to add a column price and by default the price should be 20.
28 Write a function countwords() in Python that counts the number of words 3
containing digits in it present in a text file “myfile.txt”.
Example: If the “myfile.txt” contents are as follows:
This is my 1st class on Computer Science. There are 100 years in a Century.
Student1 is present in the front of the line.
The output of the function should be: 3
(or)
Write a function countwords() in Python, which should count the occurrences of
word ‘me’ and ‘my’ in the text file ‘myfile.txt’.
Example: If the “myfile.txt” contents are as follows:
“I will have nothing more to do with you and you are no longer my friend, no
longer my 'faithful slave,' as you call yourself!
Keep the third piece of wisdom for your own use, and let me have the gold.” The
output of the function should be: No of words ‘my’ is 2
No. of Words ‘me’ is 1

5
29 Consider the table “Employee” given below:

Based on the given table, write SQL queries for the following:
i. Increase the salary by 10% whose salary is less than 3500.
ii. Display the Ename, DeptID, Dname and Salary as “Gross Salary” of all
Employee whose location is New Delhi.
iii. Delete the record of the employee whose DeptID is 1.
30 A list contains following record of a student: [Rno, Name, Dob, Class] Write the
following user defined functions to perform given operations on the stack named
‘status’:
(i) Push_element() - To Push an record of student to the stack
(ii) Pop_element() - To Pop the objects from the stack and display them. Also,
display “Stack Empty” when there are no elements in the stack.
OR
Write a function in Python, Push(book) where, book is a dictionary containing the
details of a book in form of {bookno : price}.
The function should push the book in the stack which have price greater than 300.
Also display the count of elements pushed into the stack.
For example:
If the dictionary contains the following data:
Dbook={"Python":350,"Hindi":200,"English":270,"Physics":600, “Chemistry”:550}
The stack should contain
Chemistry Physics Python
The output should be:
The count of elements in the stack is 3
SECTION- D
31 Consider the tables STUDENT and Stream given below: 1*4=
4

6
Write SQL queries for the following:
i. Display Admission no and Stream ID from the tables STUDENT and
STREAM.
ii. Display the structure of the table STUDENT
iii. Display all the details from the table STUDENT whose class is XII.
iv. Display the name of the student whose name ends with ‘n’ and they belong
to grade XII.
32 Ranjan Kumar of class 12 is writing a program to create a CSV file “user.csv”
which will contain user name and password for some entries. He has written the
following code. As a programmer, help him to successfully execute the given task.

i. Name the module he should import in Line 1.


ii. In which mode, Ranjan should open the file to add data into the file.
iii. Fill in the blank in Line 3 to read the data from a CSV file.
iv. Fill in the blank in Line 4 to close the file.

SECTION - E
33 Teach and Learn is leading software developing company resides in Chennai as it 1*5
head office. They have four major blocks administrative office, developing block,
finance block and reception block. Their distance between the blocks is provided.

7
Shortest distance between the blocks

No of computers
• Developing block → 50
• Finance block → 70
• Administrative Office → 120
• Reception → 40

Answer the following based on the above details:

i. Suggest the most suitable location to install the main server and justify.
ii. Suggest the best cable layout for the effective network connectivity which
connects all the blocks with the server.
iii. Suggest the device to be installed in each building:
a. Modem, b. Switch
iv. The company is planning to connect with the external organization which is
located in New York, which type of network will be formed.
v. The company often communicate with video call for different reasons with
their clients at abroad. Which type of protocol is used of the above situation.

34 i. Differentiate the method read() and readlines(). 2+3


ii. Keshav is a student in CBSE school. He is assigned with a project to work on
binary file operations. Help him to accomplish the below task.
o addrecord() to create a binary file called “Student.DAT” containing
information of the student in form of list datatype.
Information to be collected Rollno, name, marks(out of 100) of each
student.
o search() to display the name and marks based on the Rollno.

(OR)

i. How text files are different from binary files.


ii. Mr. Mathew is a programmer who has recently joined the company and given
a task to write a python code to perform update operations in binary
file(Emp.dat) which contains (EmpID, Ename and Salary). Help him to
perform the below task.
8
• Addvalue() to create a binary file called “Emp.dat”and inserts the above
value as user input.
• Updatvalue() – update the salary of the employee by 2000 Rs whose
emp no is 23.

35 i. Give one point of difference between primary key and unique key. 2+3
ii. Write the following missing statements to complete the code:

Statement 1 – To open/activate the school database.


Statement 2 – To execute the command that updates the record in the table
Student.
Statement 3- To make the update in the database permanently.
Statement 4 – To terminate the connection.

(OR)

i. Give one point of difference between char(n) and varchar(n).


ii. Write the following missing statements to complete the code:

Statement 1 – To create cursor object to execute the query.


Statement 2 – To execute the query stored in the variable change.
Statement 3 – To make the changes in the database physically.
Statement 4 – which method is used to store the data in the results.

You might also like