Class: Xii (SET 1) Time Alotted: 3Hrs Subject:Computer Science (083) Maximum Marks: 70
Class: Xii (SET 1) Time Alotted: 3Hrs Subject:Computer Science (083) Maximum Marks: 70
General instructions:
This question paper contains five sections, Section A to E.
All questions are compulsory.
Section A have 18 questions carrying 01 mark each.
Section B has 07 Very Short Answer type questions carrying 02 marks each.
Section C has 05 Short Answer type questions carrying 03 marks each.
Section D has 03 Long Answer type questions carrying marks 05 each.
Section E has 02 questions carrying 04 marks each. One internal choice is given in Q34
against part C only.
All programming questions are to be answered using Python Language only.
SECTION – A
1. Consider the given expression: not ((True and False) or True) [1]
Which of the following will be correct output if the given expression is evaluated?
(A) True (B) False (C) NONE (D) NULL
3. is a non-key attribute, whose values are derived from the primary key of some other
table. [1]
(A) Primary Key (B) Candidate Key (C) Foreign Key (D) Alternate Key
4. The SELECT statement when combined with clause, returns records without
repetition. [1]
(A) DISTINCT (B) DESCRIBE (C) UNIQUE (D) NULL
5. Which of the following is not a valid python operator? [1]
a) % b) in c) # d) **
6. Select the correct output of the following python Code: [1]
str="My program is program for you"
t = str.partition("program")
print(t)
a) ('My ', 'program', ' is ', 'program', ' for you')
b) ('My ', 'program', ' is program for you')
c) ('My ', ' is program for you')
d) ('My ', ' is ', ' for you')
7. Which of the following statements is True? [1]
a) There can be only one Foreign Key in a table.
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.
8. Which of the following is used to receive emails over Internet? [1]
a) a) SMTP b) POP3 c) PPP d) VoIP 8.
9. What will be the output of the following python expression?print(2**3**2) [1]
a) 64 b) 256 c) 512 d) 32
10. What will the following code do? [1]
dict={"Exam":"AISSCE", "Year":2022}
dict.update({"Year”:2023} )
a.It will create new dictionary dict={” Year”:2023}and old dictionary will be deleted
b. It will throw an error and dictionary cannot updated
c. It will make the content of dictionary as dict={"Exam":"AISSCE", "Year":2023}
d. It will throw an error and dictionary and do nothing
12. Which of the following is not a legal method for fetching records from a database from
within aPython program? [1]
(a) fetchone() b)fetchtwo() (c) fetchall() (d) fetchmany()
13. Q13 and 14 are ASSERTION AND REASONING based questions. Mark the correct
choice as [1]
(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
13. Assertion (A):- If the arguments in a function call statement match the number and order
of arguments as defined in the function definition, such arguments are called positional
arguments.
Reasoning (R):- During a function call, the argument list first contains default argument(s)
followed by positional argument(s).
14. Assertion (A): CSV (Comma Separated Values) is a file format for data storage which
looks like atext file.
Reason (R): The information is organized with one record on each line and each field is
separatedby comma
15. say true or false : [1]
“ A dictonary key must be of a data type that is mutable
16.which statement in SQL allows to change the definition of the table is [1]
a) alter b) update c)create d) select
17. The statement which is used to get the numbers of rows fetched by execute() method of
cursor [1]
a)cursor.rowcount b) cursor.rowcount() c)cursor.allrows() d) cursor.countrows()
18. protocol provides access to command line interface on a remote computer.
(a) FTP (b) PPP (c) Telnet (d) SMTP [1]
SECTION B
19. Rewrite the following code in python after removing all the syntaxerrors. Underline
each correction done in the code. [2]
num1, num2 = 10
While num1 % num2 = 0
num1+= 20
num2+= 30
Else:
print(„hello‟)
20. Write two advantages and two disadvantages of circuit switching. [2]
21. Write two points of difference between ALTER and UPDATEcommand in SQL [2].
24. Observe the following Python code very carefully and rewrite it after removing all
syntactical errors with each correction underlined. [2]
DEF execmain():
x = input("Enter a number:") if (abs(x)== x)
print("You entered a positive number")
else:
x=*1
print("Number made positive:" x )
25. Write two differences between Coaxial and Fiber transmission media. [2]
OR
Write components of data communication.
SECTION - C
26. Write the output of the queries (i) to (vi) based on the table given below: [3]
TABLE: CHIPS
LAYS ONION 10 5
LAYS TOMATO 20 12
UNCLE CHIPS SPICY 12 10
UNCLE CHIPS PUDINA 10 12
HALDIRAM SALTY 10 20
HALDIRAM TOMATO 25 30
(i) Select BRAND_NAME, FLAVOUR from CHIPS where PRICE <> 10;
(ii) Select * from CHIPS where FLAVOUR=”TOMATO” and PRICE > 20;
(iii) Select BRAND_NAME from CHIPS where price > 15 and QUANTITY < 15;
(iv) Select count( distinct (BRAND_NAME)) from CHIPS;
27. A pre-existing text file data.txt has some words written in it. Write a pythonfunction
displaywords() that will print all the words that are having length greater than 3. [3]
Example:
For the fie content:
A man always wants to strive higher in his lifeHe
wants to be perfect.
OR
A pre-existing text file info.txt has some text written in it. Write a python function countvowel()
that reads the contents of the file and counts the occurrence of vowels(A,E,I,O,U) in the file.
28. Based on the given set of tables write answers to the following questions. [3]
Table: flights
flightid Model Company
10 747 Boeing
12 320 Airbus
15 767 Boeing
Table: Booking
Ticketno passenger source Destination quantity price Flightid
10001 ARUN BAN DEL 2 7000 10
10002 ORAM BAN KOL 3 7500 12
10003 SUMITA DEL MUM 1 6000 15
10004 ALI MUM KOL 2 5600 12
10005 GAGAN MUM DEL 4 5000 10
a) Write a query to display the passenger, source, model and price for allbookings
whose destination is KOL.
b) Identify the column acting as foreign key and the table name where it
is present in the given example.
29. A function INDEX_LIST(L), where L is the list of elements passed as argument to the
function. The function returns another list named „indexList‟ that stores the indices of all Non-
Zero Elements of L. [3]
For example:
If L contains [12,4,0,11,0,56]
The indexList will have - [0,1,3,5]
For example:
If the lists of customer details are:
[“Ashok”, “9999999999”,”Goa”]
[“Avinash”, “8888888888”,”Mumbai”]
[“Mahesh”,”77777777777”,”Cochin”]
[“Rakesh”, “66666666666”,”Goa”]
OR
Vedika has created a dictionary containing names and marks as key-value pairsof
5 students. Write a program, with separate user-defined functions to perform the following
operations:
(i) Push the keys (name of the student) of the dictionary into a stack, where the
corresponding value (marks) is greater than 70.
(ii) Pop and display the content of the stack.
32. (a) Write the output of the code given below: [5]
[b] The code given below inserts the following record in the table mobile:
import mysql.connector
mycon = mysql.connector.connect (host = “localhost”, user = “Admin”,
passwd = “Admin@123”, database = “connect”)
cursor = mycon. () # Statement 1
sql = “INSERT INTO Mobile (Name, Model, Price, Qty) VALUES (%s, %s, %s,
%s)” val = (“Samsung”, “Galaxy Pro”, 28000, 3)
cursor… (sql,val) #Statement 2
mycon. #Statement 3
Write the missing statement: Statement1 , Statement2 and Statement3
OR
(a) Predict the output of the code given below:
(b) The code given below reads the following record from the tablenamed student and
displays only those records who have marks greater than 80:
RollNo – integer Name –
string Clas – integer
Marks – integer
Note the following to establish connectivity between Python andMYSQL:
Username is root
Password is tiger
The table exists in a MYSQL database named kvs. Write the
following missing statements to complete the code: Statement 1 – to form the
cursor object
Statement 2 – to execute the query that extracts records of thosestudents whose marks are
greater than 80.
Statement 3- to read the complete result of the query (records whose marks are
greater than 80) into the object named data, from thetable studentin the database.
import pickle
def AddStudents():
_____________________# statement 1 to open the binary file to write data while
True:
Rno = int(input("Rno :"))
Name = input("Name : ")
Percent = float(input("Percent :")) L = [Rno,
Name, Percent]
__________________#statement 2 to write the list L into the file Choice =
input("enter more (y/n): ")
if Choice in "nN": break
F.close() def
GetStudents():
Total=0 Countrec=0
Countabove75=0
with open("STUDENT.DAT","rb") as F: while
True:
try:
___________________ #statement 3 to read from the file
Countrec+=1
Total+=R[2] if R[2] > 75:
print(R[1], " has percent =",R[2])
Countabove75+=1
except:
break if
Countabove75==0:
print("No student has percentage more than 75") print("average
percent of class = ", ______________________ ) #statement 4
AddStudents()
GetStudents()
(i) Which of the following commands is used to open the file “STUDENT.DAT”
for writing only in binary format? (marked as #1 in the Python code)
(ii) Which of the following commands is used to write the list L into the binary file,
STUDENT.DAT? (marked as #2 in the Python code)
(iii) Which of the following commands is used to read each record from the binary file
STUDENT.DAT? (marked as #3 in the Python code)
What expression will be placed in statement 4 to print the average percent of the class.