1) In what situation might you want to use a global variable? a) When you want to declare a variable that needs to be accessed only by a programming construct. b) When you want to release the memory of the variable once you have finished with it. c) When you want to declare a variable that needs to be accessible by all parts of your code. d) When you want to store large amount of data. 2) Why is it a good idea to use local variables instead of global variables? a) Global variables' memory is permanent. b) Local variables release memory when you have finished with them. c) Global variables release memory when you have finished with them. d) Local variables memory is temporary. 3) What is the difference between a global and a local variable? a) Global variables are accessible from all parts of the program. b) Local variables are accessible from all parts of the program. c) Global variable are not accessible from programming constructs such as loops. d) Local variables can only hold a small amount of data. 4) Identify the statement that refers to a global variable. a) Declared anywhere within a program b) Declared outside of a function or procedure c) Exists in multiple programs at a time d) Can only be composite data types. 5) Identify the global variables in this Python code a) colours, names b) names[1] c) blue, green, red, yellow d) blue 6) Identify the statement that refers to a local variable. a) Exists outside of a function or procedure b) Declared in multiple programs at a time c) Declared inside of a function or procedure d) Can only be composite data types 7) Identify the local variables in this Pseudocode. a) total, i b) itemPrices, totalPrice c) total, i, prices[i] d) total, i, LEN(prices)
0%
GCSE.Unit2.T5.Variable Scope
共享
共享
共享
由
Mrszhong
KS4
KS5
Y9
Y10
Y11
Computing
编辑内容
打印
嵌入
更多
作业
排行榜
显示更多
显示更少
此排行榜当前是私人享有。单击
,共享
使其公开。
资源所有者已禁用此排行榜。
此排行榜被禁用,因为您的选择与资源所有者不同。
还原选项
随堂测验
是一个开放式模板。它不会为排行榜生成分数。
需要登录
视觉风格
字体
需要订阅
选项
切换模板
显示所有
播放活动时将显示更多格式。
打开成绩
复制链接
QR 代码
删除
恢复自动保存:
?