Unit 6 Review

Unit 6 Review

9th - 12th Grade

11 Qs

quiz-placeholder

Similar activities

Microsoft Excel

Microsoft Excel

10th Grade

10 Qs

WJEC GCSE ICT Unit 1 E-Mail

WJEC GCSE ICT Unit 1 E-Mail

9th - 10th Grade

13 Qs

Unit 8 Practice Test For CSP

Unit 8 Practice Test For CSP

9th Grade

16 Qs

Základní části počítače a ergonomie

Základní části počítače a ergonomie

9th - 10th Grade

16 Qs

ExamenHojasdecalculo

ExamenHojasdecalculo

10th Grade

10 Qs

Java: repetition control structure for & while

Java: repetition control structure for & while

10th - 12th Grade

10 Qs

LA1.C1: Introduction to Small Basic

LA1.C1: Introduction to Small Basic

9th Grade

15 Qs

Simdig

Simdig

12th Grade - University

10 Qs

Unit 6 Review

Unit 6 Review

Assessment

Quiz

Computers

9th - 12th Grade

Medium

Created by

Julia McGreal

Used 15+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

11 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which of the following is the correct way to declare a function in Python?

print_hello: print("hello")
function print_hello(): print ("hello")
print_hello(): print("hello")
def print_hello(): print("hello")

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which of the following code samples correctly passes the number 10 as an argument to the function print_number?

print_number(10)
print_number(), print 10
10(print_number)
print print_number, print 10

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Consider this code snippet. x = 10, def add_nums(): y = 2, z = x + y, print(z) Which of the following additional functions could be safely added to this code, without causing an error?

def subtract_nums(): z = x - y, print(z)
def subtract_nums():, z = z - x, print(z)
def subtract_nums():, y = 5, z = x - y, print(z)
def subtract_nums(): z = y, z = x - y, print(z)

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which of the following functions successfully returns the number 10?

def my_function(): 10
def my_function(10): return
def my_function(): return 10
def my_function(): print(10)

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What type of error occurs when a program is expecting an integer value and the user enters a string?

NumberError
ValueError
InputError
ZeroDivisionError

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Why do programmers use try and except statements when their code might throw an exception?

So that the programmer can disregard the exception and do what he/she wants anyways
Because Python requires it
To handle exceptions gracefully and either handle the error or print out a useful error message.
Exceptions only are thrown when there are try and except statements. Otherwise, the program will just fail and the programmer will have no idea why it failed.

7.

MULTIPLE CHOICE QUESTION

45 sec • 5 pts

Which of the programs below will print the following output?

I would like a green balloon.

def balloon_choice(color): print("I would like a " + color + " balloon.") balloon_choice("green")

def balloon_choice(color): print("I would like a " + color + " balloon.")

def balloon_choice(): print("I would like a " + color + " balloon.") balloon_choice("green")

def balloon_choice(): print("I would like a green balloon.") balloon_choice("green")

Create a free account and access millions of resources

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

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?