40. Which characteristic specifically describes a dynamically typed language?
Answer: B
A variable's type may change during runtime
In a dynamically typed language, the type of a variable is determined at runtime, allowing the variable to hold values of different types at different times.
A) A variable may receive input from a user typing on a keyboard
This option is incorrect because the ability for a variable to receive user input does not inherently describe a dynamically typed language. User input can be handled in both statically and dynamically typed languages.
B) A variable's type may change during runtime
This option is correct as it accurately describes a primary characteristic of dynamically typed languages. In such languages, variables are not bound to a specific type, which allows them to be reassigned to values of different types throughout the program's execution.
C) A program may be built using different types of functions
While this statement is true, it does not specifically characterize dynamically typed languages. The use of various types of functions can be found in both dynamically and statically typed languages, making this option irrelevant to the question.
D) A compiler generates machine code with two types of values: 0's and 1's
This option is incorrect as it describes a fundamental aspect of how all computer programs are ultimately represented at the machine level, regardless of whether the language is dynamically typed or statically typed. It does not pertain to the typing system of the language itself.
Conclusion
The correct answer, B, highlights the defining feature of dynamically typed languages, which is the ability for a variable's type to change at runtime. All other options either misinterpret the concept or describe characteristics that are not unique to dynamically typed languages, thereby failing to address the question accurately.