Search Header Logo

Local and Global Variable Quiz

Authored by K Astley

Computers

10th Grade

Used 3+ times

Local and Global Variable Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

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

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers