CS Class XI Term 2 (2022)
CS Class XI Term 2 (2022)
COMPUTER SCIENCE
Time allowed: 2 hours Maximum Marks: 40
Instructions:
PART – A
4. Ananya is getting an error with the following code. Can you spot the error . [1]
T=(10,20,30)
T.append(40)
Also help Ananya to write correct code to, how he can add/concatenate an element at
the last of the tuple
5. Consider the following code and predict output [2]
dct={1: “One” , 2: “Two” , 3: “Three” , 4: “Four”}
for x in dct.values():
print (x, end= “#” )
6. Write a program to read a list of numbers and create another list which store [3]
half of each even number and double of each odd number in the list.
Example: if list is containing [3,5,6,2,7,4,5,8] then new list should
contain [6,10,3,1,14,2,10,4]
7. Write a program to input a tuple of integers and count how many numbers [2]
are divisible with 5.
- OR –
Write a program to enter any string and count the frequency of each character
and print the frequency of each character
16. Suppose a string is declared as str=”STUDY CS” which one will give error [1]
a. print(str[1])
b. str[2]=’u’
c. print(max(str))
19. Write a program to store employee name as key and salary as value for N employee
in a dictionary “emp” and find the sum of salary of each employee and print sum [3]
20. Write the output of the following [2]
p=5/2
q=p*4
r=p+q
p+=p+q+r
q- =p+r
print(p,q,r)
for i in range(5,0,-1):
for j in range(1,i+1,1):
print("*",end='')
print()
24. Write a program to enter any string and count total number of upper and lower [2]
case character
- OR –
Write a program to enter any number and find the sum of all even number
and product of all odd number up to N , finally print sum and product