Lecture 1
Lecture 1
(CS500)
Lecture 1
References
• Numbering Systems
• Computer Hardware
• Data Manipulation
• Computer Software
What is Computer Science
What is meant by Computer Science
• It is solving problems using computations
þ鐷:
Goal State:
3þ鐷: , , ,
Algorithm
• Algorithm is a finite set of ordered, unambiguous and executable instructions that
terminates with a desired output(s) for given input(s) in a finite amount of time
» It can be
» Desktop application
Office package, calculator, games
» Mobile application
Android
» Web application
Mail application, websites
Hardware Versus Software
12
Computer Categories
– Usage
• Special-purpose computers
• Geneeral-purpose computers
Super computer
Microcomputers
• CPU is manufactored as a single chip called microprocessor
• less powerful and cost
• can be categorized into:
– Desktop
–used for a variety of user applications (e.g., email, web browsing, document processing)
Portable
categorized into:
•Notebook (or laptop)
•Tablet
Architecture of Modern Computer
Central Processing Unit (CPU)
Central Processing Unit (CPU):
the main unit of the computer
responsible for executing programs stored in the internal memory.
It consists of two parts:
1) Arithmetic and Logic Unit (ALU) .
2) Control Unit (CU) .
1) Arithmetic and Logic Unit (ALU): performs:
• Arithmetic operations: Addition, Subtraction, Multiplication, Division, Modulus, Power,… etc.
• Logical: AND, OR, XOR, SHIFT, ROTATE,…etc.
2) Control Unit (CU):
responsible for controling all the CPU operations, such as:
• Decoding the instructions of programs stored in the internal memory.
• Controlling the flow of information through the ALU, I/O, and internal memory.
Internal Memory
Internal Memory:
Composed of chips of integrated circuits which are capable of quickly storing and retrieving data. It can be:
3) Cache Memory
• It contains built-in programs (e.g., BIOS) that are needed by the computer to start operation
(booting up) when powered on.
• Theses programs are stored permanently during the manufacturing and can’t be lost when power
is turned off (nonvolatile memory)
• It contains built-in programs (e.g., BIOS) that are needed by the computer to start operation (booting up) when
powered on.
• Theses programs are stored permanently during the manufacturing and can’t be lost when power is turned off
(nonvolatile memory)
• It stores the programs and their data which are needed to be executed by the CPU.
• When the power is off, all the stored data in RAM are lost (volatile memory).
• When you buy a computer, you pay for RAM not ROM.
3) Cache Memory:
• Very high-speed memory acts as temporary area (volatile memory) between the CPU and RAM.
• store program instructions and data that are frequently re-referenced by the program during operation.
External Storage
External Storage (Auxiliary Memory):
• It holds the programs and data permanently even if the power is off.
• It has many forms such as Compact Disks (CDs), Digital Versatile Disks (DVDs), and Flash Memories.
Input Devices:
• Examples of these devices such as keyboard, mouse, light-pen, scanner, microphone and …etc.
Output Devices:
Multimedia
Data Coding & Decoding
• Human senses deal with a variety of data.
• Electrical signals are then translated into universal format (0s,1s), this is known as
coding.
• After processing, output devices transform back data into their original form, this is
known as decoding.
Text Representation:
Extended ASCII
Image Representation
• Images can be represented as a collection of dots (pixels). Such pixels are arranged in rows and
columns over the image.
• Image resolution depends on the number of pixels in the image and the higher the resolution the
more information the image contains
• In the case of a simple black and white image, each pixel can be represented by a single bit whose
value depends on whether the corresponding pixel is black or white.
Audio Representation
• Audio is sound and the sound signal is analog signal.
• The representation of audio signal requires converting it from analog signal into digital signal
(digitization) by the sampling and quantization processes.
• Videos can be encoded as series of image frames with synchronized audio tracks also encoded
using bits.
Data representation in Computers
( ...... . ...... ) =
* + * + ....... + *
+
* + * + ....... + *
Example
Example: From binary to decimal
• The equivalent decimal value for the binary number:
(11011.101)2 =
1*2 +1*2 + 0*2 + 1*2 + 1*2 + 1*2 + 0*2 + 1*2
= (27.625)
• Another solution:
1 1 0 1 1 . 1 . 0 . 1 .
= 1*16 +1*8 +0*4 +1*2 +1*1 +1*0.5 +0*0.25 +1.0.125
= (27.625)10
Excercise
r÷ 502569
r* 0.365
Example: From Decimal to Binary (Integer part)
2 ÷
Example: From Decimal to Ternary
(1112)3
Exercise
2* 0.625
0.25 1
0.5 0
0 1
(0.101)2
Therefore, the number (0.1011)2 is the exact binary equivalent to the decimal number (0.625)10
Example: From Decimal to Ternary
3* 0.012345679
0.0370370375 0
0.111111111 1
0.3333333 0
0.9999999 1
(0.0101)3
Therefore, the number (0.0101)2 is the ternary equivalent to the decimal number (0.012345679)10
Excercise
• (0.390625)10 = ( ?? )8
• (0.25)10 = ( ?? )16
From Decimal to binary
• Convert (174.390625)10 to its binary value
Therefore, the number (10101110.011001)2 is the exact binary equivalent to the decimal number (174.390625)10
From decimal to ternary
• Convert the decimal number (124.33) 10 to its equivalent ternary
number
Therefore, the number (11121.02222)3 is the approximate ternary equivalent to the decimal number (124.33)10
From Decimal to Octal
• Convert the decimal number (167.390625)10 to its equivalent octal number.
Therefore, the number (247.31)8 is the exact octal equivalent to the decimal number (167.390625)10
From decimal10 to hexadecimal16
Therefore, the number (F7.64)2 is the exact hexadecimal equivalent to the decimal number (247.390625)10
Exercise
• (95.236)10= (??)8
• (153.513)10 = (??)8
From Binary to Octal and Octal to Binary
• There are two methods:
First (Indirect Conversion):
(1001101.1011)2 = (??)8
Solution
• Step 1:
convert (1001101.1011)2 to (??)10
Indirect Method: Example...
Step2:
Convert from (77.6875)10 = (??)8
From Binary to Octal and Octal to Binary
• There are two methods:
First (Indirect Conversion):
Octal 0 1 2 3 4 5 6 7
Binary 000 001 010 011 100 101 110 111
Direct Method: Example
• Second(Direct conversion):
Each 4-binary digits are replaced by one hexadecimal digit , and
vice versa , using the following table:
Hexa 0 1 2 3 4 5 6 7 8 9 A B C D E F
Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
Direct conversion Example
Solution
(D E F.A 1)16
(1101 1110 1111. 1010 0001)2
Hexa-Octal Conversion
• Second Method
1- convert hexa to decimal
2- convert decimal to octal
Hexa to octal conversion Example
• (2F.C4)16= (???)8
Octal-Hexa Conversion
• Second Method
1- convert Octal to decimal
2- convert decimal to hexa
Hexa to octal conversion Example
• (762.013)8= (???)16
Solution