0% found this document useful (0 votes)
26 views21 pages

8th Comp New Notes Ch2 and Ch3

The document outlines the steps for converting decimal numbers to binary, octal, and hexadecimal systems, as well as the properties of these number systems. It also explains how integers, real numbers, and whole numbers are defined, and how signed integers are stored in computers using two's complement. Additionally, it details the process of representing floating-point numbers in both single and double precision formats.

Uploaded by

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

8th Comp New Notes Ch2 and Ch3

The document outlines the steps for converting decimal numbers to binary, octal, and hexadecimal systems, as well as the properties of these number systems. It also explains how integers, real numbers, and whole numbers are defined, and how signed integers are stored in computers using two's complement. Additionally, it details the process of representing floating-point numbers in both single and double precision formats.

Uploaded by

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

Topic 2.1.2.

1 pg-26

Q. Write the steps to convert a decimal number into binary number.


Ans. The steps to convert a decimal number into binary number are given below.
Step 1: Divide the given decimal number by 2.
Step 2: write the reminder.
Step 3: Divide the quotient by 2
Step 4: Repeat steps 2 and 3 until the quotient becomes 0.
Step 5: Write all the reminders from bottom to top. It is the required binary number.

Topic 2.1.3 pg-27

Q. What is Octal number system?


Ans. Some of the properties of Octal number are given below.
Octal means = Eight
Base = Eight
Number of digits = Eight
List of digits = 0,1,2,3,4,5,6,7
Weights = ……512 64 8 1 or ……..83 82 81 80
Examples = (23)8 , (407)8 , (6234)8

Q. How we convert any Octal number into Binary number?


Ans. To convert Octal number into Binary number follow these steps.
Step 1: Convert each digit of Octal number into its equivalent three digits binary number.
Step 2: Write all groups of three digits binary numbers in the same order as the digits of Octal number are written. It
is the required binary number.
Example: (632)8=(?)2 Octal Three binary
Digits weights used
6 3 2 4 2 1
2 0 1 0
110 011 010
3 0 1 1
(632)8=(110 011 010)2 6 1 1 0

So the Binary equivalent of Octal number (632)8 is (110011010)2

Topic 2.1.3.1 pg-28

Q. Write the steps to convert a decimal number into octal number.


Ans. The steps to convert a decimal number into octal number are given below.
Step 1: Divide the given decimal number by 8.
Step 2: write the reminder.
Step 3: Divide the quotient by 8
Step 4: Repeat steps 2 and 3 until the quotient becomes 0.
Step 5: Write all the reminders from bottom to top. It is the required octal number.
Topic 2.1.4 pg-29

Q. How we convert any Hexadecimal number into Binary number?


Ans. To convert Hexadecimal number into Binary number follow these steps.
Step 1: Convert each digit of Hexadecimal number into its equivalent four digits binary number.
Step 2: Write all groups of four digits binary numbers in the same order as the digits of Hexadecimal number are
written. It is the required binary number.
Example: (D3A)16=(?)2 Hexadecimal Four binary weights
Digits used
D 3 A 8 4 2 1
A = 10 1 0 1 0
1101 0011 1010
3 = 3 0 0 1 0
(D3A)16=(1101 0011 1010)2 D = 13 1 1 0 1

So the Binary equivalent of Octal number (632)16 is (110100111010)2

Topic 2.1.4.1 pg-30

Q. Write the steps to convert a decimal number into hexadecimal number.


Ans. The steps to convert a decimal number into hexadecimal number are given below.
Step 1: Divide the given decimal number by 16.
Step 2: Write the reminder.
Step 3: If the reminder is among 10,11,12,13,14,15 then write A,B,C,D,E,F respectively as reminder.
Step 4: Divide the quotient by 16
Step 5: Repeat steps 2, 3 and 4 until the quotient becomes 0.
Step 6: Write all the reminders from bottom to top. It is the required hexadecimal number.

Topics 2.2.1, 2.2.2, 2.2.2.1 pg-31

Q. What are Integers?


Ans. All positive, negative numbers and zero without decimal point are called Integers. The standard representation
of set of integers is Z.
Z={………,-4,-3,-2,-1,0,+1,+2,+3,+4,………}

Q. What are Real numbers?


Ans. All numbers positive or negative, with or without decimal point falls in the category of real numbers. The set of
real numbers is represented by R.

Q. What are Whole numbers?


Ans. All positive integers and zero falls in the category of whole numbers. The set of whole numbers is represented
by W.
W={0,1,2,3,4,……….}

Q. What are the minimum and maximum values of whole numbers that can be stored in n bits?
Ans.
Numbe Bytes Minimum Minimum value in Formula Maximum value Maximum value in
r of bits value binary binary
n
4 1 nibble 0 0000 2n-1 24-1=15 1111
n
8 1 byte 0 00000000 2 -1 28-1=255 11111111
n 16
16 2 bytes 0 0000000000000000 2 -1 2 -1=65535 1111111111111111
32 4 bytes 0 0000000000000000 2n-1 232-1 1111111111111111
0000000000000000 =4294967295 1111111111111111
Topic 2.2.2.2, 2.2.2.3 pg-32

Q. How signed integers are stored in computer?


Ans. While studying computer science Integers Z are referred to as signed integers. To store both positive and
negative value the most left bit also called most significant bit (MSB) is used as sign bit (SB), rest of the bits on right
are used to store the numerical value. Sign bit will be 0 for positive value and 1 for negative value.

SB=0 for positive


SB Numerical Value
SB=1 for negative

Q. What are the minimum and maximum positive signed integer values we can store in 1, 2 and 4 bytes?
Ans. While studying computer science Integers Z are referred to as signed integers. To store both positive and
negative value the most left bit also called most significant bit (MSB) is used as sign bit (SB), rest of the bits on right
are used to store the numerical value.
If we use 1 byte to store a signed integer
For 1 Byte: SB Numerical Value
0 1 1 1 1 1 1 1

Bytes SB Minimum value in Minimum value Formula Maximum value Maximum value in
binary in 7 bits binary in 7 bits
1 byte 0 0000000 0 2n-1-1 27-1=127 1111111
2 bytes 0 000000000000000 0 2n-1-1 215-1=32767 111111111111111
4 bytes 0 0000000000000000 0 2n-1-1 231-1 =2147483647 1111111111111111
000000000000000 111111111111111

Q. How negative integers are stored in computer?


Ans. Negative integers are stored in computer by using 2’s complement method.

Q. Write the steps to find the two’s complement of a binary number.


Ans. For finding two’s complement of a binary number follow these steps.
Step1: Invert all the bits (change 1s to 0s and 0s to 1s).
Step2: Add 1 to the least significant bit (LSB)

Q. Represent -5 into an 8 bit binary number.


Ans. Step1: Convert decimal 5 into its equivalent binary number.
5= (101)2
Step2: Complete 8 bits by putting zeros on left.
(00000101)2
Step3: Invert all 0s to 1 and all 1s to 0s.
(11111010)2
Step4: Add 1 to LSB.

11111010
+ 1
11111011
The result is equivalent binary number of -5.
-5= (11111011)2

Q. What is the range of signed integers for 8, 16 and 32 bits?


Ans. Signed 8-bit numbers are typically stored using two’s complement representation. The leftmost bit (MSB) is the
sign bit:
• 0 → Positive number (including zero)
• 1 → Negative number
The range of signed n-bit integer can be calculated as:
-2n-1 to 2n-1-1
The range of a signed 8-bit integer is:
−28-1 to 28-1−1
-27 to 27-1
which is:
−128 to 127
The range of a signed 16-bit integer is:
-215 to 215-1
which is:
-32768 to 32767
The range of a signed 16-bit integer is:
-231 to 231-1
which is:
- 2147483648 to 21474836487

Q. How to represent minimum value -128 in 8 bits binary using 2's complement method?
Ans. To represent -128 in 8-bit two’s complement, follow these steps:

Step 1: Write the Absolute Value in Binary


The absolute value of 128 in binary (positive) is:
(128)10= (1000 0000)2
We cannot directly store 128 as an unsigned number.

Step 2: Take the Two’s Complement


To convert 128 into its negative form (-128) using two’s complement:
1. Start with 128 in binary:
1000 0000 (already 8 bits, but this is unsigned)
2. Invert the bits (flip 0s to 1s and 1s to 0s):
0111 1111
3. Add 1 to the inverted bits:

0111 1111
+1
1000 0000

Step 3: Confirm the Result


The result is 1000 0000, which correctly represents -128 in 8-bit two’s complement.

This is a special case because the MSB (most significant bit) is 1, indicating its negative, and there is no positive
counterpart since +128 is out of range for 8-bit signed numbers (which maxes out at +127).

Q. How to store -0.15625 using single precision 32 bits method in computer?


Ans. To store -0.15625 using the (IEEE 754) single-precision (32-bit) floating-point representation, follow these
steps:

Step 1: Understand 32-bit floating point format


A single-precision (32-bit) floating-point number consists of:
1. 1 bit for the sign (S)
2. 8 bits for the exponent (E)
3. 23 bits for the fraction (mantissa, M)
The formula for 32-bit single precision floating point representation is: Value= (−1)S × 1.M × 2(E−127)

Step 2: Determine the Sign Bit (S)


Since -0.15625 is negative, the sign bit (S) = 1.
Step 3: Convert the Absolute Value to Binary
We convert 0.15625 to binary:
1. Convert the fractional part to binary:
• 0.15625×2=0.3125 → 0
• 0.3125×2=0.625 → 0
• 0.625×2=1.25 → 1
• 0.25×2=0.5 → 0
• 0.5×2=1.0 → 1
So, 0.15625 in binary is: (0.00101)2

Step 4: Normalize the Number


The normalized form should be in the form: 1.M×2E
For 0.00101, move the binary point right 3 places to get: 1.01×2−3
Thus, M (mantissa) = 01
E (exponent) = -3 (since we moved the decimal point 3 places to the right)

Step 5: Encode the Exponent


The exponent is stored using excess 127 notation, meaning: Estored=E+127
Since E = -3, we calculate: Estored=−3+127=124
In binary, 124 is: (0111 1100)2

Step 6: Encode the Mantissa


The fractional part (mantissa) M is the bits after the leading 1 in normalized form: 1.01
Dropping the leading 1, the mantissa is: 01000000000000000000000
(Fill with 0s to make 23 bits.)

Step 7: Assemble the 32-bit floating point representation


Now, put everything together:

Sign (1 bit) Exponent (8 bits) Mantissa (23 bits)


1 01111100 01000000000000000000000

