100% found this document useful (1 vote)
375 views7 pages

Question Bank - Full Course Final Examination Jan 2025

Ip

Uploaded by

Yashika Jain
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
100% found this document useful (1 vote)
375 views7 pages

Question Bank - Full Course Final Examination Jan 2025

Ip

Uploaded by

Yashika Jain
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/ 7

SACRED HEART SR. SEC. SCHOOL, B.R.

S NAGAR, LUDHIANA
INFORMATICS PRACTICES – CLASS XI
QUESTION BANK FOR FINAL EXAMINATION – JANUARY 2025

PYTHON
1. Write coding statements for the following:
a) Check whether substring ‘put’ occurs in string ‘putting’
b) Check whether value 10 occurs in list L
c) Check whether value 23.5 occurs in a tuple T. Display “yes” if it does and “no” if it does not.
d) A loop to display all values in list L one by one.
e) Considering a list L that contains [23,12,6,4,8,14,9] display the double of even numbers from it.
2. What will be the output of the following statements?
a) print(25 in [1,6,3,2])
b) print(True in [1,2,3,4])
c) print(False in [0,3,2,1])
d) print(‘Sad’ not in ‘Sadness’)
e) print('‘sad’ in ‘Sadness’)
f) if 12 not in (10,56,12,3):
print(“yes”)
else:
print(“no”)
g) print(‘abc’ not in [3,5,True,2.4,’xyz’))
h) for x in ‘super’:
print(x, end = “@”)
i) for ch in ‘tumult’:
if ch != ‘u’:
print(ch, sep = ‘:’)
j) List1 = [2,5,8,11,12]
for T in List1:
print(T*2)
k) P = (2,15,7,18,1,9)
for A in P:
if A%3 == 0:
print(A)
l) S = “Assignment 24-08-2024”
for x in S:
if x > =‘0’ and x<= ‘9’:
print(x, “ is a digit”)
3. Consider the following code snippets and predict their output:
i)
a=7
b = 14
c = 21
if a < b and b < c:
if c % b == 0:
result = "Divisible"
else:
result = "Not divisible"
elif a == b:
result = "Equal"
else:
result = "None of the above"
print(result)
ii)
x=3
y=6
z=9
if x < y:
if y < z:
if z % x == 0:
print("Condition A")
else:
print("Condition B")
else:
print("Condition C")
else:
print("Condition D")
iii)
x=2
y=4
z=6
if x < y and y < z:
if x != 2 or z > 5:
print("Pass")
else:
print("Fail")
else:
print("Out of range")
iv)
a = 10
b = 20
c = 30
if (a < b and b < c) or (a == 10 and c > 25):
print("Valid")
else:
print("Invalid")

4. Evaluate the following logical expressions, using the value of the given variables, indicating sequence of steps
required.
a = 12, b = 4, c = 7, d =3 , e = 5
i) d+e*b < (c+d)*12 or not( a-c != e) and c-d !=b
ii) c/b <= d or not( b+d*c > a//d) and a%c == c-b**2
iii) c-b != a//d and (a+c)/e == d or b+c*d != d*d and not(a%b == d)
5. What will be the values generated as a result of the following range() functions.
a) A = list((range(30,-5,-8))
b) B = list(range(1,10,3))
6. Write the output of the following codes:
a)
X,Y = 1,15
while(X<=Y):
print(X+Y,end =”#“)
X+=1
Y-=2
b)
for a in range(1,15,3):
print(a, end = “ “)

d) for x in range(100,10,-10):
print(x*x, sep = ‘,’)
e) c= 1
for ch in ‘tumult’:
if ch == ‘u’:
c = c+1
print(ch, sep = ‘:’)
print(c)
f)
a=0
while a<100:
a+=2
print(a)
g)
for x in range(2,-5,-1):
print(x, end = ‘,’)
h)
a,b = 1, 10
while a<10:
if (a+b)%2 == 1:
print(a*b)
a=a+1
b=b-2

