ASCII

From TRCCompSci - AQA Computer Science
Revision as of 12:52, 20 September 2017 by Pkamara (talk | contribs)
Jump to: navigation, search

Definition

ASCII stands for American Standard Code for Information Interchange. It is a character system that lets computers and devices to process letters, numbers and characters. It is represented by a 7-bit binary number that is either 0's or 1's. HTML (HyperText Markup Language) are based on ASCII. There are 128 characters that can be represented using ASCII.

Below is a table showing all of the characters that can be represented using ASCII

ASCII.jpg

Extended ASCII

This used an additional bit (ie 8 bits) to allow for additional characters. Overall extended ASCII supports the original ASCII values but adds the following: Extended ASCII.gif

Unicode

Unicode is different coding system and is becoming more common. It is a 16-bit code, giving enough combinations to store every character in every alphabet (e.g. Urdu, Chinese) plus a vast range of other characters, control and communication codes.

The 16-bit code can represent 65536 different characters.

It maintains compatibility with ASCII by using the same code values as ASCII (ie codes 0-255 are the same as the ASCII table). So if you take ‘z’ and its ASCII value 122 (0111 1010 in binary), the unicode value is still 122 the binary will be 0000 0000 0111 1010.

Trivia

In many programming languages there are ways to be able to find out the ASCII code of a character and vice versa without having to do any visible work

 1 local function convertToASCII(str)
 2   return str:byte()
 3 end
 4 
 5 local function convertFromASCII(num)
 6   return num:char()
 7 end
 8 
 9 print(convertToASCII("s")) -- > 115
10 print(convertFromASCII(115)) -- > s

Revision Questions

Make sure to watch out for caps, they have different values.

1. What is the total number of characters in the ASCII Table?

127
The original ASCII table was from 7 bits but after they changed it to 8 the total possible number of characters increased to 256
256
95
22

2. ASCII is the abbreviation of:

American Standard Code for Information Interchange
American Standard Code for Information Exchange
American Standard Code for Informative Exchange

3. R has an ASCII value of 82. What is the ASCII value of W?


4. s has an ASCII value of 115. What is the ASCII value of k


5. Q has an ASCII value of 81. What is the ASCII value of Z


6. True or False does Unicode support characters than ASCII

TRUE.
FALSE.

Your score is 0 / 0