Thus, the final 32-bit floating point binary representation of -0.15625 is:
1 01111100 01000000000000000000000

Step 8: Convert to Hexadecimal


Grouping into 4-bit chunks: 1011 1110 0010 0000 0000 0000 0000 0000
Converting to Hexadecimal: BE20000016

Final Answer
The single-precision (32-bit) representation of -0.15625 is:
Binary: 1 01111100 01000000000000000000000
Hexadecimal: BE200000
This is how -0.15625 is stored in 32-bit floating-point format in a computer.

Q. How to store -0.15625 using double precision 64 bits method in computer?


Ans. To store −0.15625 in a double-precision (64-bit) floating-point format (IEEE 754 standard), we follow these
steps:

Step 1: Understanding 64-Bit Double-Precision Format

A 64-bit floating-point number consists of three parts:

Sign (1 bit) Exponent (11 bits) Mantissa (52 bits)


S E M
• Sign bit (S): 0 for positive numbers, 1 for negative numbers.
• Exponent (E): Stored using a biased representation with a bias of 1023.
• Mantissa (M): The fractional part of the normalized binary representation.

Step 2: Determine the Sign Bit (S)

Since the number is negative, the sign bit is: S=1

Step 3: Convert the Absolute Value (0.15625) to Binary

Convert 0.15625 to binary by repeatedly multiplying by 2 and taking the integer parts:

Decimal Value Multiply by 2 Integer Part Fraction Part


0.15625 0.15625×2=0.3125 0 0.3125
0.3125 0.3125×2=0.625 0 0.625
0.625 0.625×2=1.25 1 0.25
0.25 0.25×2=0.5 0 0.5
0.5 0.5×2=1.0 1 0.0

So, 0.15625 in binary is: (0.00101)2

Step 4: Normalize the Binary Representation

To express (0.00101)2 in normalized form: (1.01)2×2−3


Thus:
• Mantissa (M) = 01 (without the leading 1)
• Exponent (E) = -3 (since we moved the decimal point 3 places to the right)

Step 5: Encode the Exponent

The exponent is stored with a bias of 1023: Estored= −3+1023 =1020


Convert 1020 to binary: (1020)10= (1111111100)2

Step 6: Encode the Mantissa

The mantissa (M) stores everything after the implicit leading 1:


M=0100000000000000000000000000000000000000000000000000
(The remaining bits are padded with 0s to make 52 bits.)

Step 7: Combine Everything

Now, we assemble the final 64-bit IEEE 754 double-precision representation:


Sign (1 bit) Exponent (11 bits) Mantissa (52 bits)
1 01111111100 0100000000000000000000000000000000000000000000000000

(1 01111111100 0100000000000000000000000000000000000000000000000000)2
Step 8: Convert to Hexadecimal

Grouping into 4-bit sections:


1011 1111 1100 0100 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
Convert each group to hexadecimal: (BFC4000000000000)16

Final Answer

The 64-bit double-precision representation of −0.15625 is:


1011111111000100000000000000000000000000000000000000000000000000
In Hexadecimal: (BFC4000000000000)16

Topic 2.4, 2.4.1 pg-36

Q. How to add (101110)2 and (1101)2.


Ans.

Carry 11
101110
+ 1101
111011

Q. How to add 12 and 8 in binary.


Ans.
2 12
Step1: Convert 12 into binary
12 = (1100)2 2 6 0
2 3 0
2 1 1
0 1
reminders
Step2: Convert 8 into binary
8 = (1000)2
2 8
2 4 0
2 2 0
2 1 0
0 1
reminders

Step3: Add (1100)2 and (1000)2

1100
+ 1000
10100

Step4: Convert the result (10100)2 into decimal number.


weights of binary for 5 bits
(10100)2 = 20 16 8 4 2 1
1 0 1 0 0
Hence 12 + 8 = 20
Topic 2.4.2 pg-37

Q. How to subtract 8 from 12 in binary.


Ans.
12 Minuend
-8 Subtrahend
4 Difference

Step1: Convert minuend 12 into binary.


12 = (1100)2 2 12
Complete 8 bits
2 6 0
12 = (00001100)2
2 3 0
2 1 1
0 1
reminders

Step2: Convert subtrahend 8 into binary.


8 = (1000)2 2 8
Complete 8 bits 2 4 0
8 = (00001000)2
2 2 0
2 1 0
0 1
reminders

Step3: Find 2’s complement of subtrahend (00001000)2


To find 2’s complement first invert all 0s to 1s and all 1s to 0s.

11110111
Now add 1 to LSB.

111
11110111
+ 1
11111000

So the 2’s complement of (00001000)2 is (11111000)2 which is equal to -8


Hence -8 = (11111000)2

Step4: Add minuend (00001100)2 and 2’s complement of subtrahend (11111000)2

Carries 1111
00001100
+ 11111000
End carry 1 00000100 Discard the end carry

The final result is (0000100)2 = (100)2 which is 4 of decimal.

Q. Subtract 6 from 3.
Ans. 3
-6
-3
Step1: Convert minuend 3 into binary.
3 = (11)2
Complete 8 bits 3 = (00000011)2
Step2: Convert subtrahend 6 into binary.
6 = (110)2
Complete 8 bits 6 = (00000110)2

Step3: Find 2’s complement of subtrahend (00000110)2


