Data Representation P3 Flashcards
What is a user-defined data type?
A data type constructed by the programmer using primitive data types.
Why are user-defined data types important?
They improve code organization and reusability.
What are examples of user-defined data types?
Record
What is a composite user-defined data type?
A user-defined type that references at least one other type.
What is a record in programming?
A collection of related items which may or may not have different data types.
Give an example of a record definition.
TYPE TBook; DECLARE Name: STRING; DECLARE Isbn: INTEGER; ENDTYPE.
What is a set in programming?
A data structure that stores a finite number of unique items in no specific order.
Give an example of a set declaration.
TYPE Numbers = SET OF INTEGERS; DEFINE EvenNumbers (2
What is a class in OOP?
A template for creating objects with properties and methods.
What is an object in OOP?
An instance of a class.
What is inheritance in OOP?
When a class (subclass) derives from another class (superclass).
What is a non-composite user-defined data type?
A data type defined without referencing another type.
What is an enumerated data type?
A user-defined type with an ordered list of all possible values.
Give an example of an enumerated type.
TYPE Days: (Sunday
What is a pointer data type?
A type that stores the memory address of another variable.
Give an example of a pointer type declaration.
TYPE PIntPointer: ^INTEGER; DECLARE MyPointer: PIntPointer.
What are the three file organizations?
Serial
What is serial file organization?
Records are stored one after another in chronological order.
What is sequential file organization?
Records are stored in key field order and a new version must be created to update.
What is random file organization?
Records stored at computed addresses using hashing.
What is a collision in random file organization?
When two records hash to the same address.
How are collisions resolved in random access?
By searching overflow area linearly for the next empty spot.
What is serial file access?
Reading records one by one in the order they are stored.
What is direct/random file access?
Accessing records directly using key field/index or hash.