0% found this document useful (0 votes)
27 views5 pages

Assignment 2

computer science research

Uploaded by

chitumaalmond510
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views5 pages

Assignment 2

computer science research

Uploaded by

chitumaalmond510
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Assignment 2

Binary, or base-two, numbers are extremely important in computer science because they are used in
designing computers. Computer scientists also use octal and hexadecimal numbers, which are closely
related to binary numbers. Therefore computer science majors need to have a good understanding of all
these number systems and be able to convert between them and decimal, or base-ten, numbers. You
can use the procedures listed below for each number system to convert the decimal number 481 to
binary, octal, or hexadecimal.

1. Conversion to Binary
Note the residue and the quotient after dividing the integer by two.
Until the quotient equals zero, keep dividing it by two.
Reading the remainders in reverse order yields the binary representation.
As an illustration, consider 481: Which are the first 3 digits in my date of birth.

Remainder 1 240 ÷ 2 = 120, remainder 0 120 ÷ 2 = 60, remainder 0 60 ÷ 2 = 30, remainder 0 30 ÷ 2 = 15,
remainder 0 15 ÷ 2 = 7, remainder 1 7 ÷ 2 = 3, remainder 1 3 ÷ 2 = 1, remainder 1 1 ÷ 2 = 0, remaining 1

2. Conversion of Octals
After dividing the total by 8, note the residue and the quotient.
Continue doing this until the quotient equals zero.
The remainders are read in reverse order to obtain the octal representation.
As an illustration, consider 481:

When the remainders are read from bottom to top, they equal 741 (octal). Copy code 481 ÷ 8 = 60,
residual 1 60 ÷ 8 = 7, remainder 4 7 ÷ 8 = 0, remainder 7.

3. Converting Hexadecimals
After dividing the integer by 16, note the residue and the quotient.
Continue till there is no more quotient.
If there are remainders more than nine, use the following: The numbers 10 through 15 are A, B, C, D, E,
and F.
The remainders are read in reverse order to obtain the hexadecimal representation.
As an illustration, consider 481:
Rewrite code as follows: 1E1 (hexadecimal) is the result of reading the remainders from bottom to top:
481 ÷ 16 = 30, remainder 1; 30 ÷ 16 = 1, remainder 14 (E); 1 ÷ 16 = 0, remainder 1.

Fortney, Jon Pierre. Discrete Mathematics for Computer Science : An Example-Based Introduction, CRC
Press LLC, 2020. ProQuest Ebook Central,
http://ebookcentral.proquest.com/lib/univ-people-ebooks/detail.action?docID=6426052.
Created from univ-people-ebooks on 2024-09-18 13:53:47.
Q2

For a number of reasons, being able to convert between different number systems is essential in
technical industry employment.

1. Comprehending Computer Architecture


Although binary (base-2) is the primary form used by computers, they frequently need to interface with
higher-level representations such as decimal (base-10), octal (base-8), and hexadecimal (base-16).
Gaining an understanding of these conversions aids in understanding the handling and storing of data.
2. Troubleshooting and Programming
Hexadecimal is widely used in programming languages and environments for debugging and memory
locations. Programmers can effectively read and modify data by converting between different number
systems, especially when working with low-level programming or system design.

3. Protocols and Networking


Hexadecimal notation is frequently used in networking technologies for MAC and IP addresses. It can be
essential to comprehend these formats and know how to convert them for network configuration and
troubleshooting.
4. Information Display
Certain programs may need data in binary, octal, or hexadecimal forms. Proficiency in conversions
guarantees accurate data representation, which is essential for system compatibility.
5. Design of Algorithms
Algorithms in domains such as data compression and encryption can be optimized by utilizing several
number systems. Solving problems more effectively can result from knowing how to work with different
systems.

Q3

Selecting coding representations like ASCII, Unicode, or BCD (Binary-Coded Decimal) is crucial for a
technology company that specializes in software development for a number of reasons including
efficiency, compatibility, and functionality. The following explains the potential need for various
representations and how to select one:

1. Encoding Conditions
American Standard Code for Information Interchange, or ASCII, is the best option for encoding standard
English letters, numbers, and punctuation in text. It is appropriate for systems with limited memory
where basic English text is all that is required because it only needs seven bits per character.