k) S = “Good”
L = [“a”,3,4.5]
print(“S”*3)
print(L*2)
print(L+[10,20])
print(S+L)
l) for a in (2,11,12,50,23):
if a%5==0:
break
else:
print(a%5)
m) S = “Good”
L = list(range(10,50,5))
print(L)
L[1:4] = [‘abc’, ‘xyz’]
print(L)
S[0:2] – “Fo”
print(S)
7. Rewrite the following code using for loop.
A=1
while A<=100:
print(A)
A = A+5
8. Rewrite following code using while loop
P=1
for x in range(11, 1, -1):
P = P*x
print(P)
9. Write two different statements to create an empty list.
10. Write a code to accept starting no, ending no, and the difference and create a list with the generated
numbers using the range() function.
11. What is a sequence and name three types of sequences in Python
12. What is meant by immutable and mutable properties of strings and lists? Explain with the help of an
example.
13. Given the following list, write the output of the given statements:
L = [109.25, 17,'Extreme', 67, True, 'Mystery', 1, 20, False,25, 56]
print(L[2:8:2])
print(L[2:])
print(L[:])
print(L[5:1:-3])
print(L[7:3:-2])
print(L[ : : -1])
print(L[-2:3])
print(L[-3:3:-1])
print(L[-1:4:-2])
print(L[ :3])
14. Write outputs of the following Python statements considering the given sequence:
S = 'ABCDEFGHIJKLMNOP'
print(S[1:5])
print(S[6:2:-2])
print(S[5:12:2])
print(S[-3:-7:-1])
print(S[-14:-9:1])
print(S[-4:8])
print(S[-4:8:-3])

15. Write the output of the following Python codes.


a)
L = [1, 3, 5, 7, 9]
S=0
for X in L:
S = S+X
print(S)
b)
S = “ExaMination 2023”
a=b=0
for ch in S:
if ch in ‘0123456789’:
break
elif ch >= ‘a’ and ch<= ‘z’:
a = a+1
elif ch >= ‘A’ and ch<= ‘Z’:
b = b+1
print(a,b,sep = “@”)
c)
S = “Prism”
L = list(S)
print(L)
d) List = [10,20,30,40]
List[2:] = [ List[0]*10, List[1] * 20 ]
print(List)
16. What will be the output of the following codes?
a) L1 = [10,-3,2]
L2 = [‘a’,1,9]
L3 = L2+L1
print(L3)
L1.append(L2)
print(L1)
L2.extend(L1)
print(L2)
L3 = L2*2
print(L3)
b) L1 = [9,3,[10,17],1,4,5]
L1.reverse()
print(L1)
c) L1 = [‘ac’,’AC’,’Bc’,’CB’,’bc’,’cb’]
L1.sort(reverse = True)
print(L1)
d) S = “It takes two to Tango”
print(S[-4:-9:-1]) ; print(S[5:-12]) ; print(S[-10:8:-1]) ; print(S[4:15:3])
print(S[:5]) ; print(S[16:])
e) L = [4,2,[2,4,2,1],0,2]
print(L.count(2))
f) L = [4,2,-1,0,12]
print(min(L))
print(max(L))
print(sum(L))
g) L = [40,12,['Mango',2,'Pear'],10,25]
print(L[2][2][1:])
L.reverse() ; print(L)
h) d = {1:"Mango",2:"Pear",3:"Banana"}
print(d.keys()) ; print(d.values())
d[3] = “Grapes” ; d[4]= “Melon”
print(d)
d1 = {2:200,5:500,4:400}
d.update(d1) ; print(d)
d1.update(d) ; print(d1)
i) d = {"Mango":200,"Pear":150,"Oranges":125,"Red Grapes":250}
for a,b in d.items():
print(“Price of”, a ,”is Rs. ”, b,”per Kg”)
j) d = {"Mango":200,"Pear":150,"Oranges":125,"Red Grapes":250}
print(“Apple” in d) ; print(“mango” in d) ; print(“Pear” in d) ; print(“Apple” not in d)
k) L1 = [1, 1.33, 'GFG', 0, 'NO', None, 'G', True]
val1, val2 = 0, ' '
for x in L1:
if(type(x) == int or type(x) == float):
val1 += x
elif(type(x) == str):
val2 += x
else:
break
print(val1, val2)
17. Write statements for the following:
a) Considering a list L, write a statement to delete value 500 from it.
b) Considering a list L, write a statement to delete the value at index position 5 from it using
a function.
c) Considering a list L, write a statement to delete the last value in it.
d) Considering a dictionary D, write statements to accept a key and delete its value from the
dictionary.
e) Considering a list L, write a statement to remove it from memory.
f) Considering a dictionary D, write a statement to remove all its values.
g) Considering a dictionary D, write a statement to access a value of Key “A” from it and also display an appropriate
message if the key is not found.
h) Considering a dictionary D, write a statement to increase salary of employee with ID ‘A101’ by 2000. ID is the key
in the dictionary.
i) Considering a list L, write a statement to add value “Delhi” at index position 10 in it.
4. Given a list L1 = [3, 5.5, 12, 5.6, [2,3,1,5], 42]

