Python Workshop 4 Review

Python Workshop 4 Review

University

10 Qs

quiz-placeholder

Similar activities

J277 - 2.2 - Use of Arrays up to 2D

J277 - 2.2 - Use of Arrays up to 2D

10th Grade - University

8 Qs

Python For

Python For

University

10 Qs

PDS - 04225 - Recursion - Chapter 12

PDS - 04225 - Recursion - Chapter 12

University

10 Qs

Python Revision

Python Revision

University

10 Qs

Programação - Loops e Arrays

Programação - Loops e Arrays

University - Professional Development

13 Qs

Q3 - Comp Vision

Q3 - Comp Vision

University

10 Qs

Python Functions and Docstrings Quiz

Python Functions and Docstrings Quiz

University

12 Qs

HCI 584 Python quiz

HCI 584 Python quiz

University

15 Qs

Python Workshop 4 Review

Python Workshop 4 Review

Assessment

Quiz

Computers

University

Hard

Created by

Logan Dane

Used 1+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What is the output of this Python code?

for x in range(0,2):

for y in range(0,2):

print("loop run")

loop run loop run loop run loop run
loop run loop run loop run
loop run loop run
loop run

2.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What is the output of this Python code?

arr = [“red”, “blue”, “green”]

for x in arr:

print(x)

green

blue

red

red blue
red blue green
red

3.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What keyword do you use to define a function in Python?

class
def
function
var

4.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What reason is there to use functions in your code?

To increase the chances of bugs and errors in the code.
To make the code more complicated and difficult to understand.
To reuse code and improve code organization.
To waste time and make the code less efficient.

5.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What is the proper structure of a function in Python?

def function_name():
function_name():
function def():
def function_name:

6.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What is the structure for using parameters in a function in Python?

Parameters are defined within the curly braces of a function in Python.
Parameters are defined within the brackets of a function in Python.
Parameters are defined within the square brackets of a function in Python.
Parameters are defined within the parentheses of a function in Python.

7.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What does a return statement do in Python?

A return statement in Python is used to exit a loop and return a value.
A return statement in Python is used to print a value.
A return statement in Python is used to exit a function and return a value.
A return statement in Python is used to define a variable.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?