Data Structures & AlgorithmsHardCognizant · Capgemini pattern
Only the lower triangle (including the diagonal) of a 10 × 10 matrix is stored, row by row, in a 1-D array starting at address 2000, with 2 bytes per element and indices from 0. What is the address of element [6][4]?
- A. 2048
- B. 2056
- C. 2050
- D. 2128
Correct answer: C. 2050
Rows 0–5 hold 1 + 2 + … + 6 = 21 elements, then 4 more in row 6: offset 25 elements × 2 bytes = 50, so 2050. Using full rows (6 × 10 + 4 = 64 → 2128) ignores the triangular storage.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- What is printed? (Python) python a = [3, 8, 1, 9, 4] a.insert(2, 7) a.pop() a.remove(9) print(a, len(a))
- A circular queue of size N = 5 keeps one slot empty. What is printed (dequeued values, 'F' for each rejected enqueue, final count)? c…
- Keys 50, 700, 76, 85, 92, 73, 101 are inserted into a hash table of size 7 with h(k) = k mod 7 and linear probing. What is the final table…
- Keys 22, 33, 44, 55 go into a table of size 11 with quadratic probing h(k) + i² (mod 11). In which slots do they land, in order? python m…
- What is printed? (stack-based reversal of words) python s = "data structures are fun" st = [] for w in s.split(): st.append(w) out = []…
- Convert the infix expression to postfix (^ is right-associative, higher than and /, which are higher than + and −). What is printed?…