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

Grade 11 Computer Science HY - QP

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)
106 views6 pages

Grade 11 Computer Science HY - QP

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

OUR OWN HIGH SCHOOL, DUBAI

Half Yearly Examination, NOVEMBER 2023


COMPUTER SCIENCE (083)

Grade: 11 Max Marks: 70


Date: 22 - 11 - 2023 Time: 3 Hrs

Name of the Student: _________________________________ Section_________

General Instructions:
• This question paper contains five sections, Section A to E.
• All questions are compulsory.
• Section A has 18 questions carrying 01 mark each.
• Section B has 07 Very Short Answer type questions carrying 02 marks each.
• Section C has 05 Short Answer type questions carrying 03 marks each.
• Section D has 03 Long Answer type questions carrying 05 marks each.
• Section E has 02 questions carrying 04 marks each.
• All programming questions are to be answered using Python Language only.
• Reading Time 15 minutes.

SECTION – A
1. Say True or False: 1
“Python variable required to be declared before storing the values.”

2. Which of the following is a valid identifier? 1


a) Name b) None c) True d) 2ndTerm

3. Which is the operator used to check if two variables refer to the same object in memory. 1
a) ‘==’ b) ’is’ c) ‘!=’ d) ‘in’

4. Which of the following is not a sequence data type in Python? 1


a) List b) Tuple c) String d) Dictionary

5. What will be the output of the below expression : 1


>>> 15 − (2 + 7) * 5 + 3 * *2 * 6 − 4 + 2

a) 21 b) 20 c) 22 d) Error

6. Which of the following will print the different output from others? 1
a) for I in range(3,6): b) for I in range(3,6,1): c) for I in [3,4,5]: d) for I in [3,4,5,6]:
print(I) print(I) print(I) print(I)

Page 1 of 6
7. Consider the value of n=5 and choose the correct output of the below code. 1
n=5
while n>0:
print(n,end=' ')
n=n-1
a) 5 4 3 2 1 b) 5 4 3 2 1 0 c) 1 2 3 4 5 d) Error

8. How many times the following loop will execute? 1


for i in range(-1,5,2):
for j in range(3):
print(1,j)
a) 5 times b) 7 times c) 9 times d) infinite number of times

9. Which of the following function will returns a list containing all the words of the string? 1
a) find() b) partition() c) index() d) split()

10. Given the string S1=’Welcome’, which of the following statements will not give an error? 1
a) print(S1[4]) b) S2 = S1 c ) S1[3] = ‘e’ d) both (a) and (b)

11. Which of the following is not a valid python string operation? 1


a) ‘Welcome’ + ‘10’ b) ‘Welcome’ * 10 c) ‘Wel’ in ‘Welcome’ d) ‘Welcome’ * 2.0

12. Which of the following statements will remove element 3 from the list L=[1,2,3,4,5] 1
a) del L[2] b) L.remove(3) c) both (a) and (b) d) None of these

13. Given the list AL = [ 11,22,55,33,44,66,77], the output of print(AL[1:-2]) will be 1


a) [11,22]
b) [22,55,33,44,66]
c) [22,55,33,44]
d) Error

14. What will the output of the following code snippet? 1


D={1:'Fruits',2:'Chocolates',3:'Biscuits'}
D1=D.copy()
print(id(D)==id(D1))
a) True b) False c) 0 d) 1

15. What will be the output of the following code snippet? 1


T1=23,’Box’
print(T1+T1[1])
a) (23, ’Box’, ‘Box’) b) [23, ‘Box’, ‘Box’] c) [23,’Box’,(‘Box’)) d) Error

16. Predict the output of the following code if the input of the list S is: 1
L = [2,4,1,6,8,7,5]
n=len(L)
T=L[1:n-1]
print(L[0]==L[n-5] and L.index(6))
a) True b) False c) 0 d) 1

Page 2 of 6
Q17 and Q18 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 and R is False
(d) A is False but R is True

17. Assertion (A): Dictionaries are mutable, but their keys are immutable. 1
Reason (R): The values of the dictionaries can be changed, but the keys of the dictionaries
cannot be changed because through them the data is hashed.

18. Assertion (A): Python built-in functions can be used without their module name. 1
Reason (R): Python functions in the modules should be imported before the use of it.

SECTION – B
19. Write the output of the following code. 2
x=10
y=2
while x>y:
print(x,y,sep='#')
x=x-1
y=y+2
20. What possible output(s) will be obtained when following code is executed? Write the 2
minimum and the maximum values of the variable N?
import random
SIDES =['EAST', 'WEST','NORTH','SOUTH']
N=random.randint(1,3)
OUT=" "
for I in range(N,0,-1):
OUT=OUT+SIDES[I]
print(OUT)
i. SOUTHNORTH
ii. SOUTHNORTHWEST
iii. SOUTH
iv. NORTHWEST

