Search Header Logo

Python Programming Quiz

Authored by Manzoor Ahmed

Computers

University

Used 4+ times

Python Programming Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

What the is output of the above code?

3

7

13

14

15

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which of the following print statements will print all the names in the list on a seperate line

names = ['Ramesh', 'Rajesh', 'Roger', 'Ivan', 'Nico']

print("\n".join(names))

print(names.join("\n"))

print(names.concatenate("\n"))

print(names.append("\n"))

print(names.join("%s\n", names))

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which module in Python supports regular expressions?

regex

re

pyregex

none of the mentioned

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following creates a pattern object?

re.create(str)

re.regex(str)

re.assemble(str)

re.compile(str)

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What will be the output of the following Python code?

sentence = 'we are humans'

matched = re.match(r'(.*) (.*?) (.*)', sentence)

print(matched.groups())

(‘we’, ‘are’, ‘humans’)

(we, are, humans)

(‘we’, ‘humans’)

‘we are humans’

6.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Media Image

What will be the output of the above Python code?

{‘animal’: ‘horses’, ‘verb’: ‘are’, ‘adjective’: ‘fast’}

(‘horses’, ‘are’, ‘fast’)

‘horses are fast’

'are'

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Media Image

What will be the output of the above Python code?

{‘animal’: ‘horses’, ‘verb’: ‘are’, ‘adjective’: ‘fast’}

(‘horses’, ‘are’, ‘fast’)

‘horses are fast’

‘are’

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?