JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Python interview questions part 53
Python interview questions part 53
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 following? print('abc'.encode())
A. abc
B. ‘abc’
C. b’abc’
D. h’abc’
Show Correct Answer
Correct Answer is :
b’abc’
2. What is the default value of encoding in encode()?
A. ascii
B. qwerty
C. utf-8
D. utf-16
Show Correct Answer
Correct Answer is :
utf-8
3. What is the output of the following? print("xyyzxyzxzxyy".endswith("xyy"))
A. 1
B. TRUE
C. 3
D. 2
Show Correct Answer
Correct Answer is :
TRUE
4. What is the output of the following? print("xyyzxyzxzxyy".endswith("xyy", 0, 2))
A. 0
B. 1
C. TRUE
D. FALSE
Show Correct Answer
Correct Answer is :
FALSE
5. What is the output of the following? print("ab\tcd\tef".expandtabs())
A. ab cd ef
B. abcdef
C. ab\tcd\tef
D. ab cd ef
Show Correct Answer
Correct Answer is :
ab cd ef
6. What is the output of the following? print("ab\tcd\tef".expandtabs(4))
A. ab cd ef
B. abcdef
C. ab\tcd\tef
D. ab cd ef
Show Correct Answer
Correct Answer is :
ab cd ef
7. What is the output of the following? print("ab\tcd\tef".expandtabs('+'))
A. ab+cd+ef
B. ab++++++++cd++++++++ef
C. ab cd ef
D. none of the mentioned
Show Correct Answer
Correct Answer is :
none of the mentioned
8. What is the output of the following? print("abcdef".find("cd") == "cd" in "abcdef")
A. TRUE
B. FALSE
C. Error
D. None of the mentioned
Show Correct Answer
Correct Answer is :
FALSE
9. What is the output of the following? print("abcdef".find("cd"))
A. TRUE
B. 2
C. 3
D. None of the mentioned
Show Correct Answer
Correct Answer is :
2
10. What is the output of the following? print("ccdcddcd".find("c"))
A. 4
B. 0
C. Error
D. TRUE
Show Correct Answer
Correct Answer is :
0
11. What is the output of the following? print("Hello {0} and {1}".format('foo', 'bin'))
A. Hello foo and bin
B. Hello {0} and {1} foo bin
C. Error
D. Hello 0 and 1
Show Correct Answer
Correct Answer is :
Hello foo and bin
12. What is the output of the following? print("Hello {1} and {0}".format('bin', 'foo'))
A. Hello foo and bin
B. Hello bin and foo
C. Error
D. None of the mentioned
Show Correct Answer
Correct Answer is :
Hello foo and bin
13. What is the output of the following? print("Hello {} and {}".format('foo', 'bin'))
A. Hello foo and bin
B. Hello {} and {}
C. Error
D. Hello and
Show Correct Answer
Correct Answer is :
Hello foo and bin
14. What is the output of the following? print("Hello {name1} and {name2}".format('foo', 'bin'))
A. Hello foo and bin
B. Hello {name1} and {name2}
C. Error
D. Hello and
Show Correct Answer
Correct Answer is :
Error
15. What is the output of the following? print("Hello {name1} and {name2}".format(name1='foo', name2='bin'))
A. Hello foo and bin
B. Hello {name1} and {name2}
C. Error
D. Hello and
Show Correct Answer
Correct Answer is :
Hello foo and bin
16. What is the output of the following? print("Hello {0!r} and {0!s}".format('foo', 'bin'))
A. Hello foo and foo
B. Hello ‘foo’ and foo
C. Hello foo and ‘bin’
D. Error
Show Correct Answer
Correct Answer is :
Hello ‘foo’ and foo
17. What is the output of the following? print("Hello {0} and {1}".format(('foo', 'bin')))
A. Hello foo and bin
B. Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’)
C. Error
D. None of the mentioned
Show Correct Answer
Correct Answer is :
Error
18. What is the output of the following? print("Hello {0[0]} and {0[1]}".format(('foo', 'bin')))
A. Hello foo and bin
B. Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’)
C. Error
D. None of the mentioned
Show Correct Answer
Correct Answer is :
Hello foo and bin
19. What is the output of the following? print('The sum of {0} and {1} is {2}'.format(2, 10, 12))
A. The sum of 2 and 10 is 12
B. Error
C. The sum of 0 and 1 is 2
D. None of the mentioned
Show Correct Answer
Correct Answer is :
The sum of 2 and 10 is 12
20. What is the output of the following? print('The sum of {0:b} and {1:x} is {2:o}'.format(2, 10, 12))
A. The sum of 2 and 10 is 12
B. The sum of 10 and a is 14
C. The sum of 10 and a is c
D. Error
Show Correct Answer
Correct Answer is :
The sum of 10 and a is 14
Similar Interview Questions
Search for latest jobs
Find Jobs