To find 2’s complement first invert all 0s to 1s and all 1s to 0s.

11111001
Now add 1 to LSB

1
11111001
+ 1
11111010

Step4: Add minuend (00000011)2 and 2’s complement of subtrahend (11111010)2

Carry 1
00000011
+ 11111010
11111101
If there is no end carry then take the 2’s complement of result again.

Step5: Take the 2’s complement of (11111101)2


Invert all 0s to 1s and all 1s to 0s.

00000010
Now add 1 to LSB

00000010
+ 1
00000011
Put negative sign on the left side of the result -(00000011)2
We can write –(00000011)2 as –(11)2 that is -3 in decimal.
Final result is
-(11)2 = -3

Topic 2.4.3 pg-37

Q. Write the steps to multiply two binary umbers.


Ans.
Step1: Write the two binary numbers (Multiplicand and Multiplier) by aligning them from LSB (right most bit)
Step2: Multiply each bit of Multiplier to each bit of Multiplicand.
Step3: Shift the partial product one place to the left for each new row, starting from the second row.
Step4: Add all the partial products to get the final product.

Q. Multiply (11010)2 by (110)2.


Ans.
11010 Multiplicand
X 110 Multiplier
00000
carry 111010x Partial products
+11010xx
10011100 Final product
Topic 2.4.3 pg-38

Q. Write steps to divide two binary numbers.


Ans.
Step1: Compare the bits of divisor with same number of bits of dividend starting from left. The value of the
selected bits of dividend must be equal to or greater than the value of divisor. If not then join one
more bit from the dividend.
Step2: Now multiply divisor by 0 or 1 so that the product must be very close to the selected bits of dividend
but should not exceed the selected bits of dividend.
Step3: Write the multiplier at quotient’s place, and product under the selected bits of dividend aligning
rightmost bit in the selected bits.
Step4: Perform subtraction and find reminder.
Step5: Pull down the next bit of dividend after the selected group of bits to join the remainder on right.
Step6: Repeat Step2 to Step4 until all the bits in dividend are exhausted and the remainder becomes 0 or
less than divisor.
Step7: The final quotient will be the answer.

Q. Divide (1110)2 by (11)2.


Ans. 100 Quotient
Divisor 11 1110 Dividend
- 11
xx 10
-0 0
10 Remainder

Result: (1110)2 ÷ (11)2 = (100)2 with remainder (10)2

Step by step procedure:


Step1: As divisor is of 2 digits so take 2 digits of dividend from left. Now 11(divisor) x 1(quotient) = 11
Step2: Do subtraction 11(left 2 digits of dividend) – 11(product) = 00 or xx
Step3: Pull down 1 (third digit of dividend from left), new dividend is less than divisor.
Step4: So get the permission of 0(quotient) and pull down 0(fourth digit of dividend from left).
Step5: The 10(new dividend) is still less than divisor so 11(divisor) x 0(quotient) = 00
Step6: Subtract 00 from 10(new dividend). 10 – 00 = 10 (remainder)
Final Result: Quotient = (100)2 Remainder = (10)2

Topic 2.5.1 pg-42

Q. What is Extended ASCII code?


Ans. Extended ASCII is an 8-bit character encoding that extends the standard 7-bit ASCII code from 128 characters to
256 characters. It includes additional symbols, foreign language characters, and graphical elements.

Q. What is Unicode? And what are its different formats?


Ans. Unicode is a universal character encoding standard that provides a unique number for every character, no
matter the platform, language, or program. Unicode covers over a million of characters from various writing
systems, symbols, and even emojis through different forms of encoding formats like UTF-8, UTF-16, and UTF-32.

Q. What is UTF-8 code? Give few examples.


Ans. UTF-8 (Unicode Transformation Format - 8-bit) is a character encoding system used to represent Unicode
characters.
Key features of UTF-8 are

1. Variable-length encoding (1 to 4 bytes per character).


2. Backward-compatible with ASCII (i.e., ASCII characters are encoded as a single byte).
3. Efficient for English and other Latin-based scripts, as common characters use 1 byte.
4. Widely used on the web and in databases.
Examples of UTF-8 Encodings:

1. Character "A" (U+0041) → 1 byte


o Binary: 01000001
o UTF-8: 01000001 (1 byte, same as ASCII)
2. Character "‫( "ب‬U+0628) → 2 Bytes
o Binary: 00000110 00101000
o UTF-8: 11011000 10101000 (D8 A8 in hex)
3. Character "中" (U+4E2D) → 3 Bytes
o Binary: 01001110 00101101
o UTF-8: 11100100 10111000 10101101 (E4 B8 AD in hex)

4. Emoji " " (U+1F603) → 4 Bytes


o Binary: 0001 1111 0110 0000 0011
o UTF-8: 11110000 10011111 10011000 10000011 (F0 9F 98 83 in hex)

Q. What is UTF-16 code? Give few examples.


Ans. UTF-16 (Unicode Transformation Format - 16-bit) is a variable-length character encoding that represents
Unicode characters using 16-bit (2-byte) or 32-bit (4-byte) sequences.

Key Features of UTF-16

1. Variable-Length Encoding
o Uses 2 bytes (16 bits) or 4 bytes (32 bits) per character.
2. Not Backward Compatible with ASCII
o Unlike UTF-8, UTF-16 is not compatible with ASCII because ASCII characters require at least 2 bytes.

