Instructions

  • 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
  • 2. Thoroughly review each solution before proceeding to ensure full understanding.
  • 3. Final results will be available after submission to provide insights into areas for further improvement.
  • 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
  • 5. Once submitted, responses are final, so ensure you’re confident in your answers.
  • 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.

All Problems

Question

Action

What is the default scope of a variable declared inside a Python function?

View

What will happen if you modify a global variable inside a function without declaring it as global?

View

Which of the following best describes a global variable?

View

How do you declare a variable as global inside a function?

View

Which of the following is true for variables in Python?

View

What is shadowing in Python?

View

Which of the following keywords is used to delete a variable in Python?

View

Which of the following variable names is correctly written in Python?

View

What will happen if a variable is not used in Python?

View

How can you check the data type of a variable in Python?

View

What is the default scope of a variable declared inside a Python function?

Global
Local
Universal
External

What will happen if you modify a global variable inside a function without declaring it as global?

The global variable gets updated
A local variable with the same name is created
The program raises an error
The global variable is deleted

Which of the following best describes a global variable?

A variable that can only be accessed inside a function
A variable accessible throughout the entire program
A variable defined in a loop
A variable that is constant and cannot change

How do you declare a variable as global inside a function?

By using the def keyword
By using the global keyword
By passing it as an argument
By using the return statement

Which of the following is true for variables in Python?

They must be declared before use
They must be declared with a data type
They can change their type during execution
They are always local to a function

What is shadowing in Python?

When a local variable has the same name as a global variable
When a variable is deleted from memory
When a function is called inside another function
When multiple variables share the same value

Which of the following keywords is used to delete a variable in Python?

remove
del
unset
clear

Which of the following variable names is correctly written in Python?

my-variable
my_variable
my variable
MyVariable!

What will happen if a variable is not used in Python?

The variable is automatically deleted
The program throws an error
The variable exists but doesn’t affect the program
The variable is converted to a constant

How can you check the data type of a variable in Python?

By using type() function
By using print() function
By declaring its type
By using len() function