menu

Python Control Structures


1. Which operator is used to check if two values are not equal in Python?

=

==

===

!=


2. Which of the following statements is used to check if a number is odd in Python?

num % 2 == 0

num % 2 == 1

num.is_odd()

num.odd()


3. Which statement is used to create a list in Python?

[ ]

( )

{ }

| |


4. Which statement is used to call a function in Python?

call

invoke

run

None of the above


5. Which statement is used to create a dictionary in Python?

[ ]

( )

{ }

| |


6. Which of the following statements is used to convert a string to uppercase in Python?

string.upper()

string.toUpper()

string.casefold()

string.capitalize()


7. Which statement is used to define a function in Python?

def

function

define

func


8. Which statement is used to return a value from a function in Python?

return

exit

break

pass


9. Which statement is used to create a set in Python?

[ ]

( )

{ }

| |


10. Which of the following statements is used to import a module in Python?

module.import(module_name)

import module_name

from module_name import *

All of the above