Question
1. In Python, what does the following expression evaluate to: (2 + 3) * 2 - 1 A. 7 B. 7.0 C. 9 D. 9.0
1. In Python, what does the following expression evaluate to:
(2 + 3) * 2 - 1
A. | 7 | |
B. | 7.0 | |
C. | 9 | |
D. | 9.0 |
2. In Python, the following expression would result in what data type?
2 + 1
A. | int (integer) | |
B. | float (floating point number) | |
C. | str (string) | |
D. | bool (boolean) |
3. In Python, the following expression would result in which data type?
2 + 1.0
A. | int (integer) | |
B. | float (floating point number) | |
C. | str (string) | |
D. | bool (boolean) |
4. In Python, the following expression would result in which data type?
2 + 3 * 2.0 - 1
A. | 7 | |
B. | 7.0 | |
C. | 9 | |
D. | 9.0 |
5. In Python, what is the data type is this value: "Hello"
A. | int (integer) | |
B. | float (floating point number) | |
C. | str (string) | |
D. | bool (boolean) |
6. What data type is x?
x = '42.0'
A. | int (integer) | |
B. | float (floating point number) | |
C. | str (string) | |
D. | bool (boolean) |
7. What single line of code can be used to discover what data type x is.
x = 17
A. | type(x) | |
B. | Type(x) | |
C. | print(x) | |
D. | new_type = x as type |
8. What is the escape sequence for a new line?
A. |
| |
B. | \t | |
C. | \N | |
D. | \\ |
9. What would be the result of the following expression?
'dog'*2
A. | 'dogdog' | |
B. | 'dog dog' | |
C. | 'dog2' | |
D. | Nothing. It would throw an error. |
10. What is the escape sequence for a single quote?
A. | \" | |
B. | /' | |
C. |
| |
D. | \' |
11. In Python, what would the following expression evalute to?
3**2
A. | 9 | |
B. | 9.0 | |
C. | 6 | |
D. | 6.0 |
12. In Python, what would the following expression evalute to?
10//3
A. | 3.33333333333 | |
B. | 3 | |
C. | 3.0 | |
D. | Nothing. It would throw an error. |
13. In Python, what would the following expression evalute to?
10 % 3
A. | 1 | |
B. | 1.0 | |
C. | 3.33333333333 | |
D. | 3.0 |
14. In Python, what would the following expression evalute to?
6 / 3
A. | 0 | |
B. | 2.0 | |
C. | 2 | |
D. | Nothing. It would throw an error. |
15. Which code would result in this output: I'm fine today. Select ALL that apply.
A. | print('I'm fine today.') | |
B. | print("I'm fine today.") | |
C. | print(I'm fine today.) | |
D. | print('I\'m fine today.') |
16. Which bit of code would ignore the escape sequence and just print the raw string?
A. | print(r"This is the escape sequence for a backslash: \\") | |
B. | print(raw'This is the escape sequence for a backslash: \\') | |
C. | raw(r"This is the escape sequence for a backslash: \\") | |
D. | raw(r"This is the escape sequence for a backslash: \\") |
17. Which bit of code would match this output: Greetings, Bob! Select ALL that apply.
A. | print("Greetings", "Bob", sep= , , end= !) | |
B. | print("Greetings, ", "Bob!") | |
C. | print("Greetings\,", "Bob\!") | |
D. | print("Greetings,", "Bob!") |
18. Which of the following values are literal constants? Select ALL that apply.
"Good morning!" | ||
118 | ||
13.5 | ||
print() |
19. You should include commas when dealing with large numbers in Python (e.g. 1,000,000)
True
False
20. Which of the following is an example of a Docstring, which may appear at the beginning of a script?
A. | print("This is a Docstring. It may run into multiple lines, but thats ok.") | |
B. | "This is a Docstring. It may run into multiple lines, but thats ok." | |
C. | ""This is a Docstring. It may run into multiple lines, but thats ok."" | |
D. | """This is a Docstring. It may run into multiple lines, but thats ok.""" |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started