30. Which characteristic specifically describes a statically typed language?
Answer: A
Requires variables to be declared of a certain type
Statically typed languages are defined by the requirement that variables must be explicitly declared with a data type before they can be used. This characteristic allows for type checking at compile-time, which helps to catch type errors early in the development process.
A) Requires variables to be declared of a certain type
This option accurately describes a fundamental characteristic of statically typed languages. In these languages, each variable is associated with a specific type, and that type cannot change throughout the program's execution. This provides advantages such as enhanced performance and early detection of errors.
B) Runs on any machine having the right interpreter
This option describes a feature of interpreted languages rather than statically typed languages. While some statically typed languages can be interpreted, the ability to run on any machine is not a defining characteristic of static typing but rather relates to the language’s execution model.
C) Uses tags around text to indicate formatting
This option refers to markup languages, such as HTML, which are not related to the concept of static typing in programming languages. Statically typed languages focus on data types, while markup languages focus on the structure and presentation of text.
D) Changes data types when running
This option describes dynamically typed languages, where the type of a variable can change at runtime. In contrast, statically typed languages require a fixed data type for each variable throughout the execution of the program, making this option incorrect.
Conclusion
The correct answer, which requires variables to be declared of a certain type, is a defining feature of statically typed languages, distinguishing them from dynamically typed counterparts. All other options fail to accurately describe this characteristic or relate to different concepts entirely, reinforcing the unique nature of static typing in programming.