Cs Ch16 Flashcards
Describe the purpose of user defined data types
- To create a new data type from existing data types
- To allow data types not available in a programming language to be constructed
Describe using pseudocode the following enumerated data types:
SchoolDay, holds the days students are at school
WeekEnd, holds the days students are not at school
TYPE SchoolDay = (Monday, Tuesday, Wednesday, Thursday, Friday )
TYPE WeekEnd = (Saturday, Sunday)
Define, using pseudocode, the composite data type ClubMeet. This will hold data about the club members which includes:
First name and last name
The two days they attend:
- one on a school day
- one not a school day
TYPE ClubMeet
DECLARE FirstName : STRING
DECLARE LastName : STRING
DECLARE SchoolDay : SchoolDay
DECLARE Weeknd : Weekend
ENDTYPE
Write pseudocode to create an enumerated data type called Parts to include these parts sold in a computer store:
Monitor, CPU, SSD, HDD, LaserPrinter, Keyboard, Mouse
TYPE Parts = (Monitor, CPU, SSD, HDD, LaserPrinter, Keyboard, Mouse )
Write pseudocode to create a pointer type called SelectParts that will reference the memory location in which the current part name is stored
TYPE SelectParts = ^Parts
State what is ment by the term enumerated data types
A non-composite data type with an ordered list of all possible values
State what is ment by the term pointer data type
A user defined non composite data type used to reference a memory location
The months of a year are January…. December. Write a pseudocode statement to define the data type Quater1 to hold the names of the first 3 months of the year
TYPE Quater1 = (January, February, March)
The composite data type Pet is used to store data about the various pets coffee group of students it uses the following fields:
Pet String
ActualType String
OPetAge Integer
PetGender Char
OwnerName String
Write the pseudocode statement to set up a variable for one record of the composite data type Pet
DECLARE Pet1 : Pet
Write a pseudocode to store the details of the following pet
Pet1.PetName «< “Tribble”
Pet1.AnimalType «< “Cat”
Pet1.PetAge «< 8
Pet1.PetGender «< “M”
Pet1.OwnerName «< “Jasmine Smith”