Python Interview Questions - 48 | Snaprecruit.com

Python Interview Questions - 48 | Snaprecruit.com

Python interview questions part 48

Python interview questions part 48

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

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))

Correct Answer is : [].

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))

Correct Answer is : [].

6. What is the output when following statement is executed ? >>>"a"+"bc"

Correct Answer is : abc

7. What is the output when following statement is executed ? >>>"abcd"[2:]

Correct Answer is : cd

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:]

Correct Answer is : o

10. What arithmetic operators cannot be used with strings ?

Correct Answer is :

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’)

Correct Answer is : x\97

14. What is the output when following code is executed ? >>>str1="helloworld">>>str1[::-1]

Correct Answer is : dlrowolleh

15. print(0xA + 0xB + 0xC) :

Correct Answer is : 33

16. What is the output of the following? print('for'.isidentifier())

Correct Answer is : TRUE

17. What is the output of the following? print('abc'.islower())

Correct Answer is : TRUE

18. What is the output of the following? print('[email protected] 1,'.islower())

Correct Answer is : TRUE

19. What is the output of the following? print('11'.isnumeric())

Correct Answer is : TRUE

20. What is the output of the following? print('1.1'.isnumeric())

Correct Answer is : FALSE

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon