0% found this document useful (0 votes)
146 views6 pages

Class 11 Compsci QP 21.12.22

Uploaded by

talkativenesssai
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
0% found this document useful (0 votes)
146 views6 pages

Class 11 Compsci QP 21.12.22

Uploaded by

talkativenesssai
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/ 6

D.A.V.

GROUP OF SCHOOLS
COMMON HALFYEARLY EXAMINATION -2022-2023
COMPUTER SCIENCE

Class : XI Time: 3 hours


Date:21.12.2022 Max.Marks:70
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each.
8. All programming questions are to be answered using Python Language only.

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)

(ii) (cos x /tan x) +2-xe2x+4x

8. Write the correct output of the following code: (1)


a = "All the best to all"
a = a.split('t')
b = a[:-1][0] + "$ " + a[-1] + "$ " + a[len(a)//2]+"$"
print (a,b,sep="%%%")

9. Write the correct output of the following code: (1)


z= [y for y in range(50) if y % 2 == 0 if y % 5 == 0]
print(z)
k = ["Ok" if i%3!=0 else "OKOk" for i in range(5)]
print(k)

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())

12. s=’ ‘(single space) then s.isalnum() will return (1)


(a) True b) False (c) Error (d) nothing

13. What is the output when we execute list(“hello”)? (1)


(a) ['h', 'e', 'l', 'l', 'o'] (b) [“hello”]
(c) [(“hello”)] (d) list=”hello”
14. What is printed by the following python code? (1)
print(list(range(3)))
15. Which of the following will create a nested tuple? (1)
(a) t=(1,2) (b) t=(3)*3 (c) t=(3,)*3 (d) t=(1,2),

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)

s="python string fun"


for i in range(0,len(s)):
if s[i]>='c' and s[i]<='l':
print(s[i+1].lower(),end="")
else:
print(s[i-1].upper(),end="")
if i%2==0 and s[i]==' ':
print("@",end="")
elif s[i]==" ":
print("#",end="")
else:
pass
(Or)

s="python string fun"


while True:
if s[0]==chr(ord('P')+32):
s = s[3:].upper()
elif s[-1]=='n':
s=s[:2].lower()
else:
break
print(s)

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()

(i) (ii) (iii) (iv)


DEER DEER DEER DEER1 DEER
MONKEY MONKEY MONKEYDEER MONKEY1 MONKEYMONKEY
COW COW MONKEYCOW COW1 DEERKANGAROO
KANGAROO KANGAROO KANGAROO1 COW

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)

Write a program to display the following pattern.

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'))

(Note:- Do not use eval function to accept the tuple)

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.

(b) write the output of the following

(1) print( "Mystery"[:4].upper())


(2) s=["chennai","delhi","mumbai","kolkata"]
r=[i[::-1] for i in s]
print(r)
(3) s=”Hello”
print(s.isdigit())
(4) print("common" in "mon")
(5) [print(x ,end=" ") for x in [-65,23,-30,2,-1] if x<0]

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

2) Generate primepalindrome number between 110 to 900


3) Exit.
The program should accept a choice ( 1 or 2 or 3) and display the
desired result . Perform this as long the user wishes to continue.

(Note : A number is said to be a primepalindrome if the number is a prime.


as well as a palindrome number. Example 131.)

35. Attempt any 4 from the following questions (4)

i) Convert Octal 205.32 to Decimal


ii) Convert Hexadecimal A10.B1 to Octal
iii) Convert Decimal 52.21 to Binary
iv) Convert Decimal 451.34 to Hexadecimal
v) Convert Binary 10101011101.001 to Hexadecimal

*******END*******

You might also like