0% found this document useful (0 votes)
70 views9 pages

Class: Xii (SET 1) Time Alotted: 3Hrs Subject:Computer Science (083) Maximum Marks: 70

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)
70 views9 pages

Class: Xii (SET 1) Time Alotted: 3Hrs Subject:Computer Science (083) Maximum Marks: 70

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/ 9

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

2. Which functions is used to close a file in python? [1]


(A) close (B) cloose() (C) Close() (D) close()

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

11. The correct syntax of seek()is: [1]


(a) file_object.seek(offset [, reference_point]) (b) seek(offset [,reference_point])
(c) seek(offset, file_object) (d)seek.file_object(offset)

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].

22. Write the full forms of the following: [2]


(i) FTP (ii) HTTPS
or
(b) Name the protocols which are used for sending and receivingemails?
23. What do you understand by the terms PRIMARY KEY and UNIQUEKEY of a relation
in relational database? [2]
OR
Categorize the following commands as DDL or DML: DROP,DELETE, SELECT,
ALTER

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

BRAND_NAME FLAVOUR PRICE QUNATITY

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.

The output after executing displayword() will be:


Always wants strive higher life wants 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]

30. A list contains following record of a customer: [3]


[Customer_name, Phone_number, City]
Write the following user defined functions to perform given operations on the stack
named „status‟:
(i) Push_element() - To Push an object containing name and Phone number of
customers who live in Goa 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.

For example:
If the lists of customer details are:

[“Ashok”, “9999999999”,”Goa”]
[“Avinash”, “8888888888”,”Mumbai”]
[“Mahesh”,”77777777777”,”Cochin”]
[“Rakesh”, “66666666666”,”Goa”]

The stack should contain:


[“Rakesh”,”66666666666”]
[“Ashok”,” 99999999999”]
The output should be:
[“Ashok”,”99999999999”]
Stack Empty

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.

The dictionary should be as follows:

d={“Ramesh”:58, “Umesh”:78, “Vishal”:90, “Khushi”:60, “Ishika”:95}

Then the output will be:


Umesh Vishal Ishika
SECTION D
31. Trine Tech Corporation (TTC) is a professional consultancy company. The company is
planning to set up their new offices in India with its hub at Hyderabad. As a network adviser,
you have to understand their requirement and suggest them the best available solutions. Their
queries are mentioned as (i) to (v) below. [5]
a) Which will be the most appropriate block, where TTC 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, you will suggest to
connect the new setup of offices in Bengalore with its London based office.
● Satellite Link
● Infrared
● Ethernet
d) Which of the following device will be suggested by you to connect each computer in
each of the buildings?
● Switch
● Modem
● Gateway
Company is planning to connect its offices in Hyderabad which is less than 1 km. Which type of
network will be formed?

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.

33. import mysql.connector as mysql [5]


def sql_data():
con1=mysql.connect(host="localhost",user="root",passwo rd="tiger", database="school")
mycursor= #Statement 1
print("Students with marks greater than 75 are : ")
----------------------------------- #Statement 2
data= #Statement 3
for i in data:
print(i)
SECTION E
34. Mayank creates a table RESULT with a set of records to maintain the marks secured by
students in sub1, sub2, sub3 and their GRADE. After creation of the table, he has entered
data of 7 students in the table. [4]
Table : RESULT
ROLL_ SNAME sub1 sub2 sub3 GRAD
NO E
101 KIRAN 366 410 402 I
102 NAYAN 300 350 325 I
103 ISHIKA 400 410 415 I
104 RENU 350 357 415 I
105 ARPITA 100 75 178 IV
106 SABRINA 100 205 217 II
107 NEELIMA 470 450 471 I
103 ISHIKA 400 410 415 I

Based on the data given above answer the following questions:


(i) Identify the most appropriate column, which can be considered as
Primary key.
(ii) If two columns are added and 2 rows are deleted from the table result,
what will be the new degree and cardinality of the above table?
(iii) Write the statements to:
a. Insert the following record into the table
Roll No- 108, Name- Aaditi, sub1- 470, sub2-444, sub3- 475, Grade– I.
b. Increase the sub2 marks of the students by 3% whose name
begins with „N‟.
OR (Option for part iii only)
(iii) Write the statements to:
a. Delete the record of students securing Grade-IV.
b. Add a column REMARKS in the table with datatype as varcharwith 50 characters.
35. Reshabh is a programmer, who has recently been given a task to write a python code to
perform the following binary file operations with the help of two user defined [4]
functions/modules:
a. AddStudents() to create a binary file called STUDENT.DAT containingstudent
information – roll number, name and marks (out of 100) of each student.
b. GetStudents() to display the name and percentage of those students who have a
percentage greater than 75. In case there is no student having percentage > 75 the function
displays an appropriate message. The function should also display the average percent.
He has succeeded in writing partial code and has missed out certain statements, so he has
left certain queries in comment lines. You as an expert of Python have to provide the
missing statements and other related queries based on the following code of Reshabh.

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.

You might also like