Basic Syntax

Control Flow
Functions
Imperative Programming Paradigm
Functional Programming Paradigm
100

What is the symbol used to represent comments in Python?

What is the hash (#) symbol?

100

What is the syntax for an if statement in Python?

if condition:

100

What is the syntax for defining a function in Python?

def functionName(parameters):

100

What is the definition of the imperative programming paradigm?

The imperative programming paradigm is a programming style that focuses on describing "how" a program should perform a task.

100

What is the functional programming paradigm?

What is a programming paradigm that emphasizes the use of pure functions and avoids shared state and mutable data?

200

What is the difference between "==" and "=" in Python?

"==" is a comparison operator used to check if two values are equal, while "=" is an assignment operator used to assign a value to a variable.

200

What is the syntax for a for loop in Python?

for item in iterable:

200

What is the difference between arguments and parameters in Python?

Arguments are the values passed to a function when it is called, while parameters are the placeholders used in the function definition.

200

What are some common examples of imperative programming statements in Python?

Some common examples of imperative programming statements in Python include variable assignments, conditional statements (if/else), loops (for/while), and function calls.

200

What are some of the advantages of functional programming?

Some of the advantages of functional programming include better modularity, easier testing and debugging, and better scalability.

300

What is the syntax for printing "Hello, World!" to the console in Python?

print("Hello, World!")

300

What is the syntax for a while loop in Python?

while condition:

300

What is the syntax for returning a value from a function in Python?

return value

300

What is the difference between imperative and declarative programming?

What is declarative programming focuses on "what" a program should do, while imperative programming focuses on "how" a program should perform a task.

300

What is the name of the Python library used for functional programming that provides a collection of immutable data structures, such as lists, tuples, and dictionaries?

What is the collections module in Python?

400

What is the syntax for creating a list in Python?

myList = [1, 2, 3, 4, 5]

400

What is the purpose of the break statement in Python?

The break statement is used to exit a loop prematurely.

400

What is the purpose of a docstring in a Python function?

A docstring is used to provide documentation for a function, and can be accessed using the help() function.

400

What is the syntax for a variable assignment in Python?

What is variable_name = value?

400

What is a higher-order function?

What is a function that takes one or more functions as arguments, and/or returns a function as its result?

500

What is the syntax for creating a dictionary in Python?

myDict = {"key1": "value1", "key2": "value2", "key3": "value3"}

500

What is the purpose of the continue statement in Python?

The continue statement is used to skip to the next iteration of a loop.

500

What is a lambda function in Python?

A lambda function is a small, anonymous function that can be defined in one line of code. It is often used as a shortcut for simple tasks. The syntax for a lambda function is lambda arguments: expression.

500

What is the syntax for an if-else statement in Python?

if condition:

code to execute if condition is true

else:

code to execute if condition is false

500

What is a lambda function?

What is an anonymous function that can be defined in one line of code, and is often used for simple operations such as filtering or transforming data?

M
e
n
u