Lifetime of a class-level variable is till . . . . . . . .

A procedure ends
An application ends
A block ends
Within the control section

The correct answer is: B. An application ends.

A class-level variable is a variable that is declared inside a class. The lifetime of a class-level variable is from the point where it is declared to the point where the application ends. This is because a class-level variable is created when the application starts and destroyed when the application ends.

A procedure is a block of code that is executed when it is called. The lifetime of a procedure-level variable is from the point where it is declared to the point where the procedure ends. This is because a procedure-level variable is created when the procedure is called and destroyed when the procedure ends.

A block is a group of statements that are enclosed in curly braces. The lifetime of a block-level variable is from the point where it is declared to the end of the block. This is because a block-level variable is created when the block is entered and destroyed when the block is exited.

Within the control section is not a valid option.

Exit mobile version