In IDLE, how do you open a new file in which to type your code?
B. File > New File
In IDLE, what color do keywords appear in?
A. Purple
What file extension is used for Python files?
D. py
What is the name of a program that translates high-level instruction all at once, before any code is run?
A. A compiler
Which of the following is the Python command prompt?
D. >>>
In Python, a set of characters that are enclosed in double quotes (" ") are known as what?
D. A literal string
What would happen if you typed the following Python statement at the Python command prompt?
print ("hello")
D. You would see the word hello on the screen
Which of the following statements regarding IDLE is correct?
A. IDLE is a free development environment for Python
Which of the following is a reserved keyword in Python?
B. else
In quote = "Hello" what is Hello?
B. a string
What function would you use to convert a text string such as "2.22" to a numeric value that can be used in a math operation?
D. float ()
How would you represent 2 to the 5th power in a math calculation?
D. 2 ** 5
What does the code "*" * 40 do?
A. Displays 40 asterisks in a row
Which of the following code segments will generate an error?
B. phrase = ""Thank you""
What is the result of the following line of code?
print ("why" * 3)
A. why why why
Which of the following operators computes the value of 5 squared?
B. **
What is the name of the library file that contains a variety of mathematical functions and constraints?
A. math
What will the following code print?
word = "abcdefg"
print (word[3:5])
C. de
Which of these is a Boolean condition?
C. true or false
In an if statement, which comes first?
C. The condition you are evaluating
In an if statement, where is a colon placed?
C. Between the condition and the statements to be performed if the condition is true
How would you use a relational operator to describe a condition where age does not equal 0?
B. age != 0
In Unicode sort order, which of these letters comes after the letter w?
C. None of these
An if-then-else statement is an example of what?
A. A two-way statement
An elif statement combines what other two statements into a single operation?
D. if and else
Using the following variables:
a = 1
b = 2
Which of the following statements will evaluate to false?
A. if a == 1 and b == 1:
B. if a == 1 or b == 1:
C. if a == 2 or b == 2:
D. if a == 1 or b == 2:
A. if a == 1 and b == 1:
Which of the following operators tests for inequality in Python?
C. !=
Which of the following statements about the syntax of the if structure is correct?
D. Python allows you to have an if statement without an else clause
What term describes when a programmer places one if statement in the true path of another if statement?
B. Nested ifs
Which of the following keyboards makes a multiway if statement in Python?
D. elif
What type of loop uses a variable to keep track of the number of times the loop body should execute?
D. Counter controlled loop
Which of the following calls to the range function will give me the even numbers from 10 to 20, including both 10 and 20?
C. range (10, 21, 2)
Which of the following key combinations will stop Python in the middle of running an infinite loop?
D. CTRL + C
Which of the following statements can be used inside a loop structure to skip the remaining lines of code in that iteration of the loop and start a new iteration?
D. continue
Which of the following compound conditions will evaluate to true even when the value in the choice variable is "N"?