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 代碼
刪除
恢復自動保存:
?