Loading

Quipoin Menu

Learn • Practice • Grow

python / Input and Output
mcq
Direction: Choose the correct option

Q1.

Which function is used to read input from the user?
A. input()
B. scan()
C. print()
D. read()
Direction: Choose the correct option

Q2.

What does `input()` return by default?
A. Integer
B. Float
C. List
D. String
Direction: Choose the correct option

Q3.

How do you print multiple items on the same line?
A. Both A and B
B. print('a' + 'b')
C. print('a', 'b')
D. print('a', 'b', sep='')
Direction: Choose the correct option

Q4.

What is the default separator in `print()`?
A. Newline
B. Comma
C. Tab
D. Space
Direction: Choose the correct option

Q5.

How can you change the separator in `print()`?
A. Use the `file` parameter
B. Use the `end` parameter
C. Use the `sep` parameter
D. Use the `flush` parameter
Direction: Choose the correct option

Q6.

How can you prevent `print()` from adding a newline at the end?
A. Set `end=''`
B. It's not possible
C. Set `no_newline=True`
D. Use `print()` without arguments
Direction: Choose the correct option

Q7.

What does `print('a', 'b', sep='-')` output?
A. a-b
B. a b
C. a,b
D. ab
Direction: Choose the correct option

Q8.

Which function converts a string to an integer?
A. str()
B. integer()
C. int()
D. float()
Direction: Choose the correct option

Q9.

Given `name = input()`, if user enters 'Alice', what is the value of `name`?
A. 'Alice'
B. 'Alice'
C. Alice
D. 'Alice'
Direction: Choose the correct option

Q10.

How do you write output to a file instead of the console?
A. Use `f.write()`
B. Use `print_to_file()`
C. Use the `file` parameter in `print()`
D. Both A and B