Python Programming Quiz – print() and input() functions

Python Programming Quiz

1.  

How can you prevent the print() function from moving to a new line after output?

 
 
 
 

2.  

What will the following code do?

name = input(“Enter your name: “)
print(name)

 
 
 
 

3.  

Which of the following is used to get user input in Python?

 
 
 
 

4.  

What is the default end character in the print() function?

 
 
 
 

5.  

Which of the following is NOT true about the print() function?

 
 
 
 

6.  

What will be the output of the following code?

print(5 + 3)

 
 
 
 

7.  

What will be the output of the following code if the user enters Python?

language = input(“Favorite language: “)
print(“You like”, language)

 
 
 
 

8.  

What is the correct syntax to display “Hello, World!” in Python?

 
 
 
 

9.  

Which of the following statements will produce an error?

 
 
 
 

10.  

How do you display the text:

I love Python?

 
 
 
 

5 1 vote
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments