Search Header Logo

M2.2: SAQ 2.2

Authored by Parker Gaston

Other

University

Used 1+ times

M2.2: SAQ 2.2
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

21 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In short-circuit evaluation, Python stops evaluating a Boolean expression as soon as it knows the answer.

True

False

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The logical operators and, or, and not each take two operands.

True

False

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the "not equal to" operator in Python?

 

<>

 

!=

 

>=

 

<=

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Statements that evaluate to either True or False are called __________ .

 

Boolean expressions

 

logical expressions

 

relational expressions

 

Any of the above

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which statement evaluates to True?

 

5 != 5 or 9 < 6

 

6 < 15 and 6 < 7

 

9 < 10 and 10 < 10

 

not 9 < 10

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

When calculating pi using the Wallis formula, the accumulator variable:

 

is increased by two each iteration.

 

must be initialized to zero.

 

must be initialized to one.

 

is multiplied by two each iteration.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is wrong with this accumulator pattern, that is supposed to calculate the sum of all the multiples of seven between 1 and 100?

acc = 0

for x in range(0, 100, 7):

  acc = acc + x

 

The accumulator pattern is not used for multiplication

 

The accumulator variable is improperly initialized

 

The range function call does not produce the right terms

 

Nothing is wrong!

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?