● Bits
● Bytes
● Binary Number System (base 2)
● Decimal Numebr System (base 10)
● Binary number System
● Octal Number System (base 8)
● Hexadecimal Number System (base 16)
Data Representation
○ With only 8 bits, you can represent 28 or 256 different decimal values ranging from 0 to 255. This is 256 different characters or different combinations of 0 and 1.
○ The binary numbering system is used to represent the language of the computer. The binary number 01000001 is equivalent to the decimal value 65, which represents the uppercase character A.
○ Fortunately, you do not have to retrain yourself to speak that language.
Character Sets
The character set used by programmers of C# is called ;
the universal character-encoding schema
Unicode
ASCII meaning
American Standard Code for Information Interchange (ASCII)
Kilobyte 2^10 (1,024) (KB)
Megabyte 2^20 (1,048,567) (MB)
Gigabyte 2^30 (1,073,741,824) (GB)
Terabyte 2^40 (1,099,511,627,776) (TB)
Petabyte 2^50 (1,125,899,906,842,624) (PB)
Exabyte 2^60 (1,152,921,504,606,846,976,) (EB)
Zettabyte 2^70 (1,180,591,620,717,411,303,424,) (ZB)
Yottabyte 2^80 (1,208,925,819,614,629,174,706,176) (YB)
Kilobyte 2^10 (1,024) (KB)
Megabyte 2^20 (1,048,567) (MB)
Gigabyte 2^30 (1,073,741,824) (GB)
Terabyte 2^40 (1,099,511,627,776) (TB)
Petabyte 2^50 (1,125,899,906,842,624) (PB)
Exabyte 2^60 (1,152,921,504,606,846,976,) (EB)
Zettabyte 2^70 (1,180,591,620,717,411,303,424,) (ZB)
Yottabyte 2^80 (1,208,925,819,614,629,174,706,176) (YB)
Data Representation Trivia
● Notice that kilo is about a thousand, mega is about a million, giga is about a billion, and so on.
● So, when you think about a machine that has a 64-bit processor with 4 GB of RAM and 1 TB of hard disk space, you know that the machine can process 64 bits at one time, store approximately 4 billion characters in memory, and has storage capacity for approximately 1 trillion characters on the hard disk.
TRIVIA LANG
○ These are names of elements that appear in a program, such as data items. Some _______ are predefined; others are user-defined.
○ Examples: System, Main, Console, WriteLine
Identifiers
Rules for creating an identifier in C#
1. A combination of alphabetic characters (a–z and A–Z), numeric digits (0–9), and the underscores (_) can be used. Identifiers can be long; however, many systems consider the first 31 characters unique.
Rules for creating an identifier in C#
-Declaring this requires that you select an identifier and determine what type of data will appear in the memory cell. The syntax for declaring a variable follows:
type identifier = expression;
Variables
A variable’s value can change. These are the numbers, characters, and combinations of characters used in your program. They can be assigned to a variable or used
in an expression.
Literal Values
Every time you declare a variable in the C# language, you are actually instantiating a class (creating an object). If you declare three variables of int type, you are instantiating the class three times; three int objects are created. The following statement creates three int objects:
int homeWorkScore1;
int examNumber1;
int numberOfPointsScored;
no answer
homeWorkScore1 = 100;
Literal Values
Grade point average
Current age
Full name
Final grade in a course
Description grade
gradePointAverage
age
studentName
courseGrade
Identifier
double / 3.99
int / 19
string / Elizabeth Hill
char / A
Data Type / Data
is an instance of a class. It is an occurrence of the class. For
simplicity purposes, you can think of an instance of the base type int as 21 or 3421.
Objects
● However, includes more than just the data associated with the type.
● is the term used to denote the encapsulation of data and behaviors into a single package or unit. The characteristics of the behavior and data can be described.
Class
CAR, ANIMALS
class
audi, nissan, volvo
Object
are often called the fundamental data types or primitive data
types of the language. They are the common types needed by most
applications.
value types
C # type
byte (integral) (System.Byte)
sbyte (integral) (System.SByte)
char (integral) (System.Char)
decimal (decimal) (System.Decimal)
double(Floating-point) (System.Double)
float(Floating-point) (System.Single)
int (integral) (System.Int32)
uint (integral) (System.UInt32)
long (integral) (System.Int64)
ulong (integral) (System.UInt64)
short (integral) (System.Int16)
ushort (integral) (System.UInt16)
value types
int StudentCount; // number of students in the class
int ageOfStudent = 20; // age - originally initialized to 20
int numberOfExams; // number of exams
int courseEnrolled; // number of course enrolled
Note
Integral Data types
basahin nyo nalang sa ppt yung iba
● is based on true/false, on/off logic.
● The only Boolean type in C# is bool. A bool variable can have a value of either true or false. One example of the bool type being very useful is in determining when all data has been processed.
bool undergraduateStudent;
bool moreData = true; // used to indicate when all the data is processed. orginally set to true
Boolean Variables