Applications that require a greater variety of characters than those found in ASCII, such as symbols and
characters from several languages (such as Chinese and Arabic), must use Unicode. It is essential for the
internationalization and globalization of software and can represent more than a million characters.
Binary-Coded Decimal, or BCD, is helpful in applications like financial ones where numerical data must be
shown in decimal format. BCD can streamline the binary to decimal conversion process, minimizing
rounding mistakes in computations.
2. Communication Devices
Certain data formats may be required by different devices. For example, some hardware might only
support ASCII data, while others might need data in Unicode or a certain type of numeric format, such as
BCD. To guarantee flawless connection, it is essential to comprehend the requirements of each gadget.
3. Performance and Efficiency
Certain encoding systems may be more effective than others, depending on the requirements of the
project. For basic text, ASCII might be better if memory consumption is an issue. On the other hand,
Unicode would be required despite its bigger size if the application required substantial user input or
used complicated character sets.

4. Accuracy of Data
Maintaining data integrity between various systems is facilitated by using the proper representation. For
instance, BCD maintains numerical accuracy in financial computations, whereas Unicode guarantees
accurate text appearance independent of language or location.
Selecting the Appropriate Image
Take into account the following elements when determining which coding representation to utilize for a
particular project:

Project Requirements: Determine the application's unique requirements, taking into account the many
kinds of data being processed (text, numbers, and special symbols).
The intended audience Establish if the program will be utilized domestically or abroad as this will affect
the character encoding selection (ASCII vs. Unicode).
Device Compatibility: Verify that the selected format is supported by the specifications of the devices
that will interact with the system.

Q4

Creating a Multilingual Messaging App is an Example Situation


Setting: Envision yourself as a member of a group creating a chat program intended to help people
communicate in different languages and nations. The program must process user-inputted text in a
variety of languages, such as Arabic, Chinese, English, and more. The app must also properly show
messages across a range of gadgets, including PCs, tablets, and smartphones.

Challenge: Your boss assigns you the responsibility of making sure the program can efficiently encode
and decode messages, which entails transforming the input text into the proper hexadecimal, binary,
and octal formats. In order to accommodate all users without compromising data integrity or
functionality, the application must accept multiple character sets.

Selecting the Correct Coding Representation User Experience Is Crucial:

Unicode: By using Unicode as the main character encoding, a wide variety of characters and symbols
from many languages can be supported by the program. This guarantees accurate message display for
users, improving their experience and avoiding miscommunication.
Users would become confused and frustrated if communications with non-English characters were
misinterpreted and only ASCII was used.

Device Interoperability:

Character encodings may be interpreted differently by various devices. For example, an older device may
require fallback options since it may not handle Unicode fully. In this scenario, Unicode support on
contemporary devices might still be supported but the program could fall back to a more basic
representation (like ASCII) as needed.
Data Accuracy:

Data integrity must be maintained for a messaging program. If the application wants to convey numerical
data (such prices or quantities) within messages without running the danger of rounding mistakes, then
using BCD can be crucial. In this instance, BCD guarantees precise encoding of the numbers, maintaining
their intended values during transmission.

Q5

Let's examine the widths, compatibility, and common use cases of ASCII, Unicode, Gray code, BCD, and
EBCDIC character sets and usage in the context of a multilingual messaging application.

1. American Standard Code for Interchange of Information, or ASCII


Character Set Size: 128 characters (128 bits)
Compatibility: Broadly supported in a number of programming languages and devices.
Use: Mostly for control characters, punctuation, and simple English text. limited in how non-English
characters can be handled.
2. Unicode Character Set Size: Variable; up to over a million characters could be supported in the future,
with a current support of about 143,000 characters spanning several scripts and symbol sets.

Compatible: Compatible with all current software and systems, which makes it perfect for global
applications.
Use: A must for programs that need multilingual support. It guarantees that characters from different
languages are shown accurately.
The size of the Gray Code Character Set is not a set of characters per se, but rather a binary numeral
system in which two values differ by just one bit.
Compatibility: Not usually utilized for text representation; primarily used in digital systems and error
correction.
Usage: Not appropriate for text encoding in messaging apps, but helpful in digital communications and
rotary encoder applications.

Let's examine the widths, compatibility, and common use cases of ASCII, Unicode, Gray code, BCD, and
EBCDIC character sets and usage in the context of a multilingual messaging application.
1. American Standard Code for Interchange of Information, or ASCII
Character Set Size: 128 characters (128 bits)
Compatibility: Broadly supported in a number of programming languages and devices.
Use: Mostly for control characters, punctuation, and simple English text. limited in how non-English
characters can be handled.
2. Unicode Character Set Size: Variable; up to over a million characters could be supported in the future,
with a current support of about 143,000 characters spanning several scripts and symbol sets.
Compatibility: It is perfect for global applications because it is widely supported in contemporary
software and systems.
Use: Required for programs that need to support several languages.

You might also like