What happens if a variable is used in an expression before assignment?
AAn echo occurs
BAn error occurs
CAn entry occurs
DAn escape occurs
Answer & Solution
Correct answer: B. An error occurs
1. A name with no value cannot be substituted into an expression.
2. The interpreter cannot proceed.
3. Variables must always be assigned values before use, otherwise it leads to an error.
4. So the answer is an error occurs.
_Source: syllabus Computer Science, Ch 5 'Getting Started with Python'_
Keep practising Python Programming
Browse all Python Programming questions for BCA, or explore more Computer Science topics.