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
แก้ไขเนื้อหา
สั่งพิมพ์
ฝัง
เพิ่มเติม
กำหนด
ลีดเดอร์บอร์ด
แสดงเพิ่มขึ้น
แสดงน้อยลง
ลีดเดอร์บอร์ดนี้ตอนนี้เป็นส่วนตัว คลิก
แชร์
เพื่อทำให้เป็นสาธารณะ
ลีดเดอร์บอร์ดนี้ถูกปิดใช้งานโดยเจ้าของทรัพยากร
ลีดเดอร์บอร์ดนี้ถูกปิดใช้งานเนื่องจากตัวเลือกของคุณแตกต่างสำหรับเจ้าของทรัพยากร
แปลงกลับตัวเลือก
แบบทดสอบ
เป็นแม่แบบแบบเปิดที่ไม่ได้สร้างคะแนนสำหรับลีดเดอร์บอร์ด
ต้องลงชื่อเข้าใช้
สไตล์ภาพ
แบบ อักษร
ต้องสมัครสมาชิก
ตัวเลือก
สลับแม่แบบ
แสดงทั้งหมด
รูปแบบเพิ่มเติมจะปรากฏเมื่อคุณเล่นกิจกรรม
เปิดผลลัพธ์
คัดลอกลิงค์
คิวอาร์โค้ด
ลบ
คืนค่าการบันทึกอัตโนมัติ:
ใช่ไหม