21. Rohan wrote the code to print the reverse of the given number. He made a few errors in the 2
code. Rewrite the code after correcting the errors in it.
num=int(input('Enter a number')
rev=0
rem=0
While num>0:
rem==num%10
rev=rev*10+rem
num=num/10
print('Reverse of the number = ', rev)

22. How is dictionary different from List? 2


(or)
Write the difference and similarity between list and tuple.

Page 3 of 6
23. Convert the below program into while loop and write the output of the program. 2
for i in range(-10,0,2):
print('Exam2023')

24. Identify the output of the following code snippet. 2


X=(‘apple’,’pear’,’peach’,’grapefruit')
for I in X:
if 'r' in I:
print(I.upper())
else:
print(I.lower())

25. Suggest the appropriate functions for the following tasks. 2


(a) To find the number of times a given element is present in a list.
(b) To add an element at a particular index in a list.

SECTION – C
26. Predict the output of the Python code given below. 3
S='term-2Exam2023'
NS=" "
c=0
for i in S:
if c%2!=0:
NS = NS + S[c]
else:
if i.islower():
NS = NS + i.upper()
else:
NS = NS + i
c=c+1
print('The new String is:',NS)

27. Write program to multiply the even position elements by 2 and divide the odd position 3
elements by 3 in the given list L.
For Example:
If L = [5, 23, 7, 14, 8, 9, 12]
Then the output should be:
L = [10, 7, 14, 4, 16, 3, 24]

28. Write a program to check whether the given number is a lead number or not? 3
Note 1: Do not convert the number to string.
Note 2: A lead number is the one whose sum of even digits are equal to the sum of odd digits.
For Example,
if the number is 3669, then the odd digits=3+9=12, and the even digits=6+6=12. Therefore
3669 is a lead number.
If the number is 3245, then the odd digits=3+5=8, and the even digits=2+4=6. The number
3245 is not a lead number.

Page 4 of 6
29. Write a program that, 3
• Reads a String from the user.
• Extracts all the digits from the string.
• If there are digits
➢ Sum the collected digits
➢ Print the original string and the sum of the digits in the string.
• If there are no digits
➢ Print the original string
➢ A message “Given string has no digits in it”

30. Write a program in Python that reads the 5 places and stores it in the dictionary PLACES and 3
displays the names (in uppercase) of the places whose names are longer than 5 characters.
For Example, consider the dictionary
PLACES={1:’Dubai’, 2:’Abudhabi’,3:’Sharjah’,4:’Ajman’,5:’Fujairah’}
The output should be:
ABUDHABI
SHARJAH
FUJAIRAH

SECTION – D
31. Write the output of the below statements:
import statistics, math
(a) print(statistics.mean([5,3,6,4,7])) 1
(b) print(statistics.median([5,4,6,3,7,5,4,8])) 1
(c) print(statistics.mode([5,4,6,5,2,3,4,4,5])) 1
1
(d) print(math.pow(2,3))
1
(e) print(math.floor(-8.25))
(or)

Write the output of the below statements:


import statistics, math
(a) print(statistics.mean([6,3,4,6,2,8])) 1
(b) print(statistics.median(['a','c','d','b','e'])) 1
(c) print(statistics.median(['a','c','a','b','e','d','b'])) 1
(d) print(math.ceil(-18.5)) 1
(e) print(math.pi) 1

32. Write the output of the below statements.


import math, random 1
(a) print(math.ceil(random.random())) 1
(b) print(math.pow(random.randint(3,3),2)) 1
(c) print(float(random.randint(5,5)*11)) 1
(d) print(math.ceil(random.randrange(5,6)*(-2.5))) 1
(e) print(math.floor(random.randint(8,8)*-2))

Page 5 of 6
33. Write a program to accept the price of the product and categorize the product based on the 5
price. Print the Category and Description as per the Criteria.
Criteria Category Description
Price < 10 and Price >=0 Budget This is an affordable product
Price >=10 and Price < 50 Mid-Range This is a mid-range product. You can but it.
Price >=50 and Price < 100 Premium This is a Premium Product. You can buy if you
want it.
Price >=100 Luxury This is a Luxury Product. Think before buy.
Negative Price values Invalid Input No Description for -ve inputs

SECTION – E
34. (a) What is the difference between a local variable and a global variable? Give a suitable 2
Python code to illustrate both.

(b) Write a program to read and store 5 different numbers in a tuple T and print the highest 2
number in the tuple T?

35. Write a program:


(a) To read 5 students names and store it in a list SNames and print the number of 2
characters of each name in the list. 2
(b) To count the number of two digits numbers in a list L.
For example,
If L = [23, 456, 88, 45, 678, 123, 34]
Then the output should be,
Number of two digits numbers in the list = 4

******************

Page 6 of 6

You might also like