Variable Scope

Variable Scope

9th Grade

11 Qs

quiz-placeholder

Similar activities

C++ Arrays

C++ Arrays

8th - 12th Grade

12 Qs

functions arguments reference coding

functions arguments reference coding

7th - 12th Grade

11 Qs

Introduction to Python Quiz

Introduction to Python Quiz

8th Grade - University

10 Qs

PL/SQL

PL/SQL

1st - 10th Grade

10 Qs

AP Computer Science Principles Unit 4 Review

AP Computer Science Principles Unit 4 Review

9th Grade - University

15 Qs

1.4 Variables, strings and integers

1.4 Variables, strings and integers

9th Grade

13 Qs

Programming - Data Types

Programming - Data Types

1st - 10th Grade

10 Qs

Lesson 3: (CIW JavaScript)

Lesson 3: (CIW JavaScript)

9th - 12th Grade

11 Qs

Variable Scope

Variable Scope

Assessment

Quiz

Computers

9th Grade

Hard

Created by

Vernon Leigh

Used 7+ times

FREE Resource

AI

Enhance your content

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

11 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the scope of a global variable?

The entire program

The sub-program where it has been declared

Only within the function where it has been declared

Only within the class where it has been declared

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Where is the value of a global variable accessible?

Only within the function where it has been declared

Only within the class where it has been declared

Throughout the entire program

Only within the sub-program where it has been declared

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the impact of errors in code on global variables?

No impact

The value of the global variable is lost

The value of the global variable can be accidentally changed

The global variable becomes inaccessible

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Why can global variables be a major problem in real commercial programs?

They consume excessive system resources

They can cause errors in code

There may be hundreds or thousands of variables in use

They are difficult to declare and use

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the scope of a local variable?

The entire program

The sub-program where it has been declared

Only within the function where it has been declared

Only within the class where it has been declared

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Where are the values of local variables held?

In the main memory

In the cache memory

In the hard disk

In the RAM

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens to a local variable after the execution of its sub-program?

It is retained in RAM

It is lost

It becomes a global variable

It is moved to the cache memory

Create a free account and access millions of resources

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

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?