[amp_mcq option1=”are created outside a block” option2=”are known only to that block” option3=”continue to exist when their block ends” option4=”are illegal in C++” correct=”option2″]
The correct answer is: B. are known only to that block.
A local variable is a variable that is declared inside a function or a block. It is known only to the function or block in which it is declared. It is created when the function or block is entered and destroyed when the function or block is exited.
Option A is incorrect because local variables are created inside a block.
Option C is incorrect because local variables are destroyed when their block ends.
Option D is incorrect because local variables are legal in C++.