Search Header Logo
Local & Global Variables

Local & Global Variables

Assessment

Presentation

•

Computers

•

9th - 10th Grade

•

Practice Problem

•

Medium

Created by

Calum Gordon

Used 23+ times

FREE Resource

14 Slides • 26 Questions

1

Local & Global Variables

by BSN Computing

2

media

3

media

4

Multiple Select

Question image

In this lesson I am going to learn to ... ?

1

Define 'local variable'

2

Define 'global variable'

3

Justify use of both

4

Define 'national variable'

5

media

6

Open Ended

Question image

Describe in your own words what this program does

7

Multiple Choice

Question image

What would happen if you tried to print the value of pOne on line 8?

1

It would give a run-time error

2

9

3

13

4

4

8

Open Ended

Question image

Can you explain why it generates an error?

9

media

10

Fill in the Blank

Variables have different access rules depending on where they are assigned in the program. This is called variable _______.

11

media

12

media

13

Draw

Write the variable num1 from previous program in the correct scope

14

Draw

Write the variable pTwo from previous program in the correct scope

15

Fill in the Blank

Variables defined at the level of the main program are ______ in scope.

16

Fill in the Blank

Variables or parameters defined in subprograms are _____ in scope.

17

media

18

media

19

Multiple Choice

What feature of your IDE can be used to more easily see variable scope?

1

Debugger

2

Shell

3

Syntax highlighting

4

Auto-indentation

20

media

21

Draw

Circle a variable in the global scope ...

22

Draw

Circle a variable in the local scope ...

23

media

24

media

25

media

26

Multiple Choice

Local or Global?

Used inside subprograms

1

Local

2

Global

27

Multiple Choice

Local or Global?

Only used in main program

1

Local

2

Global

28

Multiple Choice

Local or Global?

Passed as an argument into a subprogram

1

Local

2

Global

29

Multiple Choice

Local or Global?

Preferred use of a variable

1

Local

2

Global

30

Fill in the Blank

Question image

Type the name of a variable in the global scope ...

31

Fill in the Blank

Question image

Type the name of a variable in the local scope ...

32

Fill in the Blank

Question image

Type the name of a subprogram parameter ...

33

Fill in the Blank

Question image

Type the line number of a procedure call ...

34

Fill in the Blank

Question image

Type the line number of a function call ...

35

Multiple Choice

Question image

Which range of line numbers is in the global scope?

1

1 - 4

2

6 - 11

3

13 - 20

4

22 - 35

36

Multiple Select

Question image

Which ranges of line numbers are in the local scope?

1

1 - 4

2

6 - 11

3

22 - 35

4

37 - 44

37

media

38

Multiple Select

Question image

In this lesson I have learned to ...

1

Define 'local variable'

2

Define 'global variable'

3

Justify use of both

4

Define 'national variable'

39

Open Ended

Question image

Thinking Hard

What would be the hardest question you could ask someone on this topic?

What would the answer be?

(press Shift+Enter to take a new line ...)

40

Poll

Question image

How much of this lesson have you understood?

None of it

Some of it

Most of it

All of it

Local & Global Variables

by BSN Computing

Show answer

Auto Play

Slide 1 / 40

SLIDE