# Data Representation / Numbering Conversion / File Permissions

### Main Objectives of this Practice Tutorial

• Understand the importance of how computers store data (i.e. data representation)
• Understand the purpose of decimal, binary, octal and hexadecimal numbers
• Perform various numbering conversions between the decimal, binary, octal and hexadecimal numbering systems
by hand without the use of a computer or calculator
• Identify which numbering system conversion method to use when required to perform a numbering conversion
• Understand directory and regular file permissions
• Learn how to set directory and regular file permissions with the chmod command (symbolic and octal methods)
• Learn how to use the umask command to have permissions for directories and files automatically set upon their creation

### Tutorial Reference Material

 Course Notes Numbering Conversion / File Permissions Reference YouTube Videos Slides:PDF | PPTX Data Representation Definitions Decimal , Binary , Octal , Hexadecimal Numbers Numbering Conversion Binary to Decimal / Decimal to Binary Binary to Octal / Octal to Binary Binary to Hexadecimal / Hexadecimal to Binary Octal to Hexadecimal / Hexadecimal to Octal File Permissions Instructional Videos:x x x x

# KEY CONCEPTS

### Why Study Data Representation?

 A series of binary numbers form a byte to represent numbers. Bytes can be used to also represent characters. It is job of a program to know if bytes are used to represent numbers or characters. Learning to convert numbering systems(like Hexadecimal to Binary) can be used to know how a character is represented in binary.

Data (treated as singular, plural, or as a mass noun) is any sequence of one or more symbols given meaning by specific act(s) of interpretation. Digital data is data that is represented using the binary number system of ones (1) and zeros (0), as opposed to analog representation.
Reference: https://en.wikipedia.org/wiki/Data_(computing)

Therefore, computers process and store information in a binary number system consisting of 0s and 1s. For many aspects of programming and networking, the details of data representation must be understood.

Reasons to Understand Data Representation:

• C Programming: Sending information over networks, files
• Web Development: Setting color codes for webpage background or text
• Allowing or Limiting Unix / Linux File Access: Setting permissions for files and directories

In terms of this course, we will learn how a simple decimal number (integer) is stored into the computer system as a binary number. We will also learn other numbering systems (octal and hexadecimal) that can be used as a "short-cut" to represent binary numbers.

### Decimal / Binary / Octal / Hexadecimal Numbering Systems

File:Decimal-number-1.png
The decimal numbering system .

Decimal Numbers

The decimal numbering system is a numbering system where each digit can be represented by numbers 0 - 9. The reason for this system may be attributed to the fact that humans were used to counting on their fingers and thumbs.

The numbering system is based on sums of the power of 10.

According to the diagram to the right, each digit moving to the left of units value is the placeholder multiplied to the power of ten. Units are ten to the power of zero (which is 1), tens are ten to the power of one, etc.

The binary numbering system .

Binary Numbers

The binary numbering system is a numbering system where each digit can be represented by numbers 0 or 1. Digital computers have data-paths that can represent those 0s and 1s based on voltage levels.

The numbering system is based on sums of the power of 2.

According to the diagram to the right, each digit moving to the left of units value is the placeholder multiplied to the power of two. Units are ten to the power of zero (which is 1), then two to the power of one (which is 2), etc.

 The octal numbering system . The hexadecimal numbering system .

The octal and hexadecimal numbering systems are represented by values of 0 - 7 and 0 - F respectively. For hexadecimal numbers, values for 10 to 15 (which can only be represented by a single digit) use letters a to f respectively.

The numbering system is based on sums of the power of 2.

According to the diagram to the right, each digit moving to the left of units value is the placeholder multiplied to the power of two. Units are ten to the power of zero (which is 1), then two to the power of one (which is 2), etc.

### Numbering Conversion Methods

#### Method 1: Binary to Decimal

Performing a binary to decimal conversion.

When converting binary numbers to decimal numbers, perform the following steps:

1. Write the binary number (space between the digits).
2. Starting from the right-side, draw L's moving to the left (refer to diagram on right).
3. Starting on the right, multiply the number by 2 to the power of zero.
4. Repeat moving to the left, but increase the power by 1 each time.
5. Add up the calculations to obtain the decimal value equivalent.

NOTE: To convert other numbering system to decimal, replace the number 2
(in red in the diagram to the right) with 8 (for octal) or 16 (for hexadecimal)
.

#### Method 2: Decimal to Binary

Performing a decimal to binary conversion.

When converting decimal numbers to binary numbers, perform the following steps:

1. On the left side, write the decimal number to be converted.
2. Far to the right, write the number 1 and while moving leftwards, double the number until that number is NOT greater than the decimal number to be converted (refer to the diagram).
3. If you are converting to 8-bit, 32-bit, etc., enter leading zeros if those doubled numbers are greater than the decimal number.
4. Moving in a rightwards direction, if there is a doubled number less than the decimal number, write a 1 and subtract the double number's value from the decimal number.
5. If the next doubled number is greater then the remainder, then write a zero; otherwise, if the number is less than but not zero, repeat the above steps #.
6. Add up the calculations to obtain the decimal value equivalent.

x

x

x

x.

x.

# LINUX PRACTICE QUESTIONS

The purpose of this section is to obtain extra practice to help with your assignment #1, quizzes, your midterm, and your final ezam.

Here is a link to the MS Word Document of ALL of the questions displayed below but with extra room to answer on the document to simulate a quiz:

Your instructor may take-up these questions during class. It is up to the student to attend classes in order to obtain the answers to the following questions. Your instructor will NOT provide these answers in any other form (eg. e-mail, etc).

Review Questions:

1. x.
2. x.
3. x.
4. x.
5. x.
6. x.
7. x.
8. x.

When answering Linux command questions on this side or the back side of this page, refer to the following Inverted Tree diagram. The uli101 directory is contained in your home directory. Assume that you just logged into your Matrix account. Directories are underlined.

1. x
2. x
3. x
4. x
5. x
6. x
7. x