Looks like no one added any tags here yet for you.
John von Neumann is known for the observation that the number of transistors that fit on a computer chip doubles every year
False
The term hertz can be used to describe a computer's speed.
True
Information in secondary memory is lost if the power is turned off.
False
What components are part of the von Neumann model?
control unit, arithmetic logic unit, memory, input and output
Who developed the Python programming language?
Guido van Rossum
Python is a general-purpose programming language, appropriate for solving problems in many areas of computing.
True
The Python programming language was so named after a snake was discovered in the creator's office.
False
Python 3 is backwards compatible to Python 2.
False
Python embodies elements of which programming paradigm?
Procedural programming
Object-oriented programming
Functional programming
Which of the following is NOT a principle embraced by the Python programming language?
Verbose is better than succinct
Thonny is best described as which of the following?
Integrated Development Environment(IDE)
The output of a Python program run in Thonny appears in the shell window.
True
Thonny displays code using syntax highlighting.
True
Running a program that contains errors will cause the Thonny development environment to terminate.
False
Thonny has a package manager that lets you install and update external Python packages.
True
A Python program must be enclosed in curly braces { }
to be executed.
False
Which of the following statements is true??
The print
statement is a call to a function.
A Python program must compiled into an executable form before it can be run.
False
What is syntax coloring?
Showing certain elements of program code in different color
What does the term case sensitive mean?
The difference between upper and lowercase letters matter
Why don't we use natural languages (like English) to program a computer?
Natural languages are semantically ambiguous
What is the syntax of a language?
The rule that determine how words and symbols can be combined
In a programming language, a syntactically valid statement has only one meaning.
True
A program that runs without generating a runtime error will produce correct results.
False
Which of the following would cause a syntax error?
Misspelling a keyword
Which of the following would cause a runtime error?
Dividing by zero
Computing the wrong answer is an example of what kind of error?
logic error
Debugging is the process of:
Finding the root cause of an error and fixing it
The code you write is called Python bytecode.
False
To run a Python program, the interpreter combines your code with any library code your program uses.
True
Python bytecode is not associated with any particular type of computer processor.
True
The Python package installer is called pip.
True
A graphical representation of the logic of an algorithm.
flowchart
A step-by-step procedure for solving a problem.
algorithm
The data needed by an algorithm to accomplish its task.
input
The level at which an instruction is expressed.
granularity
A language that humans use to communicate, such as French or English.
natural language
The data produced by an algorithm.
output
A language that is independent of any particular programming language.
pseudocode
What output does the following code produce?
print(‘apple’ , ‘banana’)
apple banana
What output is produced by the following code?
print(15+30)
45
What output does the following code produce?
print('Ready', end=' ')
print('Set', end='')
print('Go')
Ready SetGo
What output is produced by the following code?
print('Jan', 'Feb', 'Mar', sep='-')
Jan-Feb-Mar
What output is produced by the following code?
print('oak', 'elm', 'pine', end='!', sep='#')
oak#elm#pine!
What operator is used to perform string concatenation in Python?
+
What output does the following code produce?
print('Total: ' + 100 + 20)
No output. This line would produce an error. (You cant concatenate a string and an integer)
What issue must be addressed when printing a long character string?
A regular string literal cannot span across multiple lines. (use triple quote)
If a variable called pioneer
refers to the string 'Grace Murray Hopper'
, what is the result of the expression len(pioneer)
?
19
If a variable called business
refers to the string 'Time Warner'
, what is the result of the expression business[6]
?
‘a’
If a variable called son
refers to the string 'Justin'
, what is the result of the expression son[-3]
?
‘t’
You cannot change the contents of Python character string once it has been created.
True
If a variable called jedi
refers to the string 'Yoda'
, what is the result of the expression jedi * 3
?
YodaYodaYoda
Python comments begin with a hash mark (#
) and extend to the end of the line
True
A comment in a Python program is ignored by the interpreter.
True
A Python comment cannot appear on a line that contains an executable statement.
False
A Python block comment begins with a double slash (//
).
False
What is a docstring?
A character string used as a comment in a program.
Python variables that represent integers are NOT object reference variables.
False
In dynamically typed languages, variables are declared to store a specific type of data.
False
Which of the following identifiers follows the convention for naming Python variables?
total_value
Which of the following is NOT a valid Python identifier?
1stPlace
The value of a variable can change throughout a program.
True
Python variables are created using an assignment statement.
True
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.
hour // 24
If the variable num
contains a positive integer, what are the only two possible results of the expression num % 2
?
0 and 1
What is the result of the expression 43 % 5
?
3
What is the result of the expression 7 // 2
?
3
The math
module contains a constant that represents the value pi to several digits.
True
The expression x ^ y
raises the value x to the power y.
False
If both operands to the remainder operator (%
) are positive, a divisor of n will produce a result in the range 1 to n.
False
If either or both operands to the division operator (//
) are floating-point values, then the result will be a floating-point value.
True
The value assigned to a variable could be a floating point number.
True
In Python, the assignment statement is also an expression.
False
The value assigned to a variable must be numeric.
False
What value is assigned to the variable num
by the following statement if the current value of num
is 4?
num = num * 2
8
The assignment operator has higher precedence than the arithmetic operators.
False
The input
function will produce an error if the value read is not numeric.
False
The input
, int
, and float
functions are all built-in functions.
True
The input
function always returns the read data as a character string.
True
What is text that requests user input called?
prompt
Which of the following does the input
function NOT do when it is called?
convert the user input to an integer
What will happen if the variable total
has the value 5 when the following code is executed?
if total > 8:
print('collywobbles')
The word collywobbles is not printed and processing continues
Which value of num
will cause the print
statement in the following code to be executed?
if num < 15:
if num + 7 >= 20:
print('There you go!')
13
3
What output is printed by the following code if it is executed when appetizer
is 3 and entree
is 12?
if appetizer > 1:
if entree < 7:
print('ketchup')
else:
print('mustard')
else:
if appetizer < 0:
print('mayonnaise')
else:
print('relish')
mustard
Which of the following statements is true?
The statements in the body of an if must be indented
Of the options given, what values of the variables height
, size
, and width
would cause the following code to set the variable weight
to 100?
if height < size:
weight = 50
if width < 20:
print('short')
else:
if width > 100:
weight = 100
println('tall')
height = 15, size = 10, width = 110
An if
statement cannot have both an elif
and an else
clause.
False
The relational operators all return boolean results.
True
The result of a relational operator can be assigned to a variable.
True
The arithmetic operators have a lower precedence than the relational operators.
False
Which of the following is a relational operator?
<=
Which of the following expressions could be used to determine if a
is not less than b
?
a>=b
In Python, the relational operators can be used to put character strings in alphabetical order.
True
The less than operator (<
) should not be used to compare floating point values.
False
A character string can be used as the condition of an if
statement.
True
Strings containing non-alphabetic characters cannot be compared using the relational operators.
False
Which of the following conclusions is NOT true when using relational operators to compare character strings?
‘reset’ come before ‘reserve’
Which of the following conclusions is NOT true when using relational operators to compare character strings?
‘fantastic’ comes before ‘Great’
When using relational operators to compare character strings, 'ZEBRA'
comes before 'ALLIGATOR'
.
False
When using relational operators to compare character strings, 'Music'
comes before 'music'
.
True