Python Week 2

¡Supera tus tareas y exámenes ahora con Quizwiz!

True

Built-in functions of the Python Standard Library can be used without being imported.

gray

Equal contributions of the three components in an RGB color results in various shades of what?

True

Full documentation about the Python Standard Library can be found online. True

True

If a filled shape drawn by a turtle is not fully enclosed, Python fills the shape as if the starting point is connected to the end point.

'a'

If a variable called business refers to the string 'Time Warner', what is the result of the expression business[6]?

YodaYodaYoda

If a variable called jedi refers to the string 'Yoda', what is the result of the expression jedi * 3?

19

If a variable called pioneer refers to the string 'Grace Murray Hopper', what is the result of the expression len(pioneer)?

't'

If a variable called son refers to the string 'Justin', what is the result of the expression son[-3]?

False

If both operands to the remainder operator (%) are positive, a divisor of n will produce a result in the range 1 to n.

True

If either or both operands to the division operator (//) are floating-point values, then the result will be a floating-point value.

0.5

If the current value of the variable num1 is 2 and the current value of the variable num2 is 3, what value will be stored in num2 after the following line of code is executed? num2 /= num1 * num2

6

If the current value of the variable size is 2, what value will be stored in size after the following line of code is executed? size *= 3

up and right (northeast)

If the turtle is currently facing up (north), which way would it be facing after executing the command turtle.right(45)?

0 and 1

If the variable num contains a positive integer, what are the only two possible results of the expression num % 2?

False

Python represents a color using the CMYK color model.

True

Setting the turtle's speed to 0 turns off the animation of the turtle movement completely.

hours // 24

Suppose the integer variable hours contains a value that represents a number of hours. Which of the following expressions will compute how many 24-hour periods are represented by that value, without worrying about any leftover hours.

False

Using components from the Python Standard Library is a rare occurrence.

A collection of programming components that can be used in any Python program.

What is the Python Standard Library?

3

What is the result of the expression 43 % 5?

3

What is the result of the expression 7 // 2?

12

What is the result of the expression math.floor(12.843)?

27

What is the result of the expression math.pow(3, 3)?

17

What is the result of the expression max(6, 17)?

A regular string literal cannot span across multiple lines.

What issue must be addressed when printing a long character string?

+

What operator is used to perform string concatenation in Python?

No output. This line would produce an error.

What output does the following code produce? print('Total: ' + 100 + 20)

depth = depth + (50 * offset)

Which line of code is equivalent to the following? depth += 50 * offset

Convert the user input to an integer.

Which of the following does the input function NOT do when it is called?

'#FFFFFF'

Which of the following hex strings represents the color white?

up and left (northwest)

Which way would the turtle be facing after executing the command turtle.setheading(135)?

down and right (southeast)

Which way would the turtle be facing after executing the following code? turtle.setheading(270) turtle.right(20) turtle.left(65)

8

If the current value of the variable count is 2, what value will be stored in count after the following line of code is executed? count += count * 3

6

If the current value of the variable num is 4, what value will be stored in num after the following line of code is executed? num += 2

False

The effect of the setheading depends on the current heading of the turtle.

prompt

What is text that requests user input called?

True

You cannot change the contents of Python character string once it has been created.

False

A turtle draws a filled circle using the fill_circle command.

False

All mathematical functions in Python are part of the math module.

True

The Python turtle graphics module is based on the programming language Logo developed in the 1960s.

False

The expression x ^ y raises the value x to the power y.

False

The goto command moves the turtle without drawing a line.

True

The human eye has three types of color receptors that correspond to wavelengths of red, green, and blue.

True

The input function always returns the read data as a character string.

False

The input function will produce an error if the value read is not numeric.

True

The input, int, and float functions are all built-in functions.

True

The math module contains a constant that represents the value pi to several digits.

True

The math.pi constant represents pi to 15 decimal places.

False

The origin point (0, 0) of the turtle coordinate system is in the upper left corner of the graphic screen.

True

The pen color and size determines the color and width of the lines drawn.

True

The position of a circle depends on the current heading of the turtle.

False

The stroke color of a filled turtle shape must be the same as the fill color.

True

The turtle circle command can be used to draw a regular polygon.

False

The webcolors module is part of the Python Standard Library.


Conjuntos de estudio relacionados

Kinesiology - Hip, Knee, Ankle, Back (Chapters 8-11)

View Set

L21 Ready-to-use Therapeutic Foods (RUTF's)

View Set

Mastering: Reproduction and Development

View Set