You are on page 1of 18

CS

Contents: -

1. Number systems

2. Text, Sound and Images in binary representation, calculation of file size.

3. Data compression- Lossy and lossless compression techniques

4. Input and Output devices, Data storage (Memory)

5. Program development life cycle and computer systems and sub-systems.

6. Purpose of give algorithm

7. Validation and Verification check

8. Test Data

9. Dry run algorithm

10.Identify errors in given algorithm

11.Write an algorithm for given problems and scenarios

12.Pseudocode and algorithm

1. Number systems

1|Page
Hexadecimal to decimal: -

2|Page
Decimal to Hexadecimal: -

 This is trial-error method. It involves placing hexadecimal in the


appropriate position so that the total equates to decimal value.
 Convert 2004 to hexadecimal. 

Error Codes: -

 Numbers refer to the memory location of the error and are usually
automatically generated by the computer. 
 The programmer needs to know how to interpret the hexadecimal error
codes.

3|Page
Another method used to trace errors during program development is to use
memory dumps, where the memory contents are printed out either on screen or
using a printer. Find examples of memory dumps and find out why these are a
very useful tool for program developers.

Media Access Control (MAC) address: -


 Number which uniquely identifies a device on a network. 
 It refers to the network interface card (NIC) which is part of the device.
 Usually made up of 48 bits which are shown as 6 groups of two
hexadecimal digits.

 First half (NN – NN – NN) is the identity number of the manufacturer of


the device.
 Second half (DD – DD – DD) is the serial number of the device

Internet Protocol (IP) Addresses: - 

 Each device connected to a network is given an address known as the


Internet Protocol (IP) address.
 An IPv4 address is a 32-bit number written in denary or hexadecimal
form: e.g., 109.108.158.1 (or 77.76.9e.01 in hex).
 An IPv6 address is a 128-bit number broken down into 16-bit chunks,
represented by a hexadecimal number. 

E.g., a8fb:7a88: fff0:0fff:3d21:2085:66fb: f0fa

 IPv6 uses a colon (:) and IPv4 uses decimal point (.)

HTML: -

 Hypertext Mark-up Language (HTML) is used when writing and


developing web pages. 

 HTML isn’t a programming language but is simply a mark-up language. 

4|Page
E.g., <h1 style="colour: #FF0000;">This is a red heading</h1>

 Colours can be made up of different combinations of the three primary


colours (red, green and blue). 

 The different intensity of each colour (red, green and blue) is determined
by its unique hexadecimal value.

 # FF 00 00 represents primary colour red

 # 00 FF 00 represents primary colour green

 # 00 00 FF represents primary colour blue

Logical Binary Shifts: -

 Computers can carry out a logical shift on a sequence of binary numbers. 


 The logical shift means moving the binary number to the left or to the
right. 
 Each shift left is equivalent to multiplying the binary number by 2.
 Each shift right is equivalent to dividing the binary number by 2.
 As bits are shifted, any empty positions are replaced with a zero.

2. Text, Sound and Images in binary

Text: -

ASCII: -

Characters are encoded with the use of Character sets. These are a group of
codes that assign a character to a unique bit pattern. Like capital A is 0001
which is a character code. ASCII stands for American Standard Code for
Information Interchange.

Unicode: -

5|Page
However, extended ASCII is not represented all possible characters, so a new
character set called Unicode was developed. ASCII is the subset of Unicode
(they share up to 127)

Unicode used 16 bits for each character, but this has since been expanded. It
currently has 120,000+ characters. It aims to cover all symbols and characters
every used.

Sound: -

There is a speaker. Speakers transmit sound through air as a sound wave and
that’s what we hear. So, we use a microphone to record the sound wave and it
records it into a signal. This signal is represented by different levels of voltage
so as the pressure get more the voltage gets higher and as the pressure gets less
voltage gets lower.

This is now inside a computer or machine as an electrical analog signal, and


then we use a process called ADC (Analog to Digital Converter). So, it turns the
analog graph to digital graph and each and everyone of those samples can be
represented as a number which means binary. Now we got that in a big old file
so we have just got lost a lot of samples in the computer or a CD let’s say

6|Page
44,100 samples per second. So, we have sample it that many times and we put
those numbers into a binary file now that binary file can be obviously be frozen.

So, if we bring that file into the internet and someone can pick it. And now what
they do is digital to analog converter so now it is reconstructing this is kind of
digital file again and then we can make that into an analogue signal we then
feed that into a speaker and the speaker starts vibrating putting out those waves
of sound and that’s what we hear.

Images: -

Digital images are made up of pixels. Each pixel in an image is made up of


binary numbers. If we say that 1 is black (or on) and 0 is white (or off), then a
simple black and white picture can be created using binary. To create the
picture, a grid can be set out and the squares coloured (1 – black and 0 – white).

Adding colour: -

The system described so far is fine for black and white images, but most images
need to use colours as well. Instead of using just 0 and 1, using four possible
numbers will allow an image to use four colours. In binary this can be
represented using two bits per pixel:

 00 – white
 01 – blue
 10 – green
 11 – red
While this is still not a very large range of colours, adding another binary digit
will double the number of colours that are available:

 1 bit per pixel (0 or 1): two possible colours


 2 bits per pixel (00 to 11): four possible colours
 3 bits per pixel (000 to 111): eight possible colours
 4 bits per pixel (0000 – 1111): 16 possible colours

7|Page
 16 bits per pixel (0000 0000 0000 0000 – 1111 1111 1111 1111): over
65 000 possible colours
The number of bits used to store each pixel is called the colour depth. Images
with more colours need more pixels to store each available colour. This means
that images that use lots of colours are stored in larger files.

Image quality: -

Image quality is affected by the resolution of the image. The resolution of an


image is a way of describing how tightly packed the pixels are.

In a low-resolution image, the pixels are larger so fewer are needed to fill the
space. This results in images that look blocky or pixelated. An image with a
high resolution has more pixels, so it looks a lot better when you zoom in or
stretch it. The downside of having more pixels is that the file size will be bigger.

3. calculation of file size.

Text files: -

Let’s take an example

A file says: Calculate the size of this file

So, it has 31 characters. Each ASCII character has a value of 1 byte. So, it has
31 bytes the text file.

Image files: -

Let’s take a Bitmap Image. Like it has 1600*1200 pixels. So what we do is:

1600 * 1200 * 3 which gives us 5,760,000

Now let’s take another example-

A BMP photo is 1024*512. Calculate the file size of this image in Megabytes.

1024 * 512 * 3 = 1,572,864 bytes


1,572,864/1024= 1536 kilobytes

8|Page
1536/1024= 1.5 Megabytes

One more example-

This file goes through JPEG compression and is compressed by a factor of 12.
Calculate the new file size in Kilobytes.

1.5 * 1024 = 1536 kilobytes


1536/12= 128 kilobytes

4. Data compression- Lossy and lossless


compression techniques

There are 2 types of file compression:

 Lossy- It says itself that while compressing file data is lost. Data lost can
not be retrieved it is permanently removed. This compression is used in
Images and audio files. When compressing images even a small quality
lost is unnoticeable and it is okay if its lost and at that point of time lossy
compression is very useful.

 Lossless- This also says that there would be no data lost during
compression. It means you will get the original file when uncompressed.
This compression technique is used in text files, code scripts and etc…
Especially talking of code scripts, even if a single line or a single word in
a program the code will be malfunctioned so in this time lossless
compression helps a lot.

9|Page
5. Input and Output devices, Data storage
(Memory)

What is Input and Output devices: -

Input devices are devices which get an input from the user and Output devices
are devices which shows an output to the user so in input devices there are
examples like Mouse, Keyboard, Camera, Touch screens and etc… And if you
are watching a video in your phone then your display is output devices, if you
are watching it in a laptop then the monitor.

10 | P a g e
6. Program development life cycle

11 | P a g e
7. computer systems and sub-systems.

12 | P a g e
8. Purpose of give algorithm

13 | P a g e
9. Validation and Verification check

14 | P a g e
10. Test Data

15 | P a g e
11. Dry run algorithm

12. Identify errors in given algorithm


16 | P a g e
13. Write an algorithm for given problems and
scenarios

17 | P a g e
14. Pseudocode and algorithm

18 | P a g e

You might also like