Cs Ch16 Flashcards

1
Q

Describe the purpose of user defined data types

A
  • To create a new data type from existing data types
  • To allow data types not available in a programming language to be constructed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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

A

TYPE SchoolDay = (Monday, Tuesday, Wednesday, Thursday, Friday )

TYPE WeekEnd = (Saturday, Sunday)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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

A

TYPE ClubMeet
DECLARE FirstName : STRING
DECLARE LastName : STRING
DECLARE SchoolDay : SchoolDay
DECLARE Weeknd : Weekend
ENDTYPE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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

A

TYPE Parts = (Monitor, CPU, SSD, HDD, LaserPrinter, Keyboard, Mouse )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Write pseudocode to create a pointer type called SelectParts that will reference the memory location in which the current part name is stored

A

TYPE SelectParts = ^Parts

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

State what is ment by the term enumerated data types

A

A non-composite data type with an ordered list of all possible values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

State what is ment by the term pointer data type

A

A user defined non composite data type used to reference a memory location

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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

A

TYPE Quater1 = (January, February, March)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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

A

DECLARE Pet1 : Pet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Write a pseudocode to store the details of the following pet

A

Pet1.PetName «< “Tribble”
Pet1.AnimalType «< “Cat”
Pet1.PetAge «< 8
Pet1.PetGender «< “M”
Pet1.OwnerName «< “Jasmine Smith”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly