Python MCQ’s | Data types 3

11.
Which of the following results in a SyntaxError?

a) ‘”Once upon a time…”, she said.’
b) “He said, ‘Yes!’”
c) ‘3\’
d) ”’That’s okay”’

12.
The following is displayed by a print function call. Select all of the function calls that result in this output.

tom
dick
harry
a)

print(”’tom
\ndick
\nharry”’)
b) print(”’tomdickharry”’)
c) print(‘tom\ndick\nharry’)
d)

print(‘tom
dick
harry’)

13.
What is the average value of the following Python code snippet?

>>>grade1 = 80
>>>grade2 = 90
>>>average = (grade1 + grade2) / 2
a) 85.0
b) 85.1
c) 95.0
d) 95.1

14. Select all options that print.

hello-how-are-you

a) print(‘hello’, ‘how’, ‘are’, ‘you’)
b) print(‘hello’, ‘how’, ‘are’, ‘you’ + ‘-‘ * 4)
c) print(‘hello-‘ + ‘how-are-you’)
d) print(‘hello’ + ‘-‘ + ‘how’ + ‘-‘ + ‘are’ + ‘you’)

15.
What is the return value of trunc()?

a) int
b) bool
c) float
d) None

Visitor Counter

0056702