Professional Documents
Culture Documents
a) 3 3 3
b) 9
c) '333'
d)[3,3,3]
a) tup1=tulpe()
b) tup1=[]
c) tup1=(“abc”,”xyz”)
d) tup1=[“abc”,”xyz”]
XII/Computer Science/1
6 Write a statement in Python to declare a function CUBE that takes an integer as an 1
argument and returns the cube of the number passed as parameter to the function.
7 Predict the output of the following code: 1
Str1 = "International Games"
Str1 = Str1.split()
Stringvalue = Str1[0][0] + ". " + Str1[1][4] + ". " + Str1[1][-4]
print (Stringvalue)
8 Identify the valid identifiers from the following: 1
Average, RegNo., break, SalesQ1
9 Megha wants to display the structure of the table shop, i.e, name of the attributes and their 1
respective data types that she has used in the table. Write the query to display the same.
10 Rashmi wants to ensure that nobody should be able to enter duplicate admission number while 1
inserting values in the table school. Help her to write appropriate constraint while writing the
create statement.
11 Which command in MySQL is used to remove tuples from a relation? 1
12 Identify DDL command from the following: 1
SELECT,ALTER, UPDATE, DROP
13 Given the following dictionary declaration: 1
details={"empid":"A1001" ,"ename":"Suresh" , "department":"Planning"}
write python statement to print the message: “Suresh – Planning” using dictionary details.
14 Rajan wants to import modules in his python code.Help him by telling two ways in 1
which he can do so.
15 Given String STR=”Examination”, choose the correct option(s) to print the substring 1
“min”
a) STR[3:6]
b) STR[3:6:-1]
c) STR[-8:-5:0]
d) STR[-8:-5:-1]
16 Amit wants to change the price of a book he has entered in store table.Identify the MySQL 1
command that will help him to perform the same.
a) insert
b) update
c) alter
d) none of the above
17 Which type of value does input() return? 1
a) Boolean
b) String
c) Int
d) Float
18 A list is given as SNO=[5,7,15,20,35,45] ,What will be the output of SNO[:2] + SNO[2:] 1
19 Write a statement to generate random integer number in the range 15 to 35(including both). 1
20 What will the following function print when called? 1
def addEm(x,y,z):
return x+y+z
print (x+y+z)
sum1=addEm(5,6,7)
XII/Computer Science/2
21 Identify the global variables from the following code: 1
x=5
def func(a):
b=a+1
return b
y=input("enter number")
z=y+func(x)
print(z)
Section-II
Both the case study-based questions are compulsory. Attempt any 4 sub parts from each
question. Each question carries 1 mark
22 Consider the following relation BOOK and answer the queries that follows: 4
SNO TITLE AUTHOR SUBJECT PUBLISHER QTY PRICE
1 DATA LIPSCHUTE DS McGraw 4 217.00
STRUCTURE
2 TURBO C++ ROBERT PROG GALGOTIA 5 270.00
LAFORE
3 DBASE PALMER DBMS PUSTAK 7 130.00
DUMMIES MAHAL
4 GUIDE FREED NET ZPRESS 3 200.00
NETWORK
5 BASIC FOR NORTON PROG BPB 3 40.00
BEGINEERS
6 MASTERING COWART OS BPB 1 225.00
WINDOWS
(a) To display the title of all books with PRICE between 100 and 300. 1
(b) To display TITLE and AUTHOR of the books having subject PROG and published by 1
BPB.
(c) To display list of all the books with price more than 130 in ascending order of QTY. 1
(d) To display average price of books published by BPB. 1
(e) To display maximum price of the book from the relation. 1
23 Rishi has written the following code in python. As a programmer, you have to help him to 4
successfully execute the program.
d=add()
print("In main:", d) # statement 5
XII/Computer Science/3
(a) Name the module to be imported in Statement-1. 1
(b) Write the keyword used to declare the function in Statement-2. 1
Part – B
Section-I
24 Consider the following nested list definition and then answer the questions based on it. 2
Data = [20, [“XYZ”, [20,30], [20.5, 'Summer', 'Collection']]]
(a) Write the print statement that will print the letter 'C' from 'Collection'.
(b) Write the print statement to print the list [20,30] from the given list.
25 Consider the table given below and write queries based on this table. 2
Table : Course
27 What are the two different ways by which an element can be removed from a list?Explain with 2
the help of suitable example.
28 Rewrite the following code in Python after removing all error(s). Underline each 2
correction done in the code.
XII/Computer Science/4
29 What are the possible output(s) of the following code? Also specify the maximum and 2
minimum values that can be assigned to variable chance.
import random
chance = random.randint(0,3)
fruits= ["Apple", "Mango", "Banana","Kiwi"]
for x in fruits:
for y in range(0, chance,2):
print (x[y],end = "#")
print()
31 Raman is confused when he should use break or continue statements of python. Explain the 2
usage of the two with the help of an example.
32 What is the difference between Count(*) and Count() in MYSQL? Give an example for each. 2
def convert(string):
newstr = ""
for i in string:
if i.isnumeric():
newstr = newstr + str(int(i)+1)
elif i.isupper():
newstr = newstr + chr(ord(i)+1)
else:
newstr = newstr + i
print("The new string is :",newstr)
convert(" 2 INDIA is MY Country")
Section- II
34 What are the different ways in which arguments can be passed to a function?Explain any 3
two with the help of an example.
XII/Computer Science/5
36 Write a function vowels () in Python, to count the number of vowels present in the string 3
entered by the user and passed as argument to the function.
37 Write a Python program to get a string made of the first 2 and the last 2 characters from a 3
given string. If the string length is less than 2, then display empty string.
Sample String : 'Board Examination'
Expected Result : 'Boon'
Sample String : 'An'
Expected Result : 'AnAn'
Sample String : ' i'
Expected Result : Empty String
Section III
38 In a Bank’s database, there are two tables ‘Customer’ and ‘Bank’ as shown 5
below.
Customer
Acc_No Cust_Name Cust_City Open_Bal
2101001 Aditya New Delhi 10000
2201002 Nayan Amritsar 15000
2301003 Amar Nagpur 15000
2401004 Anoushka New Delhi 10000
Bank
Trans_Id Acc_No Transaction_Type Amount
Tr001 2301003 Deposit 15000
Tr002 2201002 Withdraw 20000
Tr003 2101001 Deposit 3500
Tr004 2301004 Deposit 26000
Tr005 2301003 Withdraw 24000
With reference to the above given tables, write commands in MYSQL for (a) – (e)
(a) Write a query to display names of customers who have deposited the money.
(b) Write a query to display customer’s name along with their transaction details.
(c) Write a query to display customer’s name whose city is “New Delhi”.
39 Consider the following table Institute. Write commands in MYSQL for (a) to (d) and output 5
for (e) and (f)
Institute
Course_Code Professor_ID BranchName CourseFees
102 P0021 CS-JAVA 40000
103 P0022 Computer Graphics 16000
104 P0021 Internet Security 8000
105 NULL Machine Learning 15000
106 P0026 Networking 20000
107 NULL APP development 26000
(a) To display names of those branches whose fees is greater than 15000.
XII/Computer Science/6
(b) To display number of branches taught by each professor.
(c) To increase the fees of all courses by 500 for courses where professor is not allotted.
(d) To display details of those Branches which start with “C”.
(e) Select COUNT(DISTINCT (Professor_ID)) from Institute;
(f) Select MAX(CourseFees) from Institute where Fees between 16000 to 50000;
40 Consider the following code and answer the questions that follow: 5
Book={1:'Thriller', 2:'Mystery', 3:'Crime', 4:'Children Stories'}
Library ={'5':'Madras Diaries','6':'Malgudi Days'}
a) Ramesh needs to change the title in the dictionary book from ‘Crime’ to ‘Crime
Thriller’. Help him by writing command for this.
b) What will be the output of the following line of code:
print(list(Library))
c) What will be the result of following statements:
print( 2 in Book)
print(‘Madras Diaries’ in Library)
d) With reference to the above declared dictionaries:
e)Write the statement(s) to modify the dictionary Book by appending the contents of
dictionary Library to it.
XII/Computer Science/7