Ez Computerहिन्दीOpen app

Advanced Add-on 10 — Beyond the Syllabus: Logic, OS, Databases and New Technology

Preview Part L: Advanced Add-on · Chapter 58 · 24 min read · 41 practice questions

After this chapter you will be able to

  • solve signed-number, overflow, IEEE 754, Hamming-code and UTF-8 byte-count problems
  • simplify Boolean functions and size multiplexers, adders, flip-flop circuits and counters
  • work out CPU-scheduling, Banker’s, page-replacement and disk-scheduling problems step by step
  • read Linux permissions, count candidate keys, normalise a relation and predict SQL output
  • use the exact terms of algorithms, OOP, virtualisation, IoT, 5G, blockchain, quantum computing and AI

📌 MUST KNOW - This is extra, harder material that adds to the main book. Read Chapters 11 to 17, 20, 32 and 34 first. The main chapters answer most exam questions; this part is for the hardest ones, so do not start here.

58.1 Signed Numbers, Overflow and Floating Point

Chapter 11 gives 1’s and 2’s complement and the 2’s complement range. Exams also ask the other forms.

Representation (n bits) Range Zeros 8-bit range
Sign-magnitude −(2ⁿ⁻¹ − 1) to +(2ⁿ⁻¹ − 1) Two (+0, −0) −127 to +127
1’s complement −(2ⁿ⁻¹ − 1) to +(2ⁿ⁻¹ − 1) Two −127 to +127
2’s complement −2ⁿ⁻¹ to +(2ⁿ⁻¹ − 1) One −128 to +127

Overflow rule: in 2’s complement addition, overflow happens only when two numbers of the same sign give a result of the opposite sign; in hardware, the carry into the sign bit differs from the carry out of it.

IEEE 754 worked example: −6.75 in single precision.

  1. Sign negative: S = 1.
  2. 6.75 = 110.11₂ = 1.1011 × 2².
  3. Exponent = 2 + 127 = 129 = 10000001.
  4. Mantissa = 1011 followed by 19 zeros (the leading 1 is the unstored hidden bit).
  5. 1 | 10000001 | 1011000… = C0D80000 in hex.

★ EXAM POINT - Sign-magnitude and 1’s complement share the same range and both have two zeros. IEEE 754: single 1-8-23, bias 127; double 1-11-52, bias 1023.

58.2 Hamming Code, Excess-3 Addition and Unicode Bytes

Hamming code: for m data bits, parity bits r = smallest value with 2ʳ ≥ m + r + 1. So 4 data bits need 3 (the (7, 4) code), 8 need 4, 16 need 5, 32 need 6. Parity bits sit at positions 1, 2, 4, 8 …

Worked example (even parity), data 1011:

Excess-3 addition: add the codes; for a digit that gives no carry, subtract 0011; for one that gives a carry, add 0011. 2 + 3: 0101 + 0110 = 1011, no carry, minus 0011 = 1000 = XS-3 of 5.

Code points UTF-8 UTF-16 Typical characters
U+0000 – U+007F 1 byte 2 bytes English letters, digits
U+0080 – U+07FF 2 bytes 2 bytes Accented Latin, Greek, Arabic
U+0800 – U+FFFF 3 bytes 2 bytes Devanagari (U+0900–U+097F)
U+10000 – U+10FFFF 4 bytes 4 bytes (surrogate pair) Most emoji

UTF-32 always uses 4 bytes. So “Aक” takes 1 + 3 = 4 bytes in UTF-8, 4 in UTF-16 and 8 in UTF-32.

What the full chapter covers

The full chapter has these sections:

  1. 58.1 Signed Numbers, Overflow and Floating Point
  2. 58.2 Hamming Code, Excess-3 Addition and Unicode Bytes
  3. 58.3 Boolean Simplification and Canonical Forms
  4. 58.4 Combinational Building Blocks
  5. 58.5 Flip-Flops, Registers and Counters
  6. 58.6 CPU Scheduling: One Worked Problem
  7. 58.7 Synchronisation and Deadlock
  8. 58.8 Paging, Disk Scheduling and File Allocation
  9. 58.9 Linux Permissions, Directories and Shells
  10. 58.10 Keys, Dependencies and Normalisation
  11. 58.11 SQL in Practice and Transactions
  12. 58.12 Algorithms, Data Structures, OOP and Software Engineering
  13. 58.13 New Technology: Exact Terms
  14. 58.14 Statement Traps
  15. Chapter Quick Revision
  16. Most Important Terms
  17. Common Confusions
  18. Rapid Recall

Sample questions from this chapter

1. Simplified form of F(A, B, C) = Σm(0, 2, 4, 5, 6)?

  1. A′ + BC′
  2. C′ + AB
  3. C′ + AB′
  4. B′ + AC′
Show answer

Answer: C. C′ + AB′

Cells 0, 2, 4, 6 form the quad C′ and cells 4, 5 form the pair AB′, so F = C′ + AB′.

2. Permission of a new Linux file when umask is 022?

  1. 755
  2. 666
  3. 644
  4. 622
Show answer

Answer: C. 644

Files start from 666; removing umask 022 gives 644.

3. Total head movement with SSTF for head 53 and queue 98, 183, 37, 122, 14, 124, 65, 67?

  1. 208
  2. 640
  3. 236
  4. 299
Show answer

Answer: C. 236

SSTF serves 65, 67, 37, 14, 98, 122, 124, 183 for 12 + 2 + 30 + 23 + 84 + 24 + 2 + 59 = 236.

4. Range of an 8-bit sign-magnitude number?

  1. −127 to +127
  2. −128 to +127
  3. 0 to 255
  4. −255 to +255
Show answer

Answer: A. −127 to +127

Sign-magnitude uses one bit for sign and 7 for magnitude, so the range is ±(2⁷ − 1) = ±127.

5. Scheduling method that picks the largest (waiting + burst) ÷ burst?

  1. Multilevel queue
  2. HRRN
  3. SRTF
  4. FCFS
Show answer

Answer: B. HRRN

Highest Response Ratio Next chooses the job with the largest (waiting + burst) ÷ burst, so old jobs rise in priority.