Deck 1: Introduction to Python: Introduction to Numeric Types, Turtle Graphics, Simple for Loops and Functions
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/34
Play
Full screen (f)
Deck 1: Introduction to Python: Introduction to Numeric Types, Turtle Graphics, Simple for Loops and Functions
1
How does your text differentiate the three levels of problem-solving?
A) Input, variables, and output
B) Strategy, tactics, and tools
C) Algorithms, programs, and plans
D) Analysis, implementation, and execution
A) Input, variables, and output
B) Strategy, tactics, and tools
C) Algorithms, programs, and plans
D) Analysis, implementation, and execution
B
2
You are working out a solution to a problem with the tips given in Chapter 1 of your text. What technique enables you to go from some specific examples of a solution-to a solution that can be implemented as a program?
A) Generalization
B) Simplification
C) Representation
D) Visualization
A) Generalization
B) Simplification
C) Representation
D) Visualization
A
3
You can type commands interactively at the Python shell by opening the Python interpreter and starting a(n):
A) expression.
B) listing.
C) session.
D) object.
A) expression.
B) listing.
C) session.
D) object.
C
4
Whole numbers in Python are called:
A) complex numbers.
B) decimals.
C) floating point numbers.
D) integers.
A) complex numbers.
B) decimals.
C) floating point numbers.
D) integers.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
5
You have entered a calculation in the Python interpreter. To see the result of this calculation, which key would you press?
A) Spacebar
B) Tab
C) Enter (or Return)
D) =
A) Spacebar
B) Tab
C) Enter (or Return)
D) =
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
6
What is the Python prompt?
A) >>
B) >>>
C) #
D) //
A) >>
B) >>>
C) #
D) //
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
7
What is the result of the expression 15//2?
A) 1
B) 7
C) 7.7
D) 30
A) 1
B) 7
C) 7.7
D) 30
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
8
What is the result of the expression 15/2?
A) 1
B) 7
C) 7.5
D) 8
A) 1
B) 7
C) 7.5
D) 8
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
9
What do you use to associate an object name with an expression in Python?
A) Object space
B) Key label
C) Assignment statement
D) Abstract reference
A) Object space
B) Key label
C) Assignment statement
D) Abstract reference
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
10
The name that allows us to locate a Python object is a(n):
A) algorithm.
B) assignment.
C) operand.
D) variable.
A) algorithm.
B) assignment.
C) operand.
D) variable.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
11
Case Study 1:
Consider the following sequence of assignment statements:
>>> x = 15
>>> y = 25
>>> x = y
-What is the value of x after the first line?
A) 0
B) 15
C) 25
D) y
Consider the following sequence of assignment statements:
>>> x = 15
>>> y = 25
>>> x = y
-What is the value of x after the first line?
A) 0
B) 15
C) 25
D) y
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
12
Case Study 1:
Consider the following sequence of assignment statements:
>>> x = 15
>>> y = 25
>>> x = y
-What is the value of x after the last line?
A) 0
B) 15
C) 25
D) z
Consider the following sequence of assignment statements:
>>> x = 15
>>> y = 25
>>> x = y
-What is the value of x after the last line?
A) 0
B) 15
C) 25
D) z
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
13
Case Study 2:
The turtle module provides us with a simple graphics programming tool known as a "turtle." Very simply, a turtle is an object that we can control. A turtle can move forward or backward, and it can turn in any direction. When a turtle moves, it draws a line if its tail is down. A turtle object has both attributes and methods.
-One of the attributes of a turtle is:
A) color.
B) forward.
C) down.
D) dot.
The turtle module provides us with a simple graphics programming tool known as a "turtle." Very simply, a turtle is an object that we can control. A turtle can move forward or backward, and it can turn in any direction. When a turtle moves, it draws a line if its tail is down. A turtle object has both attributes and methods.
-One of the attributes of a turtle is:
A) color.
B) forward.
C) down.
D) dot.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
14
Case Study 2:
The turtle module provides us with a simple graphics programming tool known as a "turtle." Very simply, a turtle is an object that we can control. A turtle can move forward or backward, and it can turn in any direction. When a turtle moves, it draws a line if its tail is down. A turtle object has both attributes and methods.
-The turtle method ____ does not take any parameters.
A) forward
B) position
C) right
D) fillcolor
The turtle module provides us with a simple graphics programming tool known as a "turtle." Very simply, a turtle is an object that we can control. A turtle can move forward or backward, and it can turn in any direction. When a turtle moves, it draws a line if its tail is down. A turtle object has both attributes and methods.
-The turtle method ____ does not take any parameters.
A) forward
B) position
C) right
D) fillcolor
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
15
Case Study 2:
The turtle module provides us with a simple graphics programming tool known as a "turtle." Very simply, a turtle is an object that we can control. A turtle can move forward or backward, and it can turn in any direction. When a turtle moves, it draws a line if its tail is down. A turtle object has both attributes and methods.
-Assume you have created a turtle instance. What is the result of calling the position method?
A) (0.0)
B) (0.00, 0.00)
C) (50.00, 50.00)
D) (100.00, 100.00)
The turtle module provides us with a simple graphics programming tool known as a "turtle." Very simply, a turtle is an object that we can control. A turtle can move forward or backward, and it can turn in any direction. When a turtle moves, it draws a line if its tail is down. A turtle object has both attributes and methods.
-Assume you have created a turtle instance. What is the result of calling the position method?
A) (0.0)
B) (0.00, 0.00)
C) (50.00, 50.00)
D) (100.00, 100.00)
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
16
Consider the following for loop template. How many times will statement1 be executed?
For i in range(5):
Statement1
Statement2
)..
A) 0
B) 1
C) 5
D) n
For i in range(5):
Statement1
Statement2
)..
A) 0
B) 1
C) 5
D) n
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
17
Given the following function definition, which of the statements below produces a square?
Def drawPolygon(myTurtle, sideLength, numSides):
TurnAngle = 360 / numSides
For i in range(numSides):
MyTurtle.forward(sideLength)
MyTurtle.right(turnAngle)
A) drawPolygon(t, 100, 4)
B) drawPolygon(t, 100, 8)
C) drawPolygon(t, 50, 20)
D) drawPolygon(t, 20, 20)
Def drawPolygon(myTurtle, sideLength, numSides):
TurnAngle = 360 / numSides
For i in range(numSides):
MyTurtle.forward(sideLength)
MyTurtle.right(turnAngle)
A) drawPolygon(t, 100, 4)
B) drawPolygon(t, 100, 8)
C) drawPolygon(t, 50, 20)
D) drawPolygon(t, 20, 20)
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
18
Machine learning is providing key help on the forefront of diagnosing disease.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
19
The best way to learn Python is to read through a textbook before typing any commands to ensure that you understand the key concepts first.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
20
At a high level, the Python interpreter simply does two things over and over again: (1) read and (2) write.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
21
When converting floating-point numbers to integers, Python always truncates the fractional part of the number.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
22
The Python language contains many abstractions that are built by using Python elements. In other words, much of Python is written in Python.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
23
1. Match each definition with its term.
-Used by Python to classify different kinds of objects.
A) Type
B) Expression
C) Variable
D) Constructor
E) Program
-Used by Python to classify different kinds of objects.
A) Type
B) Expression
C) Variable
D) Constructor
E) Program
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
24
1. Match each definition with its term.
-A combination of operators and operands.
A) Type
B) Expression
C) Variable
D) Constructor
E) Program
-A combination of operators and operands.
A) Type
B) Expression
C) Variable
D) Constructor
E) Program
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
25
1. Match each definition with its term.
-The name found on the left side of the equals sign in an expression.
A) Type
B) Expression
C) Variable
D) Constructor
E) Program
-The name found on the left side of the equals sign in an expression.
A) Type
B) Expression
C) Variable
D) Constructor
E) Program
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
26
1. Match each definition with its term.
-A method that creates a new object.
A) Type
B) Expression
C) Variable
D) Constructor
E) Program
-A method that creates a new object.
A) Type
B) Expression
C) Variable
D) Constructor
E) Program
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
27
1. Match each definition with its term.
-Step-by-step instructions that provide a solution to a problem.
A) Type
B) Expression
C) Variable
D) Constructor
E) Program
-Step-by-step instructions that provide a solution to a problem.
A) Type
B) Expression
C) Variable
D) Constructor
E) Program
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
28
Illustrate how computer science is used every day with an example.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
29
You have been asked to answer the following question: "A class has 12 students. At the beginning of class, each student shakes hands with each of the other students. How many handshakes take place?" Explain how you would use a simplification strategy to answer this question.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
30
Describe the types of primitive objects that Python provides for working with numbers.
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
31
Explain how the Python interpreter evaluates the statement below.
name = python expression
name = python expression
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
32
Describe the rules that Python imposes on the possible values for name in the statement below.
name = python expression
name = python expression
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
33
What is abstraction, and how does this concept relate to a "black box?"
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck
34
The expression turtle.Turtle() contains the dot(.) operator. What is the purpose of this operator?
Unlock Deck
Unlock for access to all 34 flashcards in this deck.
Unlock Deck
k this deck