Question 1
To redirect the output of the print( ) function to a file, which symbol is used?
Question 2
The input() function returns data in which data type?
Question 3
What is the purpose of the sep parameter in the print( ) function?
Question 4
Which function is used to remove trailing whitespaces from a string in python?
Question 5
Which placeholder is used to format an integer in a string using the format( ) method?
Question 6
What is the output of the following code?
name = "john"
age = 30
print("my name is {} and I am {} years old.".format(name))
Question 7
What is the default separator between multiple items printed using the print( ) function?
Question 8
To print output to the console in python, which function is used?
Question 9
Which function is used to format a string in python?
Question 10
What is the output of the following code?
data = "1 2 3 4"
numbers = data.split()
sum = 0
for num in numbers:
sum +=int(num)
print(sum)
Question 11
What does the 'encoding' parameter specify when opening a file in python?
Question 12
What happens when the input( ) function encounters an end-of-file (EOF) while reading?