Python Logical Operators Quiz

Python Logical Operators Quiz

9th Grade

10 Qs

quiz-placeholder

Similar activities

Python Loops

Python Loops

9th - 11th Grade

12 Qs

10 CS // Pseudocode

10 CS // Pseudocode

9th - 11th Grade

10 Qs

Python 2

Python 2

9th - 12th Grade

10 Qs

grade9-whileloop

grade9-whileloop

9th Grade

10 Qs

Guided Notes 5.2 Python For Loop

Guided Notes 5.2 Python For Loop

9th Grade

10 Qs

GCSE Computer Science - Programming Keywords

GCSE Computer Science - Programming Keywords

9th - 12th Grade

15 Qs

Python_R

Python_R

2nd Grade - Professional Development

8 Qs

Y9 - Module 2 - KT1 Python Basics

Y9 - Module 2 - KT1 Python Basics

9th Grade

14 Qs

Python Logical Operators Quiz

Python Logical Operators Quiz

Assessment

Quiz

Computers

9th Grade

Easy

Created by

JASON SAMMONS

Used 1+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 3 pts

Which of the following is not a logical operator in Python?

AND

OR

NOT

BECAUSE

2.

MULTIPLE CHOICE QUESTION

30 sec • 3 pts

Which of the following conditions tell me to sleep if my alarm did not go off (alarm = False) and I’m tired (tired = True)?

if alarm and tired: sleep

if not alarm or tired: sleep

if not alarm and tired: sleep

if not alarm and not tired: sleep

3.

FILL IN THE BLANK QUESTION

30 sec • 3 pts

How would you round the number held in the variable pi to 3.14?

4.

MULTIPLE CHOICE QUESTION

30 sec • 3 pts

Why should you use round when you compare two numbers that have type float?

If you don’t, Python will only compare the whole part and discard the decimal part.

You don’t have to, but it’s good style. All of the comparisons will still work out the same way.

Sometimes numbers can be rounded in unexpected ways based on how Python computes them. Therefore, it is best to use round in order to make sure both numbers are rounded the same way.

You should always use round when you compare two numbers, even if they are of type int.

5.

MULTIPLE CHOICE QUESTION

30 sec • 3 pts

How many lines will this program print? while True: print("hi")

1 line

100 lines

No lines at all

6.

MULTIPLE CHOICE QUESTION

30 sec • 3 pts

How many lines will this program print? x = 10 while x > 0: print(x) x = x - 3 Type the numeric response below.

4

3

5

6

7.

MULTIPLE CHOICE QUESTION

30 sec • 3 pts

Which of the following best describes the purpose of a for loop?

A for loop is for doing something an indeterminate number of times.

A for loop is doing something an infinite number of times.

A for loop is for doing something a fixed number of times.

A for loop is for doing something three times.

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?