WorksheetsUnderstanding Data Structures
Total questions: 12
Worksheet time: 11mins
What are primitive data types?
Primitive data types are basic data types like integers, floats, characters, and booleans.
Primitive data types include lists and dictionaries.
Primitive data types are complex data structures.
Primitive data types are only used in object-oriented programming.
Choose three examples of primitive data types.
float
integer
boolean
String
What is a reference variable?
A reference variable is a type of function.
A reference variable is an alias for another variable, allowing direct access to its value.
A reference variable is a data structure that holds multiple values.
A reference variable is a constant value that cannot change.
How does a reference variable differ from a primitive variable?
Both reference and primitive variables hold direct values.
A reference variable points to an object, while a primitive variable holds a direct value.
A reference variable holds a direct value, while a primitive variable points to an object.
A reference variable is a type of primitive variable.
Explain the concept of memory allocation for primitive data types.
Memory allocation is only necessary for complex data types.
Memory allocation involves reserving a specific amount of memory based on the type.
Memory allocation for primitive data types is irrelevant to programming.
Primitive data types do not require any memory allocation.
What is the significance of using reference variables in data structures?
Reference variables increase data redundancy in structures.
Reference variables are significant in data structures for efficient memory management and direct data manipulation.
Reference variables are primarily for user interface design.
Reference variables are only used for string manipulation.
Can a reference variable point to multiple objects? Why or why not?
A reference variable can hold a list of objects at once.
No, a reference variable cannot point to multiple objects at the same time.
A reference variable can point to one object and switch to another later.
Yes, a reference variable can point to multiple objects simultaneously.
What happens when a reference variable is assigned to another reference variable?
The original object is deleted from memory.
Both reference variables create a new object in memory.
One reference variable becomes null after assignment.
Both reference variables refer to the same object in memory.
Describe how garbage collection works with reference variables.
Why is it important to understand the difference between primitive and reference types in programming?
What is the default value of a reference variable in Java?
0
false
null
undefined
How can you check if a reference variable is pointing to an object?
By printing its value directly.
By checking its length property.
By using the instanceof operator.
By comparing it to null.
