Python Input and Output Quiz

This python input and output quiz help you understand print() and input() built-in function. Also covered questions of file handling.

1. What is the output of the following program

print('{0:.2}'.format(1.0 / 3))

 

 
 
 

2. What is the output of the following program

print('{0:-2%}'.format(1.0 / 3))

 

 
 
 
 

3. What is the output of the following print() function

 
 
 

4. In Python3, Whatever you enter as input, the input() function converts it into a string

 
 

5. Which of the following is incorrect file handling mode in Python

 
 
 
 

6. What is true for file mode x

 
 
 

7. Use the following file to predict the output of the code

test.txt Content:

aaa
bbb
ccc
ddd
eee
fff
ggg

Code:

f = open("test.txt", "r")
print(f.readline(3))
f.close()

 

 
 
 
 

8. What is the output of the following code?

print('%x, %X' % (10, 10))

 

 
 
 
 

9. Which of the following is incorrect file handling mode in Python

 
 
 
 

10. In Python3, which functions are used to accept input from the user

 
 
 
 

11. What is the output of the expression : 3*1**3

 
 
 
 

12. What is the output of

print('[%c]' % 65)

 

 
 
 
 

13. What will be displayed as an output on the screen

 
 
 

Also play following quizzes

Support CodeSnail

If you appreciate my work, or if it has helped you along your journey. It would mean a lot to me if you could write a message on my wall and share a cup of coffee (or tea) with me.

Buy Me A Coffee

Related Articles

Your subscription could not be saved. Please try again.
Your subscription has been successful.

Newsletter

Subscribe to our newsletter and stay updated.

Leave a Comment

Copy link
Powered by Social Snap