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

Grade-12 Re-4 QP

This document is a revision exam paper for Grade XII Computer Science, consisting of multiple-choice questions, coding exercises, and SQL queries. It covers various topics including Python programming, data structures, file handling, and database management. The exam is structured into sections with a total of 70 marks and includes both theoretical and practical questions.

Uploaded by

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

Grade-12 Re-4 QP

This document is a revision exam paper for Grade XII Computer Science, consisting of multiple-choice questions, coding exercises, and SQL queries. It covers various topics including Python programming, data structures, file handling, and database management. The exam is structured into sections with a total of 70 marks and includes both theoretical and practical questions.

Uploaded by

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

SRI AMBAL THULASI PUBLIC SCHOOL, ANNUR

GRADE : XII REVISION EXAM-4 MAX. MARKS : 70


SUBJECT : COMPUTER SCIENCE(083) DATE: TIME : 3 HOURS
Q.NO SECTION – A MARKS
(21*1=21)
1) State True or False 1
“A tuple is an Editable data store”.
2) Which comments start with # symbol? 1
(a) Double line (b) Multi-line (c) Single line (d) All of these
3) What is the output of the following code? 1
>>> a = 10
>>> b = 2
>>> print (“Output, is”, (a + 10 * 2 + b))
(a) Output is 22 (b) Output is 32 c) Output is None d) None of these
4) Give the output for the following program segment given below. 1
for i in range (-5,-7,-1):
print (i + 1,end=’ ‘)
(a) -6-5 (b) -5-6 c) -4-5 (d) Error
5) The ………. mode opens a file for both reading and writing. 1
(a) wr (b) rw c) r+ (d) a+
6) Which of the following will be the output of the statement given below? [1] 1
print([12,34,56,78,90] . pop( ))
(a) 78 (b) 90 (c) 12 (d) 12,34,56,78,90
7) Identify the output of the following code snippet: 1
text=”PYTHONPROGRAM”
text=text.replace(‘PY’,’#’)
print(text)
a) #THONPROGRAM b) ##THON#ROGRAM
c) #THON#ROGRAM d) #YTHON#ROGRAM
8) Which of the following expressions evaluates to False? 1
a) not(True) and False b) True or False
c) not(False and True) d) True and not(False)
9) What will be the output of the following code: 1
tuple1 = (1, 2, 3)
tuple2 = tuple1
tuple1 += (4,)
print(tuple1 == tuple2)
a) True b) False c) tuple1 d) Error
10) If my_dict is a dictionary as defined below, then which of the following statements 1
will raise an exception? my_dict = {'apple': 10, 'banana': 20, 'orange': 30}
(A) my_dict.get('orange') (B) print(my_dict['apple', 'banana'])
(C) my_dict['apple']=20 (D) print(str(my_dict))
11) What does the list.remove(x) method do in Python? 1
(A) Removes the element at index x from the list
(B) Removes the first occurrence of value x from the list
(C) Removes all occurrences of value x from the list
(D) Removes the last occurrence of value x from the list
12) Write the missing statement to complete the following code: 1
file = open("example.txt", "r")
data = file.read(100) ____________________ #Move the file pointer to the
beginning of the file
next_data = file.read(50)
file.close()
13) State whether the following statement is True or False: The finally block in Python is 1
executed only if no exception occurs in the try block.
14) What will be the output of the following code? 1
c = 10
def add():
global c
c=c+2
print(c, end='#')
add()
c=15
print(c, end='%')
(A) 12%15# (B) 15#12% (C) 12#15% (D) 12%15#
15) Which SQL command(s) can change the cardinality of an existing relation? 1
16) In which data type the value stored is padded with spaces to fit the specified length. 1
(A) DATE (B) VARCHAR (C) FLOAT (D) CHAR
17) Which protocol is used to transfer files over the Internet? 1
(A) HTTP (B) FTP (C) PPP (D) HTTPS
18) Which switching technique breaks data into smaller packets for transmission, 1
allowing multiple packets to share the same network resources.
19) Which network device is used to connect two networks that use different protocols? 1
(A) Modem (B) Gateway (C) Switch (D) Repeater
20) Assertion (A) To use the randint() function, the random module needs to be included 1
in the program.
Reason (R) Some functions are present in modules and to use them the respective
module needs to be imported.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.
21) Assertion (A) The contents of a Binary file are not directly interpretable. 1
Reason (R) Modes in which binary files can be opened are suffixed with ‘b’ like :
rb/wb etc.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.
SECTION – B 7*2=14
22) (i) Expand the following. 2
PAN, SMTP
(ii) Name the term defined by given below statement.
“ A group of computers connected to each other by a link”.
23) Find the error(s). 2

24) Observe the code and write the output: 2


t = ‘HELLO’
t1 = tuple(t)
print(t1)
print(t1[1:3])
25) Identify the correct output(s) of the following code. Also write the minimum and the 2
maximum possible values of the variable b.
import random
a="Wisdom"
b=random.randint(1,6)
for i in range(0,b,2):
print(a[i],end='#')
a) W# b) W#i# c) W#s# d) W#i#s#
26) (i) To Convert a string variable "S" sentence to lowercase. 2
(Example: S="India@12$3")
(ii) To Remove a key 'Apple' from a dictionary.
(Example: d={'O':45,"M":32,",67:"G","Apple":34})
27) Consider the following two commands with reference to a table, named Employee 2
having a column named Department.
(a) SELECT COUNT(DEPT) FROM EMPLOYEE;
(b) SELECT COUNT(*) FROM EMPLOYEE;
If these two commands are producing different results,
(i) What may be the possible reason?
(ii) Which command (a) or (b) might be giving a higher value?
28) Identify the following devices : 2
(i) I am a networking device used to connect multiple computers. I send data to
intended node only.
(ii) If a node from one network wants to connect to another (foreign) network it will
pass the data packet through me
SECTION - C 3*3=9
29) A) Write a Python function that displays all the words containing @cmail from a text 3
file "Emails.txt".
OR
B) Write a Python function that finds and displays all the words longer than 5
characters from a text file "Words.txt".
30) A) You have a stack named BooksStack that contains records of books. Each book 3
record is represented as a list containing book_title, author_name, and
publication_year.
Write the following user-defined functions in Python to perform the specified
operations on the stack BooksStack:
(I)push_book(BooksStack, new_book): This function takes the stack BooksStack and
a new book record new_book as arguments and pushes the new book record onto the
stack.
(II)pop_book(BooksStack): This function pops the topmost book record from the
stack and returns it. If the stack is already empty, the function should display
"Underflow".
(III)peep(BookStack): This function displays the topmost element of the stack
without deleting it. If the stack is empty, the function should display 'None'.
OR
(B) Write the definition of a user-defined function `push_even(N)` which accepts a
list of integers in a parameter `N` and pushes all those integers which are even from
the list `N` into a Stack named `EvenNumbers`.
Write function pop_even() to pop the topmost number from the stack and returns it. If
the stack is already empty, the function should display "Empty".
Write function Disp_even() to display all element of the stack without deleting them.
If the stack is empty, the function should display 'None'.
For example:
If the integers input into the list `VALUES` are:
[10, 5, 8, 3, 12]
Then the stack `EvenNumbers` should store:
[10, 8, 12]
31) Predict the output of the following code: 3
d = {"apple": 15, "banana": 7, "cherry": 9}
str1 = ""
for key in d:
str1 = str1 + str(d[key]) + "@" + “\n”
str2 = str1[:-1]
print(str2)
OR
Predict the output of the following code:
line=[4,9,12,6,20]
for i in line:
for j in range(1,i%5):
print(j,’#’,end=””)
print()
SECTION - D 4*4=16
32) Consider the table ORDERS as given below 4

Note: The table contains many more records than shown here.
A) Write the following queries:
(I)To display the total Quantity for each Product, excluding Products with total
Quantity less than 5.
(II)To display the orders table sorted by total price in descending order.
(III)To display the distinct customer names from the Orders table.
(IV)Display the sum of Price of all the orders for which the quantity is null.
33) Consider the table ORDERS as given below 4

