Back to the 2026 paper

Module 3: Semantic Analysis, Symbol Table, Run-time environment

20262m

Consider a symbol table implemented using hashing with table size 1010. For key 2727, using h(k)=k mod 10h(k) = k \bmod 10, the initial position is:
(i) 55
(ii) 77
(iii) 66
(iv) 88

Worked SolutionAI Assisted

Answer: (ii) 7

Calculation

h(27)=27 mod 10=7h(27) = 27 \bmod 10 = 7

because 27=2×10+727 = 2 \times 10 + 7. The key 2727 is initially placed at index 77 of the hash table.

Note: if slot 77 is already occupied (a collision, e.g. key 1717), it is resolved by chaining (linked list at slot 7) or open addressing (linear probing to slot 8, 9, ...).

(ii) 7\boxed{\text{(ii) } 7}

Similar questions

Official AppAndroid App

PYQDeck for Android

Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.