Examples of UTF-16 Encodings

Character Unicode UTF-16 Binary Bytes


(U+ Code) (Hex)
A U+0041 0041 00000000 01000001 2 bytes
‫(ب‬Ba) U+0628 0628 00000110 00101000 2 bytes
€ (Euro) U+20AC 20AC 00100000 10101100 2 bytes
U+1F603 D83D DE03 11011000 00111101 4 bytes
(Smiley)
11011110 00000011
ʘ(Gothic Letter Hwair) U+10348 D800 DF48 11011000 00000000 4 bytes
11011111 01001000

Q. What is UTF-32 code? Give few examples.


Ans. UTF-32 (Unicode Transformation Format - 32-bit) is a fixed-length encoding that represents each Unicode
character using exactly 4 bytes (32 bits).

Key Features of UTF-32

1. Fixed-Length Encoding
o Every character, regardless of its Unicode range, is stored as a 32-bit (4-byte) integer.
2. Not Space Efficient
o Requires 4 bytes per character, making it inefficient for text-heavy applications.
o Uses more memory than UTF-8 or UTF-16.
3. Simple and Fast Processing
o Since every character is exactly 4 bytes, UTF-32 allows fast indexing of characters.

UTF-32 Encoding Examples


Character Unicode UTF-32 Binary Bytes
(U+ Code) (Hex)
A U+0041 00000041 00000000 00000000 00000000 10000001 4 bytes
‫(ب‬Ba) U+0628 00000628 00000000 00000000 00000110 00101000 4 bytes
€ (Euro) U+20AC 000020AC 00000000 00000000 00100000 10101100 4 bytes
U+1F603 0001F603 00000000 00000001 11110110 00000011 4 bytes
(Smiley)
ʘ (Gothic Letter Hwair) U+10348 00010348 00000000 00000001 00000011 01001000 4 bytes

Q. Make comparison among UTF-8, UTF-16 and UTF-32.


Ans. UTF-8 vs. UTF-16 vs. UTF-32

Feature UTF-8 UTF-16 UTF-32


Encoding Size 1-4 bytes 2 or 4 bytes Always 4 bytes
ASCII Compatibility Yes No No
Variable Length? Yes Yes No (Fixed 4 bytes)
Best For Web, efficiency East Asian scripts Simple processing
Memory Usage Low Medium High

Topic 2.6 pg-43

Q. What are the computer memory units from smallest to largest?


Ans.

Unit Symbol Size Size(2n Bytes) Size (Bits)


(Bytes)
Bit b 0.125 B 2-3 Bytes 1 bit (Smallest unit 0 or 1)
Nibble 0.5 B 2-1 Bytes 4 bits
Byte B 1B 20 Bytes 8 bits (1 Character)
Kilobyte KB 1,024 B 210 Bytes 8,192 bits
Megabyte MB 1,024 KB 220 Bytes 8,388,608 bits
Gigabyte GB 1,024 MB 230 Bytes 8,589,934,592 bits
Terabyte TB 1,024 GB 240 Bytes 8,796,093,022,208 bits
Petabyte PB 1,024 TB 250 Bytes 9,007,199,254,740,992 bits
Exabyte EB 1,024 PB 260 Bytes 9,223,372,036,854,775,808 bits
Zettabyte ZB 1,024 EB 270 Bytes 9,444,732,965,739,290,427,392 bits
Yottabyte YB 1,024 ZB 280 Bytes 9,671,406,556,917,033,397,649,408 bits
Larger & Theoretical Units (For Future Use)
Ronnabyte RB 1,024 YB 290 Bytes 9,903,520,314,283,042,199,192,993,792 bits
Quettabyte QB 1,024 RB 2100 Bytes 10,141,204,801,825,835,211,973,625,643,008 bits
Introduced in
2022.
Yet not reached
Unofficial Larger & Theoretical Units , not standard yet (For Future Use)
Hellebyte HB 1,024 QB 2110 Bytes 10,384,593,717,069,655,257,060,992,658,440,000 bits
Brontobyte BB 1,024 HB 2120 Bytes 10,633,823,966,279,326,983,230,456,482,243,000,000
bits

Topic 2.6.1 pg-43

Q. What is pixel?
Ans. A tiny dot of an image is called pixel. It is the smallest element of an image. It has some properties like color,
position, shade etc. represented by numbers stored in computer.
Q. What is color representation of a pixel?
Ans. In color image the color of a pixel can be represented by three numbers. These three numbers represent Red,
Green and Blue (RGB) colors. The values of each these three numbers varies from 0 to 255. The variation of these
three numbers decides the color of a pixel. For example RGB value (255, 0, 0) will represent bright red color.

Q. What are different image file formats?


Ans. Commonly used image formats for photos are,
1. JPEG (Joint Photographic Expert Group): In this image is compressed but lose some quality.
2. PNG (Portable Network Graphics): Maintain high quality without losing data, but having large size.
3. GIF (Graphics Interchange Format): This is used for simple images and animations with limited colors. File
size is small. Maintains image quality without losing details.

Topic 2.6.2, 2.6.3 2.6.4 pg-44

Q. How audio files are stored?


Ans. Using the process of sampling and quantization audio files are stored by capturing and converting sound waves
into digital data.

Q. What is sampling and sampling rate?


