What is a variable in Python?
A reserved word
A data type
A location in memory to store data
A function
A location in memory to store data
Which command will display the text 'Hello world!' on the screen?
A) print(Hello world!)
B) print("Hello world!")
C) print "Hello world!"
D) print = "Hello world!"
B) print("Hello world!")
To comment a line in Python, you use this/these character(s).
#
Which of the following is a valid variable name in Python?
1variable
my_variable
global
variable-1
my_variable
What is the operator for addition and subtraction?
+ and -
This operator "glues" two strings together.
concatenation (+) operator
How do you swap the values of two variables in Python without using a third variable?
x = y; y = x
x, y = y, x
temp = x; x = y; y = temp
x + y; y = x; x = y
x, y = y, x
What is the output of the following program :
i = 0 while i < 3: print(i) i++ print(i+1)
0 2 1 3 2 4
0 1 2 3 4 5
Error
1 0 2 4 3 5
Error
This common variable type stores letters, numbers, and symbols
String
Which of the following data types is immutable in Python?
List
Tuple
Set
Dictionary
Tuple
To raise the number 5 to the power of 8, you must use the power operator. This/These symbol(s) denote the power operator.
**
This built-in Python function returns the length of many objects, including Lists.
len ()
These characters have the highest order of operation in Python.
()
Denoted as '%', this operator returns the remainder of a division operation.
Modulus
This string operator declares that the following character should be literally interpreted.
escape character (\)