Computer Science
Computer Science
Section - A
1. What will the following expression be evaluated to in python?
2**2**2
a) 16 b) 128 c) 64 d) 8
4. How many times is the word “Python” printed in the following statement?
s=’I love python’
for ch in s[3 : 8]:
print(‘python’)
5. Ram wanted to make a program which takes in two numbers from the user and print the two number
as shown below:
Input: Enter number 1=> 23
Enter number 2=> 24
Output: 23.0 24.0
He wrote the following code but doesn’t know what the last line is supposed to be
a = float (input (‘Enter number 1=>’))
b = float (input (‘Enter number 2 =>’))
________________________________
What would be the last line of his code which produces his desired output?
a) print(a+b)
b) print(a, b)
c) print(‘a’, ‘, ‘, ‘b’)
d) print(a, b, sep= ‘, ‘)
6. 1 PB = _____GB
The following questions 17 and 18 are Assertion – Reasoning based, answer the
questions by choosing one of the following response:
a) Both A and R are true and R is the correct explanation of A
b) Both A and R are true but R is not the correct explanation of A
c) A is true but R is false
d) A is false but R is true
17. Assertion (A): Slicing a string involves extracting substring(s) from a given string
Reasoning(R): Slicing does not require start and end index value of the string
Reasoning(R): The capitalize( ) method returns a string where the first character is upper
case, and the rest is lower case.
Section - B
19. Convert (38.625)10 into its binary equivalent
OR
Convert (6C.34)16 into its decimal equivalent
20. The following is a message encoded in ASCII code. What is the message?
100100010001011001010000
25. Find error(s) in the following code (if any) and correct it by rewriting code (if any) and
underline the corrections.
x= int(input(“ enter value for x:”))
for in range ( 0, 11):
if x=y:
print x+y
else:
Print x-y
Section-C
27. Write a program to find and print the grade of a student when the user inputs their percentage
(Using if elif else)
Percentage of Marks Grade
Above 90% A
80% to 90% B
70% to 80% C
60% to 70% D
Below 60% E
28. Write a program to print the following pattern using nested loop
5
4 5
3 4 5
2 3 4 5
1 2 3 4 5
29. Write a program to print the following pattern using nested loop
A
B C
D E F
G H I J
K L M N O
Std. 11 -4- COMPUTER SCIENCE
35. Verify Demorgan’s laws (1st and 2nd) using truth table.
-x-x-x-x-x-x-x-x-