Empowering Students with AI-Powered Assessments & Intelligent Learning
Chapter Exam

Chapter 3: Scoping — Online MCQ Test

COMPUTER SCIENCE · CLASS 12th · Tamil Nadu State Board

Practice Chapter 3: Scoping with a free chapter-wise online MCQ test for Tamil Nadu State Board CLASS 12th COMPUTER SCIENCE. This chapter covers: This chapter details variable accessibility and lifespan within different program parts. It covers local global module and built-in scopes using the LEGB rule along with namespaces.... AI-generated questions from basic to board-exam level, with instant results and explanations.

10
Questions
20m
Time Limit
3
Attempts Left
  • 10 random questions from this chapter (mixed difficulty)
  • Questions you've seen before won't repeat until the pool resets
  • You have 20 minutes — exam auto-submits when time is up
  • Maximum 3 attempts per chapter
  • Results and explanations shown immediately after submission
Login to Start This Exam →

New here? Register free — includes 3 free chapter exams.

Chapter 3: Scoping — Important Questions & Answers (FAQ)

Frequently asked questions from Tamil Nadu State Board CLASS 12th COMPUTER SCIENCE — Chapter 3: Scoping, with answers and explanations. These are sample questions; the exam has its own separate question set.

What does the term 'scope' in programming refer to?
  • A. The speed of program execution
  • B. The region where a variable can be accessed ✓
  • C. The size of the data type
  • D. The number of functions in a program
Answer: B. The region where a variable can be accessed
Scope means the part of a program where a variable, function, or name is visible and can be used.
Which scope is created when a variable is defined inside a function?
  • A. Global scope
  • B. Local scope ✓
  • C. Built-in scope
  • D. Module scope
Answer: B. Local scope
A variable declared inside a function belongs to the local scope of that function.
Which keyword is used to modify a global variable inside a function?
  • A. local
  • B. global ✓
  • C. nonlocal
  • D. static
Answer: B. global
The global keyword allows a function to refer to and modify a variable defined in the global scope.
Consider the code: x = 5 def outer(): x = 10 def inner(): print(x) inner() outer() What is printed?
  • A. 5
  • B. 10 ✓
  • C. Error
  • D. None
Answer: B. 10
inner() accesses x from the enclosing function outer(), so it prints 10 according to the LEGB rule.
Fill in the blank: A variable declared inside a function is said to have ______ scope.
  • A. global
  • B. local ✓
  • C. built-in
  • D. module
Answer: B. local
Variables created inside a function are accessible only within that function unless declared otherwise.

Choose Your Plan & Start Practising

All plans cover every subject and chapter of your registered grade.

Free
₹0
3 exams · 1 year
Start Free →
Active
₹350
12 exams · 1 year
Get Active →
Pro
₹899
Unlimited exams · 1 year
Get Pro →

Compare all plans in detail →