Variable
Operators
Miscellaneous
100

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

100

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!")

100

To comment a line in Python, you use this/these character(s).

#

200

Which of the following is a valid variable name in Python?

1variable

my_variable

global

variable-1

my_variable

200

What is the operator for addition and subtraction?

 + and -

200

This operator "glues" two strings together.

concatenation (+) operator


300

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

300

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

300

This common variable type stores letters, numbers, and symbols

String

400

Which of the following data types is immutable in Python?

List

Tuple

Set

Dictionary

Tuple

400

To raise the number 5 to the power of 8, you must use the power operator. This/These symbol(s) denote the power operator.

**

400

This built-in Python function returns the length of many objects, including Lists.

len ()

500

These characters have the highest order of operation in Python.

()

500

Denoted as '%', this operator returns the remainder of a division operation.

Modulus

500

This string operator declares that the following character should be literally interpreted.

escape character (\)