
Local and Global Variable Quiz

Quiz
•
Computers
•
10th Grade
•
Medium

K Astley
Used 3+ times
FREE Resource
9 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Where is a local variable declared?
Inside a function
Outside a function
In the definition of function parameters
In a global scope
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
When is a local variable created and lost?
Created at program end and lost at program start
Created when the function terminates and lost when the function starts execution
Created when the function starts execution and lost when the function terminates
Created at program start and lost at program end
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Where are global variables stored?
In a separate memory space
In a random location in memory
In a fixed location decided by the compiler
On the stack
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the scope of a global variable?
Inside a function
Anywhere within the program
In the definition of function parameters
In a local scope
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the advantage of using global variables?
Limited scope
Accessible from all functions
Data sharing is not possible
Limited memory usage
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the disadvantage of using local variables?
Unpredictable results in multi-tasking environments
Tricky debugging process
Common data sharing between modules
Limited scope
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
When is a global variable created and lost?
Created when the function terminates and lost when the function starts execution
Created when the function starts execution and lost when the function terminates
Created at program start and lost at program end
Created at program end and lost at program start
8.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the disadvantage of using global variables?
Unpredictable results in multi-tasking environments
Limited scope
Data can be modified by any function
Limited memory usage
9.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the advantage of using local variables?
Unpredictable results in multi-tasking environments
Guarantee that the values will only be edited by the intended function
Accessible from all functions
Data sharing is possible
Similar Resources on Wayground
7 questions
Year 11 Taster - Subprograms Review

Quiz
•
10th Grade
14 questions
IoT Chapter 2 Review

Quiz
•
9th - 12th Grade
10 questions
Karel Quizzes 1-5 (Command - Start)

Quiz
•
9th - 12th Grade
10 questions
Evaluasi Javascript 3

Quiz
•
10th Grade
8 questions
Basics of C Quiz

Quiz
•
9th - 12th Grade
13 questions
Python Basics (Y9)

Quiz
•
8th - 10th Grade
12 questions
Unit 7 Mid Review

Quiz
•
9th - 12th Grade
9 questions
Review for Conditionals, Variables and Functions

Quiz
•
9th - 12th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
20 questions
Analog vs Digital

Quiz
•
9th - 12th Grade
10 questions
Exploring Cybersecurity Techniques and Threats

Interactive video
•
6th - 10th Grade
10 questions
Understanding the Internet and Data Transmission

Interactive video
•
7th - 12th Grade