Font size
WorksheetsPython-Variables, Expressions
Total questions: 12
Worksheet time: 7mins
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
What does the following code print out?
print("123" + "abc")
123 abc
This is a syntax error because you cannot add strings
123+abc
123abc
Which of the following is a bad Python variable name?
Spam
_spam
23spam
SPAM23
Which of the following variables is the "most mnemonic"?
x1q3z9ocd
variable_173
hours
x
Which of the following is not a Python reserved word?
iterate
continue
break
else
Which of the following elements of a mathematical expression in Python is evaluated first?
*
/
()
+
What will be the value of x after the following statement executes:
x = 1 + 2 * 3 - 8 / 4
5.0
4
15
3.0
What does the Python input() function do?
Take a screen shot from an area of the screen
Connect to the network and retrieve a web page
Read the memory of the running program
Pause the program and read data from the user
Assume the variable x has been initialized to an integer value (e.g., x = 3). What does the following statement do?
x = x + 2
This would fail as it is a syntax error
Produce the value "false" because "x" can never equal "x+2"
Retrieve the current value for x, add two to it and put the sum back into x
Create a function called "x" and put the value 2 in the function
How to check the data type of 45.6
(a)
Python was coined by
Charles Severence
James Gosling
Guido Van Rossum
Dennis Ritchie
Python Application Programming Subject Code:
18EC61
18EC646
18EC664
18EC466
