Class 11 Computer science section -B questions
1) Give an example to represent strings in Python for the following representation.
i)Single-Quoted Strings ii)Double-Quoted Strings
iii) Multi-line Strings iv)Escape Sequences in Strings
2) To return a float value in Python, choose the operator its returns float value.
A)/ B) ** C)* D) //
i) A, B, C ii) A, C, D iii) A, B iv) B, D
3) Choose the Correct Python Code for the following output.
['Hello', 'World', 'Python']
A) B)
text = "Hello World Python" text = "HelloWorldPython"
OP = [Link]() OP = [Link]()
print(OP) print(OP)
C) D)
text = "HelloWorldPython" text = "HelloWorldPython"
OP = [Link]() OP = [Link]()
print(OP) print(OP)
4) Predict the output of the following code:
data = [1, 2, 3, 4, 5]
result = 1
for item in data:
if item % 2 == 0:
result *= item
print(result)
5) Predict the output of the following codes:
A) B)
text = "Python is fun" text = "Program Programming"
text = [Link]('n') result = [Link]('Pr')
print(text) print(result)
6) Identify the correct output(s) of the following code.
list1 = [1, 2, 3]
list2 = list1 (A) (B) (C) (D)
[Link](4) True True True False
[Link](2)
print(list1 == list2) [1, 2, 4] [1, 2, 3] [1, 3, 4] [1, 2, 4]
print(list1)
7) What will be the output of the following Python code?
A) B)
i=1
for i in range(1, 5): while i <= 3:
print('*' * i) print("CS")
i += 1
break
OR
Choose the correct output for the following codes.
A) Str="Computer"
print(Str[-4:])
A) uter B)Comp C)puter D)index out
of range
B) >>>p=7//2
>>>q=p*4
>>>q
A) 14.0 B)14 C)12.0 D) 12