chapter2 week4 quiz
Quiz
- Which of the following is a comment in Python?
- // This is a test
- /* This is a test */
- * This is a test
- # This is a test
- In the following code,
x = 42
What is "x"?- A function
- A variable
- A Central Processing Unit
- A constant
- Which of the following variables is the "most mnemonic"?
- variable_173
- x1q3z9ocd
- x
- hours
- Which of the following is not a Python reserved word?
- speed
- else
- for
- if
- Assume the variable x has been initialized to an integer value (e.g., x = 3). What does the following statement do?
x = x + 2- Retrieve the current value for x, add two to it and put the sum back into x
- This would fail as it is a syntax error
- Create a function called "x" and put the value 2 in the function
- Exit the program
- Which of the following elements of a mathematical expression in Python is evaluated first?
- Multiplication *
- Addition +
- Parentheses ( )
- Subtraction -
- What is the value of the following expression
42 % 10
Hint - the "%" is the remainder operator- 42
- 420
- 2
- 4210
- What will be the value of x after the following statement executes:
x = 1 + 2 * 3 - 8 / 4- 4
- 15
- 5.0
- 3.0
- What will be the value of x when the following statement is executed:
x = int(98.6)- 98
- 6
- 100
- 99
- What does the Python input() function do?
- Pause the program and read data from the user
- Connect to the network and retrieve a web page.
- Read the memory of the running program
- Take a screen shot from an area of the screen
No comments:
Post a Comment