Page 1 - Home Assignment
P. 1
Home Assignment
Computer Science
Class – XI
Topic: Revision Tour II
A) Answer the following:
1. Mathematical operations can be performed on a string. State whether true or false.
a) True b) False
2. Specify why the following code is incorrect as per Python syntax:
Result = 'PYTHON' + 110
3. Identify which of the following are valid strings in Python:
i) "python" ii) "python' iii) 'python' iv) {python}
4. Carefully observe the code and write the output of the code:
a="hello"
a = a + '2'
a = a*2
print(a)
a) hello2 b) hello2hello2
c) error d) cannot perform mathematical operation on strings
5. What is the output when following statement is executed ?
>>>"abcd"[2:]
a) a b) ab c) cd d) dc
6. What is the output when following code will be executed ?
>>> str1 = 'hello'
>>> str2 = ','
>>> str3 = 'world'
>>> str1=str1[: : -1]
>>>print(str1+str2+str3)
a) olleh,dlrow b) hello,world
c) olleh,world d) none of the above
7. What is the output of the following?
print("xyyzxyzxzxyy".count('yy'))
a) 2 b) 0 c) error d) none of the mentioned
8. What is the output of the following?
print("xyyzxyzxzxyy".count('yy', 2))
a) 2 b) 0 c) 1 d) none of the mentioned
9. What is the output of the following?
print("xyyzxyzxzxyy".count('xyy', 2, 11))
a) 2 b) 0 c) 1 d) error
10. What is the output of the following?
print("xyyzxyzxzxyy".count('xyy', -10, -1))
a) 2 b) 0 c) 1 d) error

