1. What is the output of the piece of code given below?
def check(n):
if n < 2:
return n % 2 == 0
return check(n - 2)
print(check(11))
Correct Answer is : FALSE
2. What is the base case in the Merge Sort algorithm when it is solved recursively?
Correct Answer is : A list of length one
3. What is the base case in the Merge Sort algorithm when it is solved recursively?
Correct Answer is : A list of length one
4. What is the output of the following piece of code?
a = [1, 2, 3, 4, 5]
b = lambda x: (b (x[1:]) + x[:1] if x else [])
print(b (a))
5. What is the output of the following piece of code?
a = [1, 2, 3, 4, 5]
b = lambda x: (b (x[1:]) + x[:1] if x else [])
print(b (a))
6. What is the output when following statement is executed ?
>>>"a"+"bc"
7. What is the output when following statement is executed ?
>>>"abcd"[2:]
8. The output of executing string.ascii_letters can also be achieved by:
Correct Answer is : string.ascii_lowercase+string.ascii_upercase
9. What is the output when following code is executed ?
>>> str1 = 'hello'>>> str2 = ','>>> str3 = 'world'>>> str1[-1:]
10. What arithmetic operators cannot be used with strings ?
11. What is the output when following code is executed ?
>>>print (r"\nhello")
Correct Answer is : \nhello
12. What is the output when following statement is executed ?
>>>print('new' 'line')
Correct Answer is : newline
13. What is the output when following statement is executed ?
>>> print(‘x\97\x98’)
14. What is the output when following code is executed ?
>>>str1="helloworld">>>str1[::-1]
Correct Answer is : dlrowolleh
15. print(0xA + 0xB + 0xC) :
16. What is the output of the following?
print('for'.isidentifier())
17. What is the output of the following?
print('abc'.islower())
18. What is the output of the following?
print('[email protected] 1,'.islower())
19. What is the output of the following?
print('11'.isnumeric())
20. What is the output of the following?
print('1.1'.isnumeric())
Correct Answer is : FALSE