Python interview questions part 54

Python interview questions part 54

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('{:,}'.format(1112223334))

Correct Answer is : 1112223334

2. What is the output of the following? print('{:,}'.format('1112223334'))

Correct Answer is : Error

3. What is the output of the following? print('{:$}'.format(1112223334))

Correct Answer is : Error

4. What is the output of the following? print('{:#}'.format(1112223334))

Correct Answer is : 1112223334

5. What is the output of the following? print('{0:.2}'.format(1/3))

Correct Answer is : 0.33

6. What is the output of the following? print('{0:.2%}'.format(1/3))

Correct Answer is : 0.3333

7. What is the output of the following? print('ab12'.isalnum())

Correct Answer is : TRUE

8. What is the output of the following? print('ab,12'.isalnum())

Correct Answer is : FALSE

9. What is the output of the following? print('ab'.isalpha())

Correct Answer is : TRUE

10. What is the output of the following? print('a B'.isalpha())

Correct Answer is : FALSE

11. What is the output of the following? print('0xa'.isdigit())

Correct Answer is : FALSE

12. What is the output of the following? print(''.isdigit())

Correct Answer is : FALSE

13. What is the output of the following? print('my_string'.isidentifier())

Correct Answer is : TRUE

14. What is the output of the following? print('__foo__'.isidentifier())

Correct Answer is : TRUE

15. Which of the following functions can help us to find the version of python that we are currently working on?

Correct Answer is : sys.version

16. Which of the following functions is not defined under the sys module?

Correct Answer is : sys.readline

17. The output of the functions len(“abc”) and sys.getsizeof(“abc”) will be the same. State whether true or false.

Correct Answer is : FALSE

18. What is the output of the code shown below, if the code is run on Windows operating system? import sys if sys.platform[:2]== 'wi': print("Hello")

Correct Answer is : Hello

19. What is the output of the following line of code, if the sys module has already been imported? sys.stdout.write("hello world")

Correct Answer is : hello world11

20. What is the output of the code shown below? import sys sys.stdin.readline() Sanfoundry

Correct Answer is : ‘Sanfoundry\n’

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon