Sei sulla pagina 1di 10

CHAPTER#4

COMPUTER CODES

Q#1:) Define the term byte. What is the difference between a bit and a
byte?

ANS:

Computers use binary coding scheme to represent data internally. In binary


coding a group a bits represent every symbol that appears in the data. The
group of bits used to represent a symbol is called a byte. Most modern
computers use 8 bits to represent a symbol. Hence the term byte commonly
means group of 8 bits.

Q#2) Write 4 bit BCD code of the following numbers?

ANS:

(a)2510 =0010 0101

(b)12810 =0001 0010 1000

(c)6410 =0110 0100

(d)102410 = 0001 0000 0010 0100

Q#3) Write BCD code of the following words using binary notations?

ANS:

(a)BIT: 110001 111001 010011

(b)CODE: 110011 100110 110100 110101

(c)BYTE: 110001 011000 010011 110101

(d)ZERO : 011001 110101 101001 100110

Q:4)Write BCD code of the following words using octal notation?

ANS

(a)COMPUTER: 63 46 44 47 24 23 65 51

(b)VIDEO: 25 71 64 65 46
(c)INPUT: 71 45 47 24 23

(d)OUTPUT: 46 24 23 47 24 23

Q#5) Why BCD code was extended to EBCDIC?

ANS

BCD was extended from a 6 bit code to an 8 bit code .The added two bits are
used as additional zone bits, expanding the zone to four bits. In BCD 4 bit BCD
coding system can be used to represent only decimal numbers because first four
bits are insufficient to represent the various character .Since EBDCIC is an 8 bit
code It can easily be divided into two four bit groups. Each of these 4 bit groups
can be represented by one hexadecimal digit.

Q#6) How many different characters are possible in the following


encoding scheme?

ANS

BCD: It is 6-bit code that can represent 64 different characters.

EBCDIC: It is an 8-bit code that can represent 256 different characters.

ASCII-7: It is 7-bit code that can represent 128(27) different characters.

ASCII-8: It is an 8-bit code that can represent 256 (28) different characters.

Q#7) Why are octal and hexadecimal shortcut notations used. Identify
shortcut notations used for each of the following computer codes?

ANS

The use of octal and hexadecimal number system as shortcut notations for
binary. Since BCD Is 6-bit code it can easily be divided into two 3-bit groups.
Each of these 3-bit groups can be represented by one octal digit. Hence octal
number system is used as shortcut notations for memory dump that use BCD
code for internal representation of characters.

Q#8) Why do we have a packed decimal format. How does it differ from
zone decimal format?

ANS

Most computers cannot perform arithmetic operations on zoned-decimal data.


Hence before any arithmetic operation can be performed the data must be
converted to a format on which arithmetic operations are possible .One such
acceptable format is packed decimal format. Numeric data inputs to a computer
are usually zoned decimal numbers. Printers can print only those numeric
characters affected that are in zoned decimal format

Q#9) A newly designed computer code uses 9 bits. How many different
characters are possible in this code?

ANS

There are (29) possible characters in this code.

Q#10) Write EBCDIC code for the following words in both binary and
hexadecimal notations. How many bytes are required to store each of
these words using these coding?

ANS

(a)SUN

Binary: 1110 0010 1110 0100 1101 0101

Hexadecimal: E2 E4 D5

It required 3 bytes to store these coding.

(B)MOON

Binary: 1101 0100 1100 0100 1100 0100 1101 0101

Hexadecimal: D4 D6 D6 D5

It required 4 bytes to store these coding.

(c)CAT

Binary: 1100 0011 1100 0001 1110 0011

Hexadecimal: C3 C1 E3

It required 3 bytes to store these coding.

(D)DOG

Binary: 1100 0100 1101 0110 1100 0111

Hexadecimal: C4 D6 C7

It required 3 bytes to store these coding.

Q#11) Write Hexadecimal code for following words in hexadecimal


notation. How many bytes are required to store each of these words
using these coding?
ANS

(a)PROGRAMM: D7 D9 D6 C7 D9 C1 D4 D4

It required 7 bytes to store these coding.

(B)OUTPUT: D6 E4 E3 D7 E4 E3

It required 6 bytes to store these coding.

(C)BYTE: C2 E8 E3 C5

It required 4 bytes to store these coding.

(D)OCTAL: D6 C3 E3 C1 D3

It required 5 bytes to store these coding.

Q#12) Write EBCDIC code for the following words in binary notations.
How many bytes are required to store each of these words using these
coding?

ANS

(a)ZONE :1110 1001 1101 0110 1101 0101 1100 0101

It required 4 bytes to store these coding.

(B)BOY: 1100 0010 1101 0110 1110 1000

It required 3 bytes to store these coding.

(C)SKY:1110 0010 1101 0010 1110 1000

It required 3 bytes to store these coding.

(D)TAPE:1110 0011 1100 0001 1101 0111 1100 0101

It required 4 bytes to store these coding.

Q:13)Using hexadecimal notation write the zone decimal coding of the


following numbers. . How many bytes are required to store each of
these words using these representations?

ANS

(a)1256:F1 F2 F5 C6

It required 4 bytes to store this representation.


(b)+439:F4 F3 C9

It required 4 bytes to store this representation.

(c)-63:F6 C3

It required 2 bytes to store this representation.

(d)-786:F7 F8 C9

It required 3 bytes to store this representation.

Q:14)Using hexadecimal notation write the packed decimal coding of


following numbers. How many bytes are required to store each of these
words using these representations?

ANS

(a)12915: F1 F2 F9 F1 D5

It required 5 bytes to store this representation.

(b)+9876: F9 F8 F7 D6

It required 4 bytes to store this representation.

(c)872: F8 F7 D2

It required 3 bytes to store this representation.

(d)-256 :F2 F5 D6

It required 3 bytes to store this representation.

Q:15)List the similarities and difference between ASCII 7 BIT And ASCII
8 BIT?

ANS

ASCII- 7 is a 7 bit code that can represent 128(27) different characters


.Computers using 8 bit byte(group of 8 bits for 1 byte)and the 7 bit ASCII either
set the 8th bit of each byte as zero or use it as a parity bit.

ASCII- 8 is an extended version of ASCII-7.It is an 8 bit code that can represent


256(28) different characters. The additional bit is added to the left of the 7th bit of
ASCII- 7 codes. ASCII- 7 uses only 7 bit whereas all the 8 bits are used in ASCII-8.

Q#16) Write ASCII-7 and ASCII-8 codes for the following words using
binary and hexadecimal notations. How many bytes are required to
store each of these words in ASCII?
ANS

(a)DRY:

D=1000100=44
R=1010010=52
Y=1011010=5A
ASCII 7=1000100 1010010 1011010 3 BYTES
ASCII 7=11295A
ASCII 8=01000100 01010010 01011010 3 BYTES
ASCII 8=44525A

(b)DAMP

D=1000100=44
A=1000001=41
M=1001101=4D
P=1010000=50
ASCII 7= 1000100 1000001 1001101 1010000 4 BYTES
ASCII 7=89066D0
ASCII 8= 01000100 01000001 01001101 01010000 4 BYTES
ASCII 8=44414D50

(c) WET

W=1010111=57
E=1000101=45
T=1010100=54
ASCII 7=1010111 1000101 1010100 3 BYTES
ASCII 7=15E2D4
ASCII 8=01010111 01000101 01010100 3 BYTES
ASCII 8=574554

(d)TERM

T=1010100=54
E=1000101=45
R=1010010=52
M=1001101=4D
ASCII 7= 10100100 1000101 1010010 1001101 4 BYTES
ASCII 7=1191694D
ASCII 8= 01010100 01000101 01010010 01001101 4 BYTES
ASCII 8=5445524D

Q#17) Write ASCII 7 AND ASCII 8 OF following words using binary


notations. . How many bytes are required to store each of these words
in ASCII?

ANS

(a):PRINT:
P=1010000
R=1010010
I=1001001
N=1001110
T=1010100
ASCII 7=1010000 1010010 1001001 1001110 1010100 5 BYTES
ASCII 8=01010000 01010010 01001001 01001110 01010100 5 BYTES

(B):RUB:

R=1010010
U=1010101
B=1000010
ASCII 7=1010010 1010101 1000010 3 BYTES
ASCII 8=01010010 01010101 01000010 3 BYTES

(C):TYPE:

T=1010100
Y=1011001
P=1010000
E=1000101
ASCII 7=1010100 1011001 1010000 1000101 4 BYTES
ASCII 8=01010100 01011001 01010000 01000101 4 BYTES

(D):GIVE:

G=1000111
I=1001001
V=1010110
E=1000101
ASCII 7=1000111 1001001 1010110 1000101 4 BYTES
ASCII 8=01000111 01001001 01010110 01000101 4 BYTES