Ans. Sampling: Recording the sound waves at regular intervals is called sampling.
Sample rate: Number of samples recorded per second is called sampling rate.

Q. How sample rate effect the quality of sound?


Ans. Higher the sample rate better the quality of sound.

Q. What is quantization?
Ans. Digitizing the sample is called quantization. More bits per sample give good quality and high accuracy sound.

Q. Write few file formats in which audio files are saved.


Ans. MP3: (MPEG-1 Audio Layer 3) in this format audio is compressed to save memory but audio quality is
compromised.
WAV: (Waveform Audio File Format) It is uncompressed format that maintains high quality audio.
AAC: (Advanced Audio Codec) provides better sound quality than MP3 in same file size. More efficient
compression technique used. Default format for Apple’s devices.

Q. What is a Frame in a video?


Ans. A video is sequence of many pictures arranged in continuous order, any one picture of a video is called frame.

Q. What is frame rate? List different frame rates and their use.
Ans. Frame rate refers to the number of frames (images) displayed per second in a video. It is measured in frames
per second (fps). Different frame rates and their usage are given below.
• Movies & Cinematic Look → 24 fps
• TV Broadcast (U.S.) → 30 fps
• TV Broadcast (Europe & International) → 25 fps
• YouTube & Online Videos → 30 or 60 fps
• Sports & Fast-Action Videos → 50 or 60 fps
• Gaming (High-End Monitors) → 120 fps or higher
• Slow Motion Effects → 120 fps, 240 fps, or more

Q. Write few file formats for video file.

Ans.
• MP4 (MPEG-4 Part 14) is one of the most commonly used digital multimedia formats, designed to store
video, audio, subtitles, images, and metadata in a highly compressed and versatile container while
maintaining quality.
• AVI (Audio Video Interleave) is a video file format developed by Microsoft in 1992. It is known for storing
high-quality video and audio in a relatively simple container format. It is lossless and uncompressed format
resulting in large file.
• MKV (Matroska Video) is a flexible and open-source multimedia container format designed to store high-
quality video, audio, subtitles, and metadata in a single file. It is uncompressed and high quality video
format.

Q. How files are stored in computer?


Ans. All types of files (Image, Audio, and Video) are stored in computer in binary in the form of 0s and 1s in different
storage devices.
• Hard Disk Drive (HDD): It uses spinning disk and head to read and write data. It has very large capacity.
• Solid State Drive (SSD): A is a type of solid-state storage device that uses integrated circuits to store
data persistently for faster access time and better performance. It is a nonvolatile memory.
• Cloud Storage: It is a computer data storage in which data, said to be on "the cloud", is stored remotely in
logical pools and is accessible to users over a network, typically the Internet.
Chapter-3
Digital System and Logic Design
Q.1: What is Digital System?
Ans: A digital system is a system that processes, stores, and transmits information using discrete (digital) values,
typically represented as binary numbers (0s and 1s). Digital systems rely on logic circuits and digital data processing.
Key Components of a Digital System are:
1. Input Devices
2. Processing Unit
3. Storage
4. Output Devices
5. Communication Channels
Examples of Digital Systems:
• Computers
• Smartphones
• Digital clocks
• Microcontrollers

Q.2: What is Analog signal? Give examples.


Ans: Analog signal is a continuous signal that varies smoothly over time and can take an infinite number of values
within a given range. It represents physical measurements, such as sound, temperature, or voltage, in a way that
closely mirrors the original real-world phenomena. Examples of Analog Signals are Sound Waves, Radio Waves,
Temperature Readings, and Electrical Voltage Variations.

Q.3: What are the characteristics of Analog signals?


Ans: Characteristics of Analog Signals are:
1. Continuous Nature – Unlike digital signals, analog signals do not have discrete steps, they change smoothly
over time.
2. Infinite Values – Can take any value within a given range, making them more precise but also more
susceptible to noise and distortion.
3. Waveform Representation – Typically represented as a sine wave or other smooth curves.

Q.4: What is Digital signal? Give examples.


Ans: A digital signal is a type of signal that represents data using discrete values, typically in the form of binary
numbers (0s and 1s). Digital signals have distinct levels, making them more resistant to noise and easier to process
using computers and digital electronics. Examples of digital signals are; Computer Data, Digital Audio, Digital Video,
Electronic Communication, Digital Clocks.

Q.5: What are the characteristics of Digital signals?


Ans: Characteristics of Digital Signals are:
1. Discrete Values – A digital signal only has specific levels, usually represented as high (1) and low (0).
2. Noise Resistance – Digital signals are less affected by noise and interference compared to analog signals.
3. Easy Storage & Processing – Can be stored and processed using computers, microprocessors, and digital
circuits.
4. Square Wave Representation – Typically visualized as a square wave, alternating between high and low
states.

Q.6: What is the difference between Analog signal and Digital signal?
Ans: Comparison: Analog vs. Digital Signals
Feature Analog Signal Digital Signal
Nature Continuous Discrete (binary: 0s and 1s)
Precision More precise but prone to noise Less precise but resistant to noise
Storage Difficult (magnetic tapes, vinyl records) Easy (hard drives, SSDs, CDs)
Processing Requires analog circuits Uses digital processors and microcontrollers
Q.7: What is Analog to Digital Conversion (ADC)?
Ans: Analog to Digital Conversion (ADC) is the process of converting a continuous analog signal (such as sound,
temperature, or voltage) into a digital signal that can be processed by computers and digital devices.

Q.8: What is Digital to Analog Conversion (DAC)?


Ans: Digital to Analog Conversion (DAC) is the process of converting a digital signal (discrete values, 0s and 1s) back
into an analog signal (continuous waveform). This process is essential for real-world applications where analog
output is required, such as audio playback and display systems.

Q.9: How ADC and DAC is performed in audio system using microphone and speaker?
Ans: In an audio system, Analog-to-Digital Conversion (ADC) and Digital-to-Analog Conversion (DAC) work together
to process sound. A microphone captures sound and converts it into a digital format, while a speaker takes the
digital data and converts it back into sound.

Step-by-Step Process
1. Audio Input – ADC Process (Microphone to Digital Signal)
➢ Microphone (Analog Signal Generation)
• A microphone picks up sound waves (continuous air pressure variations).
• The sound waves are converted into an electrical analog signal (voltage variations).
➢ Analog-to-Digital Converter (ADC)
• The analog electrical signal is converted into a digital signal through the ADC process:
• The digital audio data is now stored or processed and saved as an MP3 or other audio file.
2. Audio Output – DAC Process (Digital Signal to Speaker)
➢ Digital-to-Analog Converter (DAC)
• The stored/transmitted digital audio is converted back into an analog electrical signal:
1. Decoding – Binary data is converted into voltage levels.
2. Reconstruction – A smoothing filter removes sharp edges to form a continuous waveform.
➢ Speaker (Analog Signal to Sound Waves)
• The analog signal is amplified and sent to a speaker.
• The speaker’s diaphragm moves according to the waveform, producing sound waves that match the
original input.

Q.10: Why are ADC and DAC Needed?


Ans:
• ADC is needed to digitize real-world signals for processing and storage.
• DAC is needed to convert digital data back into a usable analog form for output.
Without ADC and DAC, modern devices like smartphones, music players, TVs, and medical devices would not
function properly.

Q.11: What are the fundamentals of Digital Logic?


Ans: Digital logic is the foundation of all digital systems, including computers, microcontrollers, and communication
devices. It is based on Boolean algebra and works with binary numbers (0 and 1) to perform logical operations.

Q.12: What are the basic concepts of Digital Logic?


Ans: 1. Basic Concepts of Digital Logic
➢ Binary System – Uses only two states:
• 0 (Low, OFF, False)
• 1 (High, ON, True)
➢ Logic Gates – The building blocks of digital circuits that perform basic logical functions:
• AND Gate – Output is 1 only if both inputs are 1.
• OR Gate – Output is 1 if at least one input is 1.
• NOT Gate – Inverts the input (0 → 1, 1 → 0).
• NAND, NOR, XOR, XNOR Gates – Variations used for complex operations.
➢ Boolean Algebra – A mathematical approach to designing and simplifying digital circuits using logical
expressions.
➢ Truth Tables – Represent how logic gates process inputs to produce outputs.
➢ Combinational Logic – Circuits where the output depends only on current inputs (e.g., adders,
multiplexers).
➢ Sequential Logic – Circuits where the output depends on both current and past inputs, using
memory elements (e.g., flip-flops, registers, counters).

2. Applications of Digital Logic


➢ Computers & Processors – CPU operations, arithmetic, and decision-making.
➢ Memory & Storage Devices – RAM, ROM, hard drives.
➢ Communication Systems – Encoding and decoding of data (Wi-Fi, Bluetooth).
➢ Embedded Systems – Microcontrollers in appliances, cars, and IoT (Internet of Things) devices.
➢ Digital Electronics – Digital clocks, calculators, and sensors.

Q.13: What is Boolean algebra?


Ans: Boolean algebra is a branch of algebra that deals with binary variables and logical operations. It is used
primarily in computer science, digital logic design, and mathematical logic. Instead of using numerical values,
Boolean algebra operates with only two values:
• True (1)
• False (0)

Q.14: What is Boolean variable?


Ans: A Boolean variable is a variable that can take only two possible values:
• True (1)
• False (0)
These variables are fundamental in Boolean algebra, digital logic circuits, and computer programming, where they
are used to represent logical conditions and binary states (ON/OFF, YES/NO, etc.).

Q.15: What is Boolean expression?


Ans: A Boolean expression is a mathematical expression that consists of Boolean variables, logical operators, and
constants (0 and 1). It evaluates to either True (1) or False (0). Boolean expressions are widely used in digital
circuits, computer programming, and logic design.
Examples of Boolean Expressions

1. Simple Boolean Expressions:


• A ⋅ B (AND operation)
• A + B (OR operation)
• ¬ A (NOT operation)

2. Complex Boolean Expressions:


• A ⋅ (B + C)
• (A + B) ⋅ C′
• A ⋅ B + ¬C

Q.16: What are different logic operations (logic gates)? Write their truth tables.
Ans: Logic operations are fundamental in Boolean algebra and digital logic design. The main logic operations include
AND, OR, NOT, NAND, NOR, XOR, and XNOR. Each operation has a truth table, which shows how the inputs relate
to the output.
1. AND Operation (∙)
The AND operation returns true (1) only if both inputs are true.
Boolean Expression: A ⋅ B
Truth Table:
A B A∙B
0 0 0
0 1 0
1 0 0
1 1 1
2. OR Operation (+)
The OR operation returns true (1) if at least one of the inputs is true.
Boolean Expression: A + B
Truth Table:
A B A+B
0 0 0
0 1 1
1 0 1
1 1 1

