
CMU.CS Academy Unit 2 Review
Authored by Petya Herz
Computers
9th - 12th Grade
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a variable in programming?
A variable in programming is a special character used for formatting text
A variable in programming is a type of function
A variable in programming is a symbolic name given to a value that can change during the program's execution.
A variable in programming is a fixed value that never changes
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the scope of a variable?
The scope of a variable is the region of code where the variable can be accessed.
The scope of a variable is the size of the variable
The scope of a variable is the shape of the variable
The scope of a variable is the color of the variable
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Explain the difference between local and global variables.
Global variables are declared within a specific function or block of code
Local variables are accessible from anywhere in the program
Local variables are declared within a specific function or block of code and can only be accessed within that scope. Global variables, on the other hand, are declared outside of any function and can be accessed from anywhere within the program.
Local variables can be accessed outside of the function where they are declared
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a function in programming?
A function in programming is a comment that explains code
A function in programming is a loop that repeats code
A function in programming is a block of code that performs a specific task.
A function in programming is a variable that stores data
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of parameters in a function?
Parameters are used for decorative purposes in functions
Parameters restrict the number of function calls
Parameters are only used in advanced programming languages
Parameters allow functions to be flexible and reusable by accepting different values during each function call.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you define a function in Python?
def functionName(parameters):
function functionName(parameters) {}
functionName = function(parameters):
create functionName(parameters):
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What happens when a function is called before it is defined in Python?
The Python interpreter throws a SyntaxError.
The function call will succeed as long as the function is defined later in the script.
The Python interpreter throws a NameError.
The function call is ignored by the Python interpreter.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?