Q#18) What is Unicode .What motivated to its development?

ANS

It is an encoding system that provides a unique number for every character, no


matter what the platform, no matter what the program, no matter what the
program.

Q#19) Why it was difficult to exchange text files internationally before


Unicode was developed. How did Unicode help in overcoming this
problem?

ANS
Different encoding system developed independently of each other obviously
conflicted with one another. That is two encoding system often used the same
code for two different characters or used different codes for the same character.
Due to this problem whenever data transfer took place between Computer
System or software using different encoding systems the data was at the risk of
corruption .As a result it become difficult to exchange text files internationally.
The Unicode was designed to overcome these problems. It is a universal
character encoding standard used for representation of text for computer
processing.

Q#20) Why was Unicode developed?

ANS

Unicode was developed to overcome the problems that are happening with
previous encoding system. The problems are

 No single encoding system has enough bits and an adequate mechanism


to support characters of all types of languages used in the world. Hence
supporting of characters from multiple languages on a single computer
system become a tedious job since it required supporting of multiple
encoding systems on the computer .With hundreds of different encoding
systems in use across the world , it become almost impossible to support
all of them on a single system.

 Different encoding system developed independently of each other


obviously with one another. That is two encoding system often used the
same code for two different characters or used different codes for the
same characters. Due to this problem whenever data transfer took place
between computer systems or software using different encoding systems
the data was at the risk of corruption

Q#21) List some key features of Unicode?

ANS

The key feature of Unicode is

 Unicode provides a consistent way of encoding multilingual plan test. It


has the capacity to encode as many as a million character

 It defines codes for character used in all major languages of the world
used for written communication.

 It can also defines codes for special characters(such as various types of


punctuation marks)mathematical technical symbols .
 It has the capacity to encode as many as a million characters. This is large
enough for encoding all knows characters including all historic scripts of
the world as well as common notational system.

 It assigns each character a unique numeric value and name keeping


character coding simple and efficient

 It reverses a part of the code space for private use to enable users to
assign codes for their own character and symbol.

 It affords simplicity and consistency of ASCII. Unicode characters that


correspond to the familiar ASCII character set have the same byte value as
that of ASCII. This enables use of Unicode in a convenient and backward
compatible manner in environment designed entirely ASCII, like UNIX.

 It specifies an algorithm for presentation of text with bi-directional


behaviour

Q#22) Describe the three encoding forms defines by Unicode


standard and the environment for which each of them is most
suitable?

ANS

Unicode has three encoding forms for each character.

(1)UTF-8(Unicode Transformation Format-8 ): This is byte oriented


format having all Unicode character represented as a variable length
encoding of one, two three or four bytes. This form is useful for dealing
environments designed entirely around ASCII because the Unicode characters
that correspond to the familiar ASCII character set have the same byte values
as that of ASCII. This form is also popular for HTML and similar protocols.

(2)UTF-16(Unicode Transformation Format-16): This is a word oriented


having all Unicode characters represented as a variable length encoding of
one two words. This form is useful for environments that need to balance
efficient access to characters with economical use of storage.

(3)UTF-32(Unicode Transformation Format-32):This is a double word


oriented format having all Unicode character represented as a fixed length
encoding of two words 1 word=16 bits and double word 32 bit code unit
encodes each character. This form is useful for environments where memory
space is not a concern but fixed width access to character is desired.

Q#23)Explain the meaning of term collating sequence?

ANS
Collating sequence is ordering of symbols in an encoding standard. It may
vary from one computer system to another depending on the type of data
encoding used by particular computer for an internal representation of
characters.

Q:24)A computer uses EBCDIC as its internal representation of


characters. In which order this computer sort following things?

ANS

245>123>ADD>ABC

Q:25)A computer uses ASCII ,in which order will this sort following
strings?

ANS

(a):BED:C1 C5 C4

(B):512:F5 F1 F6

(C):ADD:C1 C4 C4

(D):2GOOD:F2 C7 D6 D6 C4

(E):BAD:C2 C1 C4

(F):A1B2: C1 F1 C2 F2

Q:26)Write full form of following abbreviation?

ANS

(a)BCD: Binary Coded Decimal

(b)ASCII: American Standard Code for information Interchange

(c)EBCDIC: Extended Binary-Coded Decimal Interchange Code

(d)UTF:`UNICODE TRANFORMATION FORMAT

Potrebbero piacerti anche