Multiple Choice Quiz regarding topics module 1
Quiz
Quiz
primary_color: darkblue secondary_color: lightgray text_color: black shuffle_questions: true
Indentation
shuffle_answers: false
Question: What does Python use to define blocks of code?
This is a hint
- Braces {}
- Parentheses ()
- Indentation
- Semicolons ;
Variables
shuffle_answers: false
Question: How do you declare a variable in Python?
This is a hint
- var x = 5
- int x = 5
- x = 5
- let x = 5
Lists
shuffle_answers: false
Question: Which of the following is a valid way to create a list in Python?
This is a hint
- list = {1, 2, 3}
- list = [1, 2, 3]
- list = (1, 2, 3)
- list = <1, 2, 3>
Operators
shuffle_answers: false
Question: What will be the output of the following code?
Greater then
sum = 10 + 5
if sum > 10:
print("Greater than ten")
- Greater than ten
- 15
- Error
- No output
Control Structures
shuffle_answers: false
Question: Which of the following is the correct syntax for a for loop in Python?
for loop
- for i = 0; i < 5; i++:
- for i in range(5):
- for (i in range(5)):
- foreach (i in range(5)):
Functions
shuffle_answers: false
Question: How do you define a function in Python?
for loop
- function greet(name):
- def greet(name):
- func greet(name):
- function greet(name) end
Functions
shuffle_answers: false
Question: How do you define a function in Python?
for loop
- function greet(name):
- def greet(name):
- func greet(name):
- function greet(name) end
Importing Modules
shuffle_answers: false
Question: How do you import the math module in Python?
for loop
- import(math):
- include math:
- import math:
- #include math:
Exception handling
shuffle_answers: false
Question: Which keyword is used to handle exceptions in Python?
for loop
- try:
- catch:
- except:
- finally:
Data Types
shuffle_answers: false
Question: What is the type of the following variable?
for loop
x = "Hello, World!"
- int:
- float:
- string:
- list: