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)

Көшбасшылар тақтасы

Визуалды стиль

Опциялар

Үлгіні ауыстыру

Өңдеуді жалғастыру: ?