Questions and CORRECT Answers
The data in __________ is persistent so it is not lost when an application ends.
disk storage
the application software
main memory
the CPU - CORRECT ANSWER - disk storage
The data in __________ is lost when an application ends.
main memory
the application software
disk storage
the CPU - CORRECT ANSWER - main memory
Python is considered a good first language to learn because:
it has a simple syntax
Powerful for all-purpose programming
All of the choices are True
Programs can be written quickly. - CORRECT ANSWER - All of the choices are True
The correct order of operation in programming (a.k.a. Precedence Rules) is the following:
Parenthesis, Power, Multiplication, Addition, Left to Right
Left to Right, Parenthesis, Power, Multiplication, Addition
,Power, Parenthesis, Multiplication, Addition, Left to Right
Parenthesis, Power, Multiplication, Left to Right, Addition - CORRECT ANSWER -
Parenthesis, Power, Multiplication, Addition, Left to Right
The data type resulting from the following statement is
print()
integer
float
number
string - CORRECT ANSWER - float
Python comments
are ignored by the compiler
can be used to document what a program or portion of code does
can be used so certain lines of code are not executed during testing
all are true - CORRECT ANSWER - all are true
What, if anything, is wrong with this code?
rating = input("Enter the rating for this product: ")
rating = rating + 2
print("The adjusted rating is " + rating + ".")
nothing is wrong with this code
a string variable is used in an arithmetic expression
the coding in the print() function contains illegal plus signs
, the input() function should be an int() function - CORRECT ANSWER - a string variable
is used in an arithmetic expression
Which of the following data types would you use to store the number 25.62?
str
int
num
float - CORRECT ANSWER - float
Which of the following is not a reserved word in Python?
(Hint: It could be used as the name of a variable.)
pass
Number
import
break - CORRECT ANSWER - Number
Given: x = 23 , y = 15
What is the value of new_num after the following statement executes?
new_num = x % y
1
1.533333
.533333
8 - CORRECT ANSWER -8
What will be the result of the following code if the user enters 81 at the prompt?