Note: The table contains many more records than shown here.
B) Write the output
(I) Select c_name, sum(quantity) as total_quantity from orders group by c_name;
(II) Select * from orders where product like '%phone%';
(III) Select o_id, c_name, product, quantity, price from orders where price between
1500 and 12000;
(IV) Select max(price) from orders;
34) A csv file "Happiness.csv" contains the data of a survey. Each record of the file
contains the following data:
●Name of a country
●Population of the country
●Sample Size (Number of persons who participated in the survey in that country)
●Happy (Number of persons who accepted that they were Happy)
For example, a sample record of the file may be:
[‘Signiland’, 5673000, 5000, 3426]
Write the following Python functions to perform the specified operations on this file:
(I)Read all the data from the file in the form of a list and display all those records for
which the population is more than 5000000.
(II)Count the number of records in the file.
35) A table, named STATIONERY, in ITEMDB database, has the following structure:

Write the following Python function to perform the specified operation:


AddAndDisplay(): To input details of an item and store it in the table
STATIONERY. The function should then retrieve and display all records from the
STATIONERY table where the Price is greater than 120.
Assume the following for Python-Database connectivity: Host: localhost, User: root,
Password: Pencil
SECTION - E 2*5=10
36) Saman has been entrusted with the management of Law University Database. He
needs to access some information from FACULTY and COURSES tables for a
survey analysis. Help him extract the following information by writing the desired
SQL queries as mentioned below.

(I) To display complete details (from both the tables) of those Faculties whose salary
is less than 12000.
(II) To display the details of courses whose fees is in the range of 20000 to 50000
(both values included).
(III) To increase the fees of all courses by 500 which have "Computer" in their
Course names.
(IV) (A) To display names (FName and LName) of faculty taking System Design.
(B) To display the Cartesian Product of these two tables.
Or
Event Horizon Enterprises is an event planning organization. It is planning to set up
its India campus in Mumbai with its head office in Delhi. The Mumbai campus will
have four blocks/buildings - ADMIN, FOOD, MEDIA, DECORATORS. You, as a
network expert, need to suggest the best network-related solutions for them to resolve
the issues/problems mentioned in points (I) to (V), keeping in mind the distances
between various blocks/buildings and other given parameters.
Distance of Delhi Head Office from Mumbai Campus = 1500 km
Number of computers in each of the blocks/Center is as follows:

(I)Suggest the most appropriate location of the server inside the MUMBAI campus.
Justify your choice.
(II)Which hardware device will you suggest to connect all the computers within each
building?
(III)Draw the cable layout to efficiently connect various buildings within the
MUMBAI campus. Which cable would you suggest for the most efficient data
transfer over the network?
(IV)Is there a requirement of a repeater in the given cable layout? Why/ Why not?
(V) A) What would be your recommendation for enabling live visual communication
between the Admin Office at the Mumbai campus and the DELHI Head Office from
the following options:
a) Video Conferencing b) Email c) Telephony d) Instant Messaging
OR
B) What type of network (PAN, LAN, MAN, or WAN) will be set up among the
computers connected in the MUMBAI campus?
37) Surya is a manager working in a recruitment agency. He needs to manage the records
of various candidates. For this, he wants the following information of each candidate
to be stored:
- Candidate_ID – integer
- Candidate_Name – string
- Designation – string
- Experience – float
You, as a programmer of the company, have been assigned to do this job for Surya.
(I) Write a function to input the data of a candidate and append it in a binary file.
(II) Write a function to update the data of candidates whose experience is more than
10 years and change their designation to "Senior Manager".
(III) Write a function to read the data from the binary file and display the data of all
those candidates who are not "Senior Manager".
S.NO SECTION – A MARKS
(21*1=21)
1) State True or False 1
“A tuple is an Editable data store”. False
2) Which comments start with # symbol? 1
(a) Double line (b) Multi-line (c) Single line (d) All of these
3) What is the output of the following code? 1
>>> a = 10
>>> b = 2
>>> print (“Output, is”, (a + 10 * 2 + b))
(a) Output is 22 (b) Output is 32 c) Output is None d) None of these
4) Give the output for the following program segment given below. 1
for i in range (-5,-7,-1):
print (i + 1,end=’ ‘)
(a) -6-5 (b) -5-6 c) -4-5 (d) Error
5) The ………. mode opens a file for both reading and writing. 1
(a) wr (b) rw c) r+ (d) a+
6) Which of the following will be the output of the statement given below? [1] 1
print([12,34,56,78,90] . pop( ))
(a) 78 (b) 90 (c) 12 (d) 12,34,56,78,90
7) Identify the output of the following code snippet: 1
text=”PYTHONPROGRAM”
text=text.replace(‘PY’,’#’)
print(text)
a) #THONPROGRAM b) ##THON#ROGRAM
c) #THON#ROGRAM d) #YTHON#ROGRAM
8) Which of the following expressions evaluates to False? 1
a) not(True) and False b) True or False
c) not(False and True) d) True and not(False)
9) What will be the output of the following code: 1
tuple1 = (1, 2, 3)
tuple2 = tuple1
tuple1 += (4,)
print(tuple1 == tuple2)
a) True b) False c) tuple1 d) Error
10) If my_dict is a dictionary as defined below, then which of the following 1
statements will raise an exception? my_dict = {'apple': 10, 'banana': 20, 'orange':
30}
(A) my_dict.get('orange') (B) print(my_dict['apple', 'banana'])
(C) my_dict['apple']=20 (D) print(str(my_dict))
11) What does the list.remove(x) method do in Python? 1
(A) Removes the element at index x from the list
(B) Removes the first occurrence of value x from the list
(C) Removes all occurrences of value x from the list
(D) Removes the last occurrence of value x from the list
12) Answer: file.seek(0) ( OR file.seek(0,0) ) 1
13) State whether the following statement is True or False: The finally block in 1
Python is executed only if no exception occurs in the try block. False
14) What will be the output of the following code? 1
c = 10
def add():
global c
c=c+2
print(c, end='#')
add()
c=15
print(c, end='%')
(A) 12%15# (B) 15#12% (C) 12#15% (D) 12%15#
15) insert, delete 1
16) In which data type the value stored is padded with spaces to fit the specified 1
length.
(A) DATE (B) VARCHAR (C) FLOAT (D) CHAR
17) Which protocol is used to transfer files over the Internet? 1
(A) HTTP (B) FTP (C) PPP (D) HTTPS
18) Which switching technique breaks data into smaller packets for transmission, 1
allowing multiple packets to share the same network resources. Packet
Switching
19) Which network device is used to connect two networks that use different 1
protocols?
(A) Modem (B) Gateway (C) Switch (D) Repeater
20) Assertion (A) To use the randint() function, the random module needs to be 1
included in the program. [1]
Reason (R) Some functions are present in modules and to use them the respective
module needs to be imported.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.
21) Assertion (A) The contents of a Binary file are not directly interpretable. [1]
Reason (R) Modes in which binary files can be opened are suffixed with ‘b’ like :
rb/wb etc.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.
SECTION – B 7*2=14
22) (i) PAN Personal Area Network 2
SMTP Simple Mail Transfer Protocol
(ii) Computer network is defined as a group of computers connected to each other
by a link.
23) Error 1 L2 = L1 + 2 because + operator cannot add list with other type as number 2
or string.
Error 2 L = L1.pop(7) parentheses puts index value instead of element. In the
given list, maximum index value is 3 and 7 is out of index range.
24) (‘H’,’E’,’L’,’L’,’O’) (‘E’,’L’) 2
25) (A), (C) 2
(½ x 2 = 1 Mark)
Minimum and maximum possible values of the variable b: 1,6
(½ x 2 = 1 Mark)
26) 2
27) 2
28) 2
SECTION - C 3*3=9
29)
30) 2
31) 2
32) 2

33) (A)(I) select Product, sum(Quantity) from orders group by product having 4
sum(Quantity)>=5;
(II) select * from orders order by Price desc;
(III) select distinct C_Name from orders;
(IV) select sum(price) as total_price from orders where Quantity IS NULL;
(4 x 1 mark for each correct query)
34) 4

You might also like