G11 CSC - Worksheet For Annual Exam 2024 - 2025
G11 CSC - Worksheet For Annual Exam 2024 - 2025
Priyansh wants to store the value 3.5 into a variable n. Which of the following statement is correct for
1 him?
a) int n=5 b) n=5 c) 5=n d) n=’5’
Which of the following is valid identifier?
2
a) None b) #None c) 0_None d) none
What will be the output of the following code segment?
a,b=5,6
3 b,a=a,b
print(a,”+”,b)
a) 5 + 6 b) 6 + 5 c) 11 d) None
Kriza wants to divide a number and store the result without decimal places into an integer variable.
4 Suggest her an appropriate operator from the following:
a) / b) % c) // d) Both a) & b)
a='Computer Science is Science of Computers'
w=a.split(‘Sci’)
5
print(a[1])
a=’hello’
7 b=str(30)
print(a+b)
a) h b) hello c) 30 d) hello30
Rudra wants to access a second last list element of list object L. Help him to select an appropriate option
to accomplish his task.
8
a) L[2] b) L[-2] c) L[len(l)-2] d) L-2
a=56,78,32,12
9
print(type(a))
i. d={}
ii. d=dict()
iii. d=Dict()
10
iv. d=dict.fromkeys()
a,b=2,3
a,b=b**3,a**2
11
print(a,”#”,b)
a=30
while a>0:
12 print(a)
a-=10
a) 0 b) 10 c) 30 d) -10
The while loop does not have an update statement is called ______
13 a) empty while loop b) infinite while loop c) do while loop d) static while loop
s=''
for i in a:
if i.isdigit():
s=s+i+'#'
print(s)
Now he wants add an element 20 at the end of tuple next to 15. Which of the following statement is
correct for him?
15
a) T = T + 40 b) T.append(40) c) T=T+(40,) d) Not possible
a=20
for i in range(10,-1,-2):
16 a-=a-2
print(a)
a) -2 b) 0 c) -1 d) 2
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice as
(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
Assertion(A): In python program variable a and A both have different
17 significance.
Reason(R): Python is case insensitive language.
Assertion(A): Expressions are programming instructions that represents
something.
18
Reason(R): Statement is a logical combination of symbols that represents a
value.
Dhyana wants to check the more than two conditions in python program.
Suggest her a control structure that helps her to accomplish her tasks.
25
a) Simple if b) If-else c) if-elif-else d) nested if
a=20
for i in range(10,-1,-2):
a-=a-2
26
print(a)
a) -2 b) 0 c) -1 d) 2
a=0
for i in range(4,8):
27
if i%2==0:
a=a+i
print(a)
w=a.split(‘Sci’)
28 print(w[1])
Which of the following functions will return the string in all caps?
29
a) upper() b) toupper() c) isupper() d) to-upper()
Which of the following functions will return the last three characters of a string s?
Q31 and 32 are ASSERTION AND REASONING based questions. Mark the correct choice as
(e) Both A and R are true and R is the correct explanation for A
(f) Both A and R are true and R is not the correct explanation for A
(g) A is True but R is False
A is false but R is True
Assertion (A) : Both break and continue are jump statements.
Reason (R) : Both break and continue can stop the loops and hence can substitute one – another.
31
Assertion (A): The logical errors are the result of mistaken analysis of a problem.
Reason (R): Logical errors are missed by the interpreters
32
53. Identify the mutable data type from the following given options
(a) String (b) Set (c) Integer (d) Tuple
56. Python allows us to assign a single value to several variables simultaneously. Ex – a=b=c=15. [True
/False]
62. Directions: In the following questions, a statement of Assertion (A) is followed by a statement of
Reason (R). Mark the correct choice as.
Assertion (A): If the condition of the while loop is initially false, the body is not executed even once.
Reason (R): During execution of while loop, body of the loop executed only when condition gets true.
63. Directions: In the following questions, a statement of Assertion (A) is followed by a statement of
Reason (R). Mark the correct choice as.
(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 correct explanation for A.
(C) A is true but R is false.
(D) A is false but R is true.
a) DREAMS-INSPIRE-Action b) DREAMS-Inspire-Action
c) dreams-inspire-Action d) DREAMS-inspire-Action
STR=”RGBCOLOR”
colors=list(STR)
How do we delete ‘B’ in colors?
77
a) del colors[2] b)colors.remove("B")
c) colors.pop(2) d) All of these
Which of the following functions is a valid built-in function for both list
80 and dictionary datatype?
a) items() b) len() c) update() d) values()
Write an algorithm to find the greatest among 2 numbers entered by the user.
How are tuples different from lists when both are sequences?
What is the length of the tuple shown below?
T=((((‘a’, 1), (‘b’, ’c’), ‘d’, 2), ‘e’,3)
What will be the output for the following Python code?
tp1= (2, 4, 3)
tp3=tp1*2
b) t2=(4, 5, 6)
t3=(6, 7)
print(t3 – t2)
Find the error in the following code.
a) t1=(3)
t2=(4, 5, 6)
t3= t1 + t2)
b) t3=(6, 7)
t4=t3*3
t5=t3*(3)
t6=t3 *(3,)
print(t4)
print(t5)
print(t6)
Consider the following tuples, tuple1 and tuple 2:
tuple1=(23, 1, 45, 67, 45, 9, 55, 45)
tuple2=(100, 200)
Find the output of the following statements:
(i) print(tuple1.count(45))
(ii) print(tuple1.index(45))
(iii) print(sorted(tuple1))
print(tuple1)
A student’s roll number, name and marks in 5 subjects are available in the form of a tuple
as shown here: Student = (11, ‘Ria’,(67, 77, 78, 82, 80)). Write a program to print the
minimum and maximum marks along with total marks obtained by the student.
Write the output for the following:
a) t2 = ('a')
type(t2)
What does each of the following expressions evaluate to? Suppose that T
is the tuple: ("These", ("are", "a", "few", "words"), "that", "we", "will", "use")
(a) T[1][0: : 2] (b) "a" in T [1] [ 0 ] (c) T [ : 1 ] + T[ 1 ]
(d) T[ 2 : : 2 ] (e) T[2][2] in T[1] (f) T[2][3] - 3 Marks
Write a python program that create a tuple storing first 9 terms of Fibonacci Series.
- 4 Marks
Part – A : Multiple Choice Questions (30 X 1 = 50 marks)
Names given to different parts of a Python Program are ______________.
a) Identifiers b) Functions c) Keywords d) Literals
Which of the following operators has the lowest precedence?
a) not b) % c) and d) +
In Python statement x = a + 5 – b. Here a and b is ______________
a) Operands b) Expression c) Operators d) Equation
What does the following Python Program display?
X=3
if x==0:
print(“Am I here?”, end =’ ‘)
elif x==3:
print(“Or here?”, end=’ ‘)
else:
pass
print(“Or over there?”)
a) Am I here? b) Or here? c) Am I here? Or here? d) Or here? Or Over here?
What is the output produced when this code executes?
a=0
for i in range(4, 8):
if i%2==0:
a=a+i
a) L[3:4] + L[1:2]
b) “few” in L[2:3]
How are lists different from the strings when both are sequences?
(a) S[: n]
(b) S[n :]
(c) S[n : n]
(d) S[1 : n]
(e) S[n : length – 1]
a)
x = "hello world"
print (x[:2], x[:-2], x[-2:])
print (x[6], x[2:4])
print (x[2:-3], x[-4:-2])
Write a program in Python to count the no. of vowels present in a given string. The string input will
be entered by the user.
Predict the output of the following two parts. Are the outputs same? Are the outputs different? Why?
a) b)
L1, L2 = [2, 4], [2, 4] L1, L2 = [2, 4], [2, 4]
L3=L2 L3=list(L2)
L2[1]=5 L2[1]=5
print (L3) print(L3)
What will be output of the following statements?
a) b)
list1=[12, 32, 65, 26, 80, 10] list1=[12, 32, 65, 26, 80, 10]
list1.sort() sorted(list1)
print(list1) print(list1)
c)
list1=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
list1[: : -2]
list1[:3] + list1[3:]
Write a program in Python accept 10 inputs from the user. Sort these elements in a homogenous
list. Find the sum and count the positive elements and negative elements from the list.
What does each of the following evaluate to? Suppose that L is the list
a) L[3:4] + L[1:2]
b) “few” in L[2:3]
How are lists different from the strings when both are sequences?
Write a program to print the table of a given number. The number has to be entered by the
user.
(a) S[: n]
(b) S[n :]
(c) S[n : n]
(d) S[1 : n]
(e) S[n : length – 1]
x = "hello world"
print (x[:2], x[:-2], x[-2:])
print (x[6], x[2:4])
print (x[2:-3], x[-4:-2])
Write a program in Python to count the no. of vowels present in a given string. The string
input will be entered by the user.
Predict the output of the following two parts. Are the outputs same? Are the outputs
different? Why?
a) b)
L1, L2 = [2, 4], [2, 4] L1, L2 = [2, 4], [2, 4]
L3=L2 L3=list(L2)
L2[1]=5 L2[1]=5
print (L3) print(L3)
What will be output of the following statements?
a) b)
list1=[12, 32, 65, 26, 80, 10] list1=[12, 32, 65, 26, 80, 10]
list1.sort() sorted(list1)
print(list1) print(list1)
c)
list1=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
For example:
Input : [2, 5, 7, 6, 4]
Output : [4, 5, 7, 6, 2]
The record of a student( Name, Roll No, Marks in five subjects and percentage of marks)
is stored in the following list.
stRecord=[“Raman”,”A-36”,[56,34,89,76,100],78.8]
Write python statements to retrieve the following information from the list stRecord.
a) Marks in the fifth subject
b) Maximum marks of the student
c) Change the name of the student from Raman to Raghav
Write a menu driven python program to input your friend’s names and their phone
numbers and store them in the dictionary as the key – value pair. Perform the following
operations on the dictionary.
i) Display the name and phone number of all your friends.
ii) Add a new friend to the dictionary and display the modified dictionary
iii) Delete a particular friend from the dictionary.
iv) Modify the phone number of an existing friend.
v) Check if a friend is present in the dictionary or not.
a) Write a menu driven python program to create an empty list and do the following.
(i) The program should ask for Number of elements (N) to be appended in the list and
write code to input these N elements and to display these elements.
(ii) The program should ask for the element and the number to be inserted, and insert
the element at the required position.
(iii) The program should ask for the position of the element to be deleted from the list
and delete the element at the desired position in the list. 2
(iv) The program should ask for the value of the element to be deleted from the list and
delete this value from the list
Read the code given below and answer the questions based on the code.
teststr="abcdefghi"
inputstr=input("Enter integer:")
inputint=int(inputstr)
count=2
newstr=""
while count <= inputint:
newstr=newstr+teststr[0:count]
teststr=teststr[2:] #Line 1
count=count+1
print(newstr) #Line 2
print(teststr) #Line 3
print(count) #Line 4
print(inputint) #Line 5
Write a program to accept n number of names into the list and print the names starting
with ‘A’.
NUMBER= [15,12,19,26,18]
A=NUMBER[i]
1
print(A,end='#')
B=NUMBER[i-1]
print(B,end='@')
Rewrite the following code after removing all syntax errors. Underline each
correction you have done in the code:
2 a=10
for v in range(a)
if v%10=0:
Dhruv has created a list. Now he wants to perform the following tasks:
L=[99,77,66]
3 i) Insert a value 88 at index 1
ii) Remove element 66 using backward indexing
a) Helly has written the following code in python but did not get the expected result.
Help her to rectify the errors. Underline the corrected statements having errors
x,y,z=5 6 7
7
print(Values are:x,y,z)
z y x =7,6,5
b) Identify error in the following code. Rewrite the corrected code after removing errors
and underline the corrections:
a,b=input(“Enter value:”)
8
result=a/*b
print result
a) 5+5*10**2//4
b) 3*5-4**2
11
c) not (10<5) and (13>9) or (5==6)
Write a program to create a list and exchange the first element to last
element.
For example:
13
Input : [2, 5, 7, 6, 4]
Output : [4, 5, 7, 6, 2]
.
Write a program to add all the values in the tuple of marks which ends with 1 and display
14
their sum
Consider the following dictionary d and answer the given questions:
d={‘Name’:’Vishnu’,’Class’:’XI’,Section:’B’}
a) Write a statement to insert an element with a key Building and value as
15 senior.
b) Change the section of student from B to A.
c) Find the length of dictionary
Prutha is class 11 student. She is learning python. She wants to display the
only the last two digits of a number. She has written the partial code as
following:
n=__________ #Statement 1
ld1= __________ #Statement 2
n= ________ #Statement 3 Remove the first last digit of a number
ld2=n%10
21 print(“Last Digit 1:”,__________, “Last Digit 2”,________) #Statement 4
statements.
22
import ___________ #Statement 1
m=_________________ #Statement 2
c= _____________ #Statement 3
print(“Energy:”, e ,” Joule”)
Pranjal has given following symbols and word to identify which types of
tokens are they, help her to identify them:
21 i. if ii. r_no iii. and iv. ‘True’
Rewrite the following code after removing all syntax errors. Underline each
correction you have done in the code:
a=10
for v in range(a)
if v%10=0:
23
print(v//10)
el if v%8==0:
print(v//8)
else:
print(v//2)
for i in range(0,len(s)):
else:
print(s[i].upper(),end="")
Write a program to take an integer a as an integer input and check whether it ends with 4 or 8. If
it ends with 4, print “ends with 4”, if it ends with 8, print “ends with 8”, otherwise print “ends
28 with neither”
29
i. print(myAddress.lower())
ii. print(myAddress.upper())
30 iii. print(myAddress.count(‘New’))
iv. print(myAddress.find(‘New’))
v. print(myAddress.split(‘,’))
vi. print(myAddress.replace(‘New’,’Old’))
Input to be entered as XI
31
b) a,b,c = 2,8,9
print(a,b,c)
c,b,a=a,b,c
print(a;b;c)
(a) x = 55
(b) y = 037
(c) z = 0o98
34 (d) 56thnumber = 3300
(e) length = 450.17
(f) !Taylor = 'Instant'
(g) this variable = 87.E02
(h) float = .17E - 03
(i) FLOAT = 0.17E - 03
List and explain the operators in string with an example for each.
35
Observe the code given below and write answer of the following questions:
a,b=0,1
n=___________ # Statement 1
if _________: #Statement 2
_______________ #Statement 4
c = a+b
a=b
b=c
print(b)
Statement 2
Statement 3
39 Write a program to print the Fibonacci Series till n terms, where n is entered by the user.
dict['age'] = 27
dict['address'] =
44 Write a program calculate and print total and average runs scored by a cricketer in 3
matches.
1.
45 What is mutable and immutable data objects in Python? Name any one of each type.
(OR)
How the pop ( ) function is different from remove( ) function working with list in python ?
47 What is difference between break and continue statement in Python explain with
example.
49 Rewrite the following code in Python after removing all syntax error(s).
30 = To
for K in range(0, To)
If K%4 == 0:
Print(K*4)
Else:
Print(K + 3)
50 What is the difference between ‘=’ and ‘==’? Explain with the help of an example.
60 A code snippet using a dictionary is shown below and What will be the output of the
following :
dt={“Apple”:50, “Orange”:40, “Banana”:30 , “Mango”:80}
print(len(dt)) #Statement 1
print(dt.keys()) #Statement 2
print(dt.items()) #Statement 3
print(dt.popitem()) #Statement 4
print(dt.get("Banana")) #Statement5
Evaluate output of all statements.
63
What is token? Name various types of tokens.
65. What happens when you try to access the value of an undefined variable?
66. How is a list type different from a tuple data type in python?
73. Write a python program to check whether the entered number is Armstrong or not.
80. Write a program check whether a number entered by the user is ODD or EVEN
Rewrite the following code after removing all syntax error(s) and underline each correction
done:
Runs=[10,5,0,2,4,9]
for I in Runs:
81 if m=0: print(Maiden Over) else:
print(Not Maiden)
Write a program to input the radius of a sphere and calculate its volume using math module.
82
90
Find the output for the following code segment. L=[4,8,10,12,14,16,18]
T1=tuple(L[::2])
print("The First Tuple is",T1)
T2=T1+tuple(L[::-3])
print("The Second Tuple is",T2) print("Sum of Tuple
1=",sum(T1))
print("Sorting in Tuple 2 = ",sorted(T2))
91 A code snippet using a dictionary is shown below and What will be the output of the
following:
dt={“Apple”:50, “Orange”:40, “Banana”:30 , “Mango”:80} print(len(dt))
#Statement 1
print(dt.keys()) #Statement 2
print(dt.items()) #Statement 3
print(dt.popitem()) #Statement 4
print(dt.get("Banana")) #Statement5 Evaluate
output of all statements.
96
Dharamveer a Python programmer is working on a mathematical project and tried creating a
code for it. Suggest him a module and function from that module which can be used for the
following tasks
(i) To calculate absolute value of a number.
(ii) To calculate mean from a list of marks.
(iii) To generate a random number between 1 to 6 (both values included)..
97 What does each of the following expressions evaluates to? Suppose that L is the list
[“These”, [“are”, “a”], [“few”, “words”], “that”, “we”, “will”, “use”]
a. len( L )
b. L[3 : 4] + L[1 : 2]
98
Write output of the following Python code:
P = [1, 6, 9, 3, 8, 3, 1, 7, 3, 9, 1]
Q = [2, 3, 7, 9, 5, 3, 5, 9] R= []
for i in P:
100 Differentiate between append(), extend(), and insert() methods in a list with examples
103
Write a short program to check whether a number is prime number or not.
104
Write a program to find the frequency of the element in the list (Input the list from the
user)
105 Mr. Monish is trying to develop a program based on list manipulations. He is supposed to
add/remove elements in the list, Help him to write the most appropriate list method to
perform the following tasks in the list:
Name of list is Marks=[10,20,30,40,50,60]
(a) delete an element value 20 from the list.
(b) get the position of an element 40 in the list
(c) delete the 3rd element from the list
(d) add single element 70 at the end of the list
add another list [80,90,100] at the end of the list.
106 Write a program that repeatedly asks the user to enter product names and prices. Store all
of these in a dictionary whose keys are the product names and whose values are the prices.
When the user is done entering products and prices, allow them to repeatedly enter a
for i in range(3) :
pass
What will be the final value of i after this loop ?
5) When the following code runs, how many times is the line
"x = x * 2" executed?
a=0
for i in range(4,8):
if i % 2 == 0:
a=a+i
print (a)
min = 0
max = num
if num < 0 :
min = num
max = 0 # compute sum of integers
# from min to max
x = 10
y=5
for i in range(x-y * 2):
print (" % ", i)
for i in range(4):
for j in range(5):
if i + 1 == j or j + i == 4:
print ("+", end = ' ')
else:
print ("o", end = ' ')
print()
12) In the nested for loop code below, how many times is the
condition of the if clause evaluated?
for i in range(4):
for j in range(5):
if i + 1 == j or j + i == 4:
print ("+", end = ")
else:
print ("o", end = ")
print()
Write a python program to accept only 20 numbers and display the prime numbers from
Write a program to add all the values in the tuple of marks which ends with 1 and display
their sum.
Consider the following tuples, tuple1 and tuple2.
tuple1=(23,1,45,67,45,9,55,45)
tuple2=(100,200)
Find the output of the following statements.
a) print(len(tuple1+tuple2)
b) print(tuple1.count(45))
c) print(sorted(tuple1))
Write a program to check if a tuple contains duplicate elements.
Consider the following dictionary d and answer the given questions:
d={‘Name’:’Vishnu’,’Class’:’XI’,Section:’B’}
a) Write a statement to insert an element with a key Building and value as
senior.
b) Change the section of student from B to A.
c) Find the length of dictionary
Write a menu driven python program to input your friend’s names and their phone
numbers and store them in the dictionary as the key – value pair. Perform the following
operations on the dictionary.
i) Display the name and phone number of all your friends.
ii) Add a new friend to the dictionary and display the modified dictionary
iii) Delete a particular friend from the dictionary.
iv) Modify the phone number of an existing friend.
v) Check if a friend is present in the dictionary or not.
a) Write a menu driven python program to create an empty list and do the following.
(i) The program should ask for Number of elements (N) to be appended in the list and
write code to input these N elements and to display these elements.
(ii) The program should ask for the element and the number to be inserted, and insert
the element at the required position.
(iii) The program should ask for the position of the element to be deleted from the list
and delete the element at the desired position in the list. 2
(iv) The program should ask for the value of the element to be deleted from the list and
delete this value from the list
Read the code given below and answer the questions based on the code.
teststr="abcdefghi"
inputstr=input("Enter integer:")
Write a program to accept n number of elements and add them into a list. Find the maximum
and minimum values and print them.
Write a program to calculate the electricity bill based on the number of electricity units
consumed as per the following conditions.
UNITS CHARGES
Prutha is class 11 student. She is learning python. She wants to display the
only the last two digits of a number. She has written the partial code as
following:
n=__________ #Statement 1
ld1= __________ #Statement 2
n= ________ #Statement 3 Remove the first last digit of a number
ld2=n%10
print(“Last Digit 1:”,__________, “Last Digit 2”,________) #Statement 4