PYTHON-06

Quiz
•
Computers
•
9th - 12th Grade
•
Medium
Riya Shakya
Used 4+ times
FREE Resource
30 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
What is a global variable in Python?
A variable that is accessible only within a specific function.
A variable that is accessible from anywhere in the program.
A variable that is defined within a class.
A variable that is defined within a loop.
2.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Which keyword is used to declare a global variable within a function?
local
global_word
non_local
global
3.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
What happens if a global variable shares the same name as a local variable within a function?
The local variable takes precedence over the global variable.
The global variable takes precedence over the local variable.
An error occurs due to naming conflict.
Both variables are combined into a single variable.
4.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Where are global variables typically defined in a Python program?
Inside a function
Inside a loop
At the top level of the program
Inside a class
5.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
What is the scope of a global variable?
Limited to the function in which it is defined
Limited to the block in which it is defined
Limited to the class in which it is defined
Accessible from anywhere in the program
6.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Which of the following is an example of a local variable?
x = 5
PI = 3.14
name = "John"
count = 0
7.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Can a local variable be accessed from outside the function in which it is defined?
yes
no
Create a free account and access millions of resources
Similar Resources on Wayground
25 questions
Intro to CS FINAL

Quiz
•
11th Grade
25 questions
Penilaian Harian Bahasa Kotlin SMT 1 2023

Quiz
•
11th Grade
25 questions
JavaScript Console & Graphics Review

Quiz
•
9th - 12th Grade
27 questions
Algorithm Dvpmt:Pseudocode, Types of Statements

Quiz
•
9th - 12th Grade
25 questions
AP CSP Exam Reference Sheet Practie

Quiz
•
12th Grade
30 questions
Internship WebDevelopment Quiz

Quiz
•
12th Grade - University
27 questions
Understanding Java Attributes and Behaviors

Quiz
•
12th Grade
25 questions
11 CSC ATAR - Week 1 review (Python)

Quiz
•
11th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
Proper Keyboarding Techniques

Interactive video
•
6th - 10th Grade
14 questions
Inputs and Outputs: Computer Science Intro

Lesson
•
5th - 9th Grade
10 questions
Understanding Computers: Hardware, Software, and Operating Systems

Interactive video
•
7th - 12th Grade
29 questions
AP CSP Unit 2 Review (Code.org)

Quiz
•
10th - 12th Grade