To answer this question, you need to understand the concept of access modifiers in class definitions. Access modifiers are keywords that specify the accessibility of data variables and methods within a class.
Let's go through each option to understand why it is correct or incorrect:
Option A) They can be applied to both data & methods - This option is correct. Access modifiers can be applied to both data variables and methods in a class.
Option B) They must precede a class's data variables or methods - This option is correct. Access modifiers must be placed before a class's data variables or methods to specify their accessibility.
Option C) They can follow a class's data variables or methods - This option is incorrect. Access modifiers cannot be placed after a class's data variables or methods.
Option D) They can appear in any order - This option is incorrect. Access modifiers must be placed before the data variables or methods they modify.
Option E) They must be applied to data variables first and then to methods - This option is incorrect. Access modifiers can be applied to data variables and methods in any order.
The correct answer is B. Access modifiers must precede a class's data variables or methods to specify their accessibility.