0% found this document useful (0 votes)
25 views29 pages

Data Classification Presentation

Uploaded by

mwanafalsafam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views29 pages

Data Classification Presentation

Uploaded by

mwanafalsafam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 29

Data Classification

Data and Data classification

 Data is a raw fact and figure


 For example student’s name or id is data
 Data type is attribute or nature of the data.
 The nature of the data will determine the operation and storage of the data.
Needs for data type

 It gives different level of organization data.


 It tells how data can be stored and accessed in its
elementary level.
 Provide operation on group of data, such as adding an item,
looking up highest priority item.
 Provide a means to manage huge amount of data efficiently.
 Provide fast searching and sorting of data.
Classification of data type

 Primitive
 Composite
Primitive data type
Primitive data type

 Primitive data type are predefined data types that contain simple
values of specific characteristics, such as numeric or textual and are
not based on any other type.
 They are the most basic form and serve as a building block from
which other, more sophisticated types are built.
 These data types are also known as simple data types because they
consist of characters that cannot be divided
 Integer, character, bool, Null, etc are examples of primitive data type
Integer

 Integer data types often represent whole numbers in programming.


 An integer's value moves from one integer to another without
acknowledging fractional numbers in between.
 Example 45,2
Character

 In coding, alphabet letters denote characters.


 Programmers might represent these data types as (CHAR) or (VARGCHAR),
Example:

A
!
Example in C
Char letter[] =‘a’;
Floating point & double

 Floating-point data types represent fractional numbers in programming.


 Float: A data type that typically allows up to seven points after a
decimal.
 Double: A data type that allows up to 15 points after a decimal.
Examples :
 float num1 = 1.45E2
 float num2 = 9.34567
Short and Long

 Long data types are often 32- or 64-bit integers in code. Sometimes, these can
represent integers with 20 digits in either direction, positive or negative.
Example:

-398,741,129,664,271
9,000,000,125,356,546
 Short: Similar to the long data type, a short is a variable integer. Short stores
smaller ranges, using less memory,
Boolean

 Named after English mathematician, George bool.


 Boolean data is what programmers use to show logic in code. It's typically one of
two values—true or false, high or low, 0 or 1.
 Intended to clarify conditional statements. These can be responses to "if/when"
scenarios, where code indicates if a user performs a certain action.
Example:

bool batteryIsLow = false;


bool batteryIsLow = true;
Date & Time

 This data type stores a calendar date.


 Dates are typically a combination of integers or numerical figures.
 dd:mm:yy
 Time: Represents a specific time of day, often combined with date
to represent a complete timestamp.
 Hr:mm
None Type (nonetype)

Also known as “null,” it represents an empty variable with no


meaningful value.
Empty, not binded to any specific data value like int, char etc.

Example
int *ptr = NULL;
Composite data type
Composite data type

 Composite data types, also known as user-defined or non-primitive data


types, refer to a composition of different primitive types, usually
specified by the user.
 There are four big groups of composite types:
 homogenous which requires all values to be of the same data type;
 tabular, which stores data in tabular form;
 semi structured, which stores data as a set of relationships; and
 multimedia, which stores data in the shape of videos, audio, or images
Array

 Also known as “vector”, an array is a type that represents a group


of values of the same type that follows a consecutive order
 the position of each value is called the “index”.
 It is considered a structured data type because it stores multiple
values within a single identifier, which can be one-dimensional
(arranged as a list) or multi-dimensional (arranged in tabular form).
Example:
Int numbers = [1, 2, 3, 4, 5];
String (str/text)

 A constant or variable string of characters such as numbers, symbols, and upper-


or lower-case letters, for example, a cellphone number with “+” at the start and
“-” to separate numbers.
 The string can be considered a synonym of the VARCHAR. In C programming,
string is regarded as array of characters.
 Example:
Char name[] = “omary”;
Record

 it is also known as structure on the on some programming languages like C,


 As its name suggests, this type represents a collection of fields with their
corresponding data types, usually in a table form.
 Example:

Struct Product = {
id: number;
name: string;
price: number;
};
Union

 A union type contains a group of data objects that can have varied data types
(unlike arrays).
 Unlike records, with unions, each object starts at the same memory location,
meaning the union variable can only store one value at a time.
 When a new value is assigned to a field, the existing one is overwritten.
User-Defined Data Types (UDTs)

 Definition: These Are Data types defined by the programmer/User


 .Purpose: Organize and manage complex data structures.
 Types of User-Defined Data
 Type sStructuresStruct (C/C++): Collection of variables of different data types under a
single name.
 Class (C++/Java): Advanced form of structure with methods and data.
 Enumerations (enum)Define a new data type with named values.
 Union Store different data types in the same memory location.
 Type def Create a new name for an existing data type.
Benefits of Using UDTs

 Abstraction: Abstracts details of data structure for easier understanding.


 Encapsulation: Bundles data and methods together for a cohesive unit.
 Reusability: Can be reused in different parts or programs.
 Flexibility: Tailored to specific program requirements for efficiency
Static and dynamic data typing
Static data typing

 Static typing: Variable types are known at compile time.


 Every value (like numbers, text, etc.) is clearly associated
with a specific type (like integer, string, etc.).
 Enforced throughout the program's execution.
 Good thing: This makes the program more reliable and
efficient because it catches type-related errors early and
optimizes memory usage
Dynamic data typing

 Dynamic typing: Variable types are not known at compile


time but only at run time.
 variables are not bound to a specific data type at compile time
 Good thing: don't have to explicitly declare the type of a
variable; its type is determined when a value is assigned to it
C code (static typing)

#include <stdio.h>
int main() {
int n = NULL;
n=‘ udsm’; //this will result to error as the reference of the data
type is static
return 0;
};
Python code (dynamic typing)

Example in Python
x = 10 # x is an integer
print(type(x)) # Output: <class 'int'>

x = "hello" # Now x is a string
print(type(x)) # Output: <class 'str'>
Data casting
Data casting

 Conversion of data type into another data type


Explicit Type Conversion

 Explicit Type Conversions is the process of converting one data type to


another data type manually, through conversion from higher data type to
a smaller data type.
Implicit type conversion

 Is the process of automatically converting one data type into another data
type through conversion from smaller data type to a higher data type
Operators

 Unary Operators: These operators work with only one operand.


For example, the unary minus (-) changes the sign of its operand,
 Binary Operators: These operators work with two operands.
Examples include arithmetic operators like addition (+),
 which is the conditional operator or the ternary operator (? :). It
takes three operands and evaluates a boolean expression,
returning one of two values depending on whether the expression
is true or false.

You might also like