a) Which list slice will return [[2,3,1,5], 42]


b) Which list slice will return [42, [2,3,1,5], 5.6, 12, 5.5, 3]
c) Which list slice will return [[5, 1, 3, 2]]
d) Which list slice will return [3, 5.5, 12]
18. WAP to create the following dictionary where books id is the key and the book name is the value.
B101 Digital fortress
B108 The Firm
B198 Inferno
19. WAP to accept values for a list and create a new list that contains only string values from the user-defined list.
20. WAP to accept keys and values for a dictionary to store student names(keys) and mobile numbers(values). Then
take the name of any student from the user and after displaying his/her mobile number, delete that pair.
21. WAP to accept values in a list and swap the first half of the list with second half. For example, if the given list is
[1,2,3,4,5,6,7,8] , then after swapping the list should be [5,6,7,8,1,2,3,4]. And if the given list is [1,2,3,4,5,6,7] then
The list after swapping should be [5,6,7,4,1,2,3]
MYSQL
I. Write the SQL statement to create Item table to store following columns. Name of the Item, Item code,
Price of the item, Description of the Item, Date of Purchase. Choose appropriate data types for the columns and
following constraints should be imposed. Item Name should not contain empty values, If description of the item is
not added then, the value should be set as ‘Not Available’. Select an appropriate column as primary key.
II. Considering the following table ITEM, write SQL statements for the following:
ITEM
ICODE INAME MATERIAL PRICE ORD_DATE GRADE QTY
A191 TROUSERS COTTON 1000 2016-01-21 A 45
A109 HALF SLEEVE SHIRT SILK 1150 2016-08-12 C 123
A107 T- SHIRT POLYESTER 800 2015-11-23 B 50
A198 FULL SLEEVE SHIRT COTTON 950 2016-10-09 C 55
A924 COAT WOOLLEN 4000 2017-01-01 A 15
A123 SCARF SILK 1200 2015-10-12 B 20
A342 JEANS DENIM NULL 2016-09-12 A 34
A987 JACKET NULL 2500 2017-01-09 B 45
1) Display the details of the items where the word shirt occurs in the item name.
2) Display the different types of material in the table.
3) Display the code, name, and price of those items whose order date was in the month of
October, 2015.
4) Display a list of items that are of cotton, silk, or polyester material.
5) Add a new row in the table. Assume data on your own
6) Find the total value of each item in the table according to the price and quantity.
7) Display the code, name, and price of the items in descending order of price.
8) Display the details of items having grades as ‘B’ and ‘C’
9) Add a new row but with values only for icode, iname, and price.
10) Increase the price of all items ordered in the month of October by 5%.
11) Remove the rows from the table where the quantity is in the range of 20 to 40.
12) Display the details of items where the price has not been entered.
13) Display the details of items that have ‘C’ as the fourth last character in the item name.
14) Display the item name and price in ascending order of name.
15) Display double the price with heading as “Double price” for all items in the table.
16) Remove the cotton material items from the table
17) Display the details of items which were ordered in the year 2016.
18) Set the item material as cotton wherever the value of the material is null
19) Add a column COLOUR in the table to store characters with 50 as size.
20) Write a query to remove the primary key constraint in the table.
21) Increase the size of the Material column to 100.
22) Add not null constraint to the item name column.
23) Write the output of the following SQL queries based on the ITEM table as given above.
(Consider only the data given in the table for outputs)
a) Select price from item where ord_date > ‘2017-01-01’ or grade = ‘B’;
b) Select distinct grade from item;
c) Select icode, iname, grade from item where iname like ‘%s’;
d) Select Price * 2 from Item where material in (‘cotton’, ‘denim’);
e) Select Price * qty from Item where Grade = ‘A’;
f) Select Icode, Iname, Material from Item where Material = ‘Silk’ order by Material desc;
g) Select grade, price, iname from item where price is not null order by grade;
h) What is the cardinality and degree of item table as given above?

III) Define the following terms:


a) Attribute b) Tuple c) Domain d) Primary Key e) Foreign Key f) Referential Integrity
g) Alternate Key h) Candidate Key i) Composite Primay Key j) DDL k) DML
IV) Differentiate between MySQL and SQL?

You might also like