3. NOT Operation (¬)


The NOT operation inverts the input (0 becomes 1, and 1 becomes 0).
Boolean Expression: ¬ A
Truth Table:
A ¬A
0 1
1 0

4. NAND Operation (NOT AND)


The NAND operation is the inverse of AND. It returns false (0) only if both inputs are true.
Boolean Expression: (A ⋅ B)′ or ¬(A . B) or A . B
Truth Table:
A B (A ∙ B)'
0 0 1
0 1 1 A.B
1 0 1
1 1 0

5. NOR Operation (NOT OR)


The NOR operation is the inverse of OR. It returns true (1) only if both inputs are false.
Boolean Expression: (A+B)′ or ¬(A+B) or A+B
Truth Table:
A B (A + B)'
0 0 1
0 1 0 A+B
1 0 0
1 1 0

6. XOR Operation (⊕)


The XOR (Exclusive OR) operation returns true (1) if the inputs are different.
Boolean Expression: A⊕B or A⋅B′+A′⋅B
Truth Table:
A B A⊕B
0 0 0
0 1 1
1 0 1
1 1 0

7. XNOR Operation (⊙)


The XNOR (Exclusive NOR) operation is the inverse of XOR. It returns true (1) if the inputs are the same.
Boolean Expression: (A⊕B)′ or (A⊕B) or (A⊙B) or A⋅B+A′⋅B′
Truth Table:
A B A⊙B
0 0 1
0 1 0
1 0 0
A⊙B
1 1 1

Q.17: What is Boolean Function?


Ans: A Boolean function is a mathematical function that takes one or more Boolean variables (values of 0 or 1) as
input and produces a Boolean output (0 or 1). Boolean functions are widely used in digital circuits, logic design, and
computer science.

Example of a Boolean Function


A Boolean function can be expressed using Boolean algebra, such as:
F(A,B,C) = (A⋅B) + C
Explanation:
• The function F has three Boolean variables: A, B, and C.
• The AND operation (A ∙ B) is performed first.
• The OR operation ( + C ) combines the result with C.
• The output F will be 1 (true) or 0 (false) based on the inputs.

Q.18: Construct a simple Boolean function F(A,B)=A.B


Ans:
Constructing a Simple Boolean Function:
We are given the Boolean function F(A,B)=A⋅B
This function represents the AND operation, meaning the output is 1 only when both inputs (A and B) are 1.

Step 1: Create the Truth Table


A B F(A, B) = A ∙ B
0 0 0
0 1 0
1 0 0
1 1 1

Step 2: Write the Boolean Expression


The function is already given as: F(A,B)=A⋅B
Since there are no unnecessary terms, no simplification is needed.

Step 3: Draw the Logic Circuit


To implement this function in hardware:
• Use an AND gate with inputs A and B.
• The output of the AND gate is F(A, B).
Logic Circuit Representation:
A
F=A.B
B
The AND gate takes two inputs (A and B) and produces the required output.

Q.19: Construct a complex Boolean function F(A,B,C)=A.B + A.C


Ans:
Constructing the Boolean Function
We are given the Boolean function: F(A,B,C)=A⋅B+A′⋅C
This function consists of:
• AND operations: A⋅B
• OR operation: Combining the two AND terms with +
• NOT operation: The complement of A (denoted as A′).

Step 1: Create the Truth Table


A B C A∙B A' A'∙C F=A.B+A’.C
0 0 0 0 1 0 0
0 0 1 0 1 1 1
0 1 0 0 1 0 0
0 1 1 0 1 1 1
1 0 0 0 0 0 0
1 0 1 0 0 0 0
1 1 0 1 0 0 1
1 1 1 1 0 0 1

Step 2: Write the Boolean Expression


The function is already in Sum of Products (SOP) form: F(A,B,C)=A⋅B+A′⋅C
Since it is in its simplest form, no further simplification is needed.

Step 3: Draw the Logic Circuit


To implement this function using logic gates:
1. Use a NOT gate to generate A′
2. Use two AND gates:
• One for A⋅B
• One for A′⋅C
3. Use an OR gate to combine the results.
Logic Circuit Representation

A
A.B
B

C A’.B

Q.20: Write the usage of Boolean functions in computer.


Ans: Boolean functions play a crucial role in computer science, digital logic, and software programming. They help
in decision-making, processing binary data, and designing computer hardware. Here are some key applications:

1. Computer Hardware & Digital Logic Design


2. Central Processing Unit (CPU) Operations
• Arithmetic Logic Units (ALUs) perform operations like addition, subtraction, AND, OR, XOR using Boolean
functions.
• Control Units use Boolean logic to process instructions and make decisions.
• Boolean logic is used in branching and flag conditions.
3. Software Programming & Conditional Statements
4. Data Storage & Memory Management
5. Operating Systems & Process Management
6. Computer Networks & Internet
7. Cryptography & Security
8. Artificial Intelligence & Machine Learning
9. Database Management & SQL Queries
10. Graphics & Game Development

Conclusion
Boolean functions are fundamental in computer science, from hardware design to software programming, AI,
security, and networking. Their ability to process binary decisions (0 and 1) makes them essential in all computing
applications.

You might also like