Font size
WorksheetsDADT02 APP Quiz Topic 2
Total questions: 10
Worksheet time: 10mins
What is the main purpose of a named constant in programming?
To store temporary values
To create a fixed value that cannot be changed
To act as a placeholder for variables
To optimize memory usage
How is a named constant typically declared in Java?
Using var
Using final
Using constant
Using static
What does the scope of a variables determine?
The data type of the variable
The lifespan and accessibility of the variable
The memory allocation of the variable
The value assigned to the variable
Which of the following scopes is NOT a valid in programming?
Local scope
Global scope
Function scope
Unlimited scope
Named constants can have their values changed during program execution.
True
False
Define a named constant and provide an example of its declaration in any programming language
Which of the following is a primitive data type in Java?
String
Array
int
Object
What type of data can a boolean variable store?
Text values
Decimal numbers
True or false values
Large integers
What is the purpose of garbage collection in programming?
To allocate memory for variables
To clean up unused objects and free memory
To sort data in memory
To delete all variables after a program ends
How can you access an instance variable if it has the same name as a local variable in Java?
