Class 11 Compsci QP 21.12.22
Class 11 Compsci QP 21.12.22
GROUP OF SCHOOLS
COMMON HALFYEARLY EXAMINATION -2022-2023
COMPUTER SCIENCE
SECTION A
1. State True or False (1)
(i) RAM operates much faster than ROM
(ii) Customised software is a type of system software.
2. Fill in the blank: (1)
(i) A group of 8 bits is called ------
(ii) 5 TB = ----------GB
3. Which of the following are invalid identifiers? (1)
(a) _myname (b) raise (c) dollar$ (d) Yield
4. Consider the given expression: (1)
True or not False and True or False
Which of the following will be correct output if the given expression is
evaluated?
(a) True (b) False (c) NONE (d) NULL
5. Evaluate the following expression (1)
(i) 2+3*(5+4)//5+(2+2)//4**3**2
(ii) 3 or "Good" and 5 or 0
6. Choose the right option showing right order of precedence from least to (1)
highest.
(a) and, not, !=,+,//,** (b) **,//,+,!=,not, and
(c) **,//,!=,+,not, and (d) not, and,//,!=,+,**
7. Write the following mathematical expression in to pythonic expression (1)
1
10. Which of the following are syntactically right? (1)
(a) “Best Wishes!! (b) "Parent’s signature"
(c) "Life is beautiful" (d) work hard
11. What will be the result for : (1)
print("Work hard trust God"[::-3].title())
16. A tuple t1=(11,21,31,42), where its last element is mistyped. Write the (1)
statement(s) to correct its last element as 41.
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
17. Assertion (A) : The expressions int(math.pow(3,2)) and 3**2 will not (1)
result in same answer.
Reason (R) : pow() is a function and ** is an operator
18. Assertion (A) : Given lst=[1,2,3] the expression lst+=2 will give error (1)
where as lst+=”abc” will not give error.
Reason (R) : When += is used with list it requires the operand on
right to be an iterable one.
SECTION B
19 Expand and explain CUI, GUI (2)
20. Can nongraphic characters be used in Python? How? Give an example (2)
to support your answer.
(Or)
Which argument of print() would you set for:
(i) Changing the default separator(space) ? Give an example.
(ii) printing the following line in current line? Give an example.
21. Ram has written a code to input a number and check whether it is prime (2)
or not. His code is having errors. Rewrite the correct code and underline
the corrections made.
n=int(input("Enter number to check :: "))
while k<n//2:
if n%k==0:
print("Number is not prime \n")
break
k=1
else: print("Number is prime \n’
22. What is the difference between ‘else’ and ‘elif’ construct of if statement. (2)
Give an example
(Or)
What is the difference between split() and partition()?
2
23. The below code is written in ‘for loop’ to print the following output . (2)
Rewrite the same code using while loop.
output
14
15
24
25
code
x = [1, 2]
y = [4, 5]
for i in range(2):
for j in range(2):
print(x[i],y[j])
24. Predict the output of the Python code given below: (2)
25. What are the possible outcome(s) executed from the following code? (2)
Also specify the maximum and minimum values that can be assigned to
variable SEL.
import random
SEL=random.randint(0,3)
ANIMAL=['DEER','MONKEY','COW','KANGAROO']
for A in ANIMAL:
for AA in range(1,SEL):
print(A,end=" ")
print()
3
SECTION C
26. Find and write the output of the following code (3)
. Moves=[11, 22, 33, 44]
Queen=Moves
Moves[2]+=22
L=len(Moves)
for i in range (L):
if (Moves[i]//10)%2!=0:
print ("Now@", Queen[L-i-1], "#", Moves [i])
else:
print("Then$",Queen[L-i-1],"*",Moves [i])
27. Write a program to compute the lower triangle numbers of a square (3)
matrix.
Example :Consider the following matrix
10 80 30
20 40 90
50 60 70
(Sum=10+20+40+50+60+70= 250)
Output: The sum of Lower triangle numbers = 250
(Or)
Write a program to compute the upper triangle numbers of a square
matrix.
Example :Consider the following matrix
10 80 30
20 40 90
50 60 70
(Sum=10+80+30+40+90+70= 320)
Output: The sum of Upper triangle numbers = 320
28. Write a program to display the following pattern. (3)
1
1 0 A
1 0 0 0 B
1 0 0 0 0 0 C
(Or)
5
4 5
3 4 5
2 3 4 5
1 2 3 4 5
29. Find and write the output of the following code (3)
s=('pyhton','world')
s1,s2=s
s1=s1.split('o')
s2=s2.partition('o')
s3='*'.join(s[0])
print(s1)
print(s2)
print(s3)
print(sorted(s,reverse=True))
s=s[0]+s[1]
print(max(s),'\t',min(s))
4
30. Write a program to read a tuple (3)
pairs=(('red','ruby'),('blue','sapphire'),('green','emerald'),('yelow','topaz'))
arrange the pairs based on the colour in alphabetic order using bubble
sort and display the result;
Example :
input :(('red','ruby'),('blue','sapphire'), ('yellow','topaz'),('green','emerald'))
output : (('blue','sapphire'),('green','emerald')
('red','ruby'),('yellow','topaz'))
SECTION D
31. (5)
(a) Answer the Following
i) Write the command to remove all leading and trailing spaces from a
string s=" HALF YEARLY "
ii) Write the command that throws error if the given substring(‘hello’) is
not found in the string? Fill in the blank
s=”Welcome”
print(_________)
iii) s=”welcome” Which function returns -1 if the substring “a” is not
found?
iv) Write the command to delete an element from the list
L=[30,40,50,60], if the index value 2 is given.
(v) Which function remove all items from the list and returns nothing.
32. Answer the following based on the string S .Write the output for the (5)
questions (a) to (e) and python statement for (f) to (j).
S=”HAVE A GOOD DAY”
(a) print(S[6:-1])
(b) print(S[3::3])
(c) print(S[::-2])
(d) print(S[:9:-1])
(e) print(S[:-1:-3])
(f) Write a string slicing to store “GOOD” into the variable ‘var’ from the
variable ‘S’
(g) Write a string slicing to store “YAD” into the variable ‘var’ from the
variable ‘S’
(h)Write a statement to display the last character of the string ‘S’
(i) Write a statement Extract “DAY” from the string ‘S’ and display 100
times
(j) Write a statement to display the middle character of the string ‘S’
5
33. (a) Write the difference between break and continue. Give an example 2+3
= (5)
(b) Write a program to accept the name, salary of an employee and
calculate bonus by using the following criteria:
Salary Bonus
<10000 16%
10000-20000 18%
>20000 20%
Print the name of the employee, salary, bonus and total salary (salary +
bonus).
(Or)
(a)What is the use Pass statement. Give an example
(b) Write a program to accept the name of the owner, number of units
consumed and calculate the electricity.
Units Rs. Per unit
<200 1.50
200-750 2.75
>750 3.50
Print the name, number of units, charge per unit and total amount .
SECTION E
34. Write a menu driven program with following as menu items (4)
1) Sum of series
*******END*******