JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Python interview questions part 48
Python interview questions part 48
Back
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))
A. FALSE
B. TRUE
C. 1
D. An exception is thrown
Show Correct Answer
Correct Answer is :
FALSE
2. What is the base case in the Merge Sort algorithm when it is solved recursively?
A. n=0
B. n=1
C. A list of length one
D. An empty list
Show Correct Answer
Correct Answer is :
A list of length one
3. What is the base case in the Merge Sort algorithm when it is solved recursively?
A. n=0
B. n=1
C. A list of length one
D. An empty list
Show Correct Answer
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))
A. 1 2 3 4 5.
B. [5,4,3,2,1].
C. [].
D. Error, lambda functions can’t be called recursively.
Show Correct Answer
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))
A. 1 2 3 4 5.
B. [5,4,3,2,1].
C. [].
D. Error, lambda functions can’t be called recursively.
Show Correct Answer
Correct Answer is :
[].
6. What is the output when following statement is executed ? >>>"a"+"bc"
A. a
B. bc
C. bca
D. abc
Show Correct Answer
Correct Answer is :
abc
7. What is the output when following statement is executed ? >>>"abcd"[2:]
A. a
B. ab
C. cd
D. dc
Show Correct Answer
Correct Answer is :
cd
8. The output of executing string.ascii_letters can also be achieved by:
A. string.ascii_lowercase_string.digits
B. string.ascii_lowercase+string.ascii_upercase
C. string.letters
D. string.lowercase_string.upercase
Show Correct Answer
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:]
A. olleh
B. hello
C. h
D. o
Show Correct Answer
Correct Answer is :
o
10. What arithmetic operators cannot be used with strings ?
A. #ERROR!
B. *
C. –
D. All of the mentioned
Show Correct Answer
Correct Answer is :
–
11. What is the output when following code is executed ? >>>print (r"\nhello")
A. a new line and hello
B. \nhello
C. the letter r and then hello
D. error
Show Correct Answer
Correct Answer is :
\nhello
12. What is the output when following statement is executed ? >>>print('new' 'line')
A. Error
B. Output equivalent to print ‘new\nline’
C. newline
D. new line
Show Correct Answer
Correct Answer is :
newline
13. What is the output when following statement is executed ? >>> print(‘x\97\x98’)
A. Error
B. 97
C. x\97
D. \x97\x98
Show Correct Answer
Correct Answer is :
x\97
14. What is the output when following code is executed ? >>>str1="helloworld">>>str1[::-1]
A. dlrowolleh
B. hello
C. world
D. helloworld
Show Correct Answer
Correct Answer is :
dlrowolleh
15. print(0xA + 0xB + 0xC) :
A. 0xA0xB0xC
B. Error
C. 0x22
D. 33
Show Correct Answer
Correct Answer is :
33
16. What is the output of the following? print('for'.isidentifier())
A. TRUE
B. FALSE
C. None
D. Error
Show Correct Answer
Correct Answer is :
TRUE
17. What is the output of the following? print('abc'.islower())
A. TRUE
B. FALSE
C. None
D. Error
Show Correct Answer
Correct Answer is :
TRUE
18. What is the output of the following? print('[email protected] 1,'.islower())
A. TRUE
B. FALSE
C. None
D. Error
Show Correct Answer
Correct Answer is :
TRUE
19. What is the output of the following? print('11'.isnumeric())
A. TRUE
B. FALSE
C. None
D. Error
Show Correct Answer
Correct Answer is :
TRUE
20. What is the output of the following? print('1.1'.isnumeric())
A. TRUE
B. FALSE
C. None
D. Error
Show Correct Answer
Correct Answer is :
FALSE
Similar Interview Questions
Search for latest jobs
Find Jobs