Data Representation - Computer Science

  Data Representation 1. User-defined Data types These data types are generally accepted by the programmers who writes program for th...

 



Data Representation


1. User-defined Data types

These data types are generally accepted by the programmers who writes program for the “users”, that provide platform for the user interface. When the programmer uses the user-defined data type for programming, the programmer uses such data.


2. Non-composite user-defined data types

It doesn’t depend on other data types. It does not include data in reference to other types, some examples can be integer or real numbers. These built-in-types require for it to be named by the identifier. Two examples of such non-composite user-defined data types are:

a. Enumerated data type

It is a data type that is defined by the number of possible values assigned to the variables. The following pseudo code shows the example of the data type.

TYPE

TDirections = (North, East, South, West)

Tdays = (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday)


The variables that is assigned to the values can be declared in the following example.

DECLARE Direction1: TDirection

DECLARE StartDay: Tdays

DECLARE North

DECLARE Wednesday


# Enumerated Data type look like string values, but are not.


Another example can be thorugh the comparison statement in use with values and variables. For example:

DECLARE Weekend: Boolean

DECLARE Day: Tdays

Weekend = TRUE IF Day = Friday


b. Pointer data type

It is a dta type that is in reference with the memory location. This data type is used to construct the varying data structuring and storing it in the memory space.

But it differs to the type of data that is being pointed. The following pseudo code represents the illustration of the definition.

TYPE

TMyPointer = ^<Type name>


The use of “^” symbol is only required to input the data type, but not required in the declaration in the pointer data type.


DECLARE MyPointer = TMyPointer


The stored variables can be used and retrieved from addressed location in the pointer data type. The pointer variable is also called, ‘dereferenced’.



3. Composite User-Defined Data type

Compsoite Data type has reference to atleast one another data type. Examples display the concept of composite user-defined data type.

a. Record Data type

It is widely used and most common data type, it keep track of the values by collecting them together in coherent form as a whole. It has fixed number of component, but varies in the types.

For example, to record the student’s detail in a program. The pseudo code for the data type woud be.

TYPE

TStudentRecord

DECLARE StudentFirstName: STRING

DECLARE StudentSurName: STRING

DECLARE DateAdmitted: NUMBER

DECLARE Fees: Currency

ENDTYPE


To retrieve the data stored, one can access them using dot notation:

Student1. DateAdmitted #15/05/2016#








COMMENTS

Name

Chemistry,3,Computer Science,8,Economics,4,General Paper,1,Physics,4,Sociology,4,
ltr
item
Alevel Note: Data Representation - Computer Science
Data Representation - Computer Science
https://1.bp.blogspot.com/-V7nJMWQL4x8/X4W4jQlujNI/AAAAAAAAAIU/Dx2VEclPuTUogoY2ds7CKDj1xLK9HjmmQCLcBGAsYHQ/s320/Untitled%2Bdesign%2B%25286%2529.png
https://1.bp.blogspot.com/-V7nJMWQL4x8/X4W4jQlujNI/AAAAAAAAAIU/Dx2VEclPuTUogoY2ds7CKDj1xLK9HjmmQCLcBGAsYHQ/s72-c/Untitled%2Bdesign%2B%25286%2529.png
Alevel Note
https://www.alevelnote.com/2020/10/data-representation-computer-science.html
https://www.alevelnote.com/
https://www.alevelnote.com/
https://www.alevelnote.com/2020/10/data-representation-computer-science.html
true
1254841511416404733
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content