ESP-VI Part B
ESP-VI Part B
Uploaded image
Uploaded image
Uploaded image
Uploaded image
answer in details
Here are the detailed answers to the questions from the uploaded images:
Given:
T(n) = Σ (k = 1 to n) T(k-1) * T(n-k)
This is the Catalan number recurrence:
T(n) = C(n) = (2n)! / ((n+1)! * n!)
We compare and find that x = n - k + 1
Hence, x = n - k + 1 for the recurrence to match standard Catalan.
2. Postfix of A + B * (C + D)/E + F * G:
1. Infix: `A + B * (C + D)/E + F * G`
2. Postfix:
`A B C D + * E / + F G * +`
Postorder: 10, 9, 23, 22, 27, 25, 15, 50, 95, 60, 40
Use postorder and build tree → Inorder traversal:
9, 10, 22, 23, 25, 27, 15, 40, 50, 60, 95
Expression: 8 2 3 / / 3 * + 5 1 * -
Steps:
2 3 / = 0 (integer division)
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 1/13
81/=8
3 * = 24
→ 24 + 5 * 1 = 24 + 5 = 29
Last - → 29 - 1 = 28
Final Answer: 28
5. C Program Output:
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 2/13
c
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 3/13
→ Chips needed = 16384 / 1024 = 16
Given:
Word = 16 bits
2K words = 2^11 → block offset = 11 bits
For direct-mapped, remaining bits for index and tag.
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 4/13
→ Refresh per chip: 2^10 × 100ms = 100 × 1024 = 102400ms
→ Total for all = 102400 ms (assuming simultaneous refresh)
Let me know if you'd like the answers compiled in a doc or if you want me to explain any part in more
detail.
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 5/13
answer in details
Thanks for sharing all the images! Here's a detailed breakdown and answer for each question from 21 to
30:
Q21: DFA for strings where number of a's is one less than number of b's
Answer:
Track the difference `(#b - #a)`. You only need to track difference = 1.
Design states representing the current difference (e.g., -1, 0, 1, 2). Accepting state is where difference =
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 6/13
1.
Build a finite state machine with transitions:
Answer:
Create states to track parity of 0s and 1s:
States: (Even0, Even1), (Even0, Odd1), (Odd0, Even1), (Odd0, Odd1)
Grammar:
less
`S → aSb | X
X → aX | Xb | a | b
`
Language: All strings with equal number of a's and b's (S → aSb) plus strings made from mix of a's
and b's.
Not regular: Because it generates strings like aⁿbⁿ, which is not regular.
Q24: DFA for strings that do not contain three consecutive 1’s
Answer:
States:
q0 = no 1s yet
q1 = 1
q2 = 11
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 7/13
q1: 1 → q2, 0 → q0
q2: 1 → q3, 0 → q0
q3: all → q3
Accepting states: q0, q1, q2
Q25: Decidability
Q26: RE & CFG for strings with different start & end symbols
less
`S → 0A1 | 1A0
A → 0A | 1A | ε
`
States:
q0: start
q1: seen one 1
Transitions:
q0 —1→ q1
q1 —1→ q2
Q29: NFA for all strings over {a, b} that start and end with same symbol
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 8/13
NFA:
If you'd like DFA/NFA diagrams or implementation in code, I can help generate those too. Let me know!
answer in details
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 9/13
Here are detailed answers for questions 31 to 36 from the image:
Given:
Given:
Given:
Capacity = N words
Block size = B words
Now:
For 16-way set associative:
Number of sets = (N / B) / 16
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 10/13
Given:
Address Space Separate I/O space Shares address space with memory
Given:
Set-associativity = 8-way
Block size = 1 KB = 2¹⁰ bytes
Calculations:
TAG = 32 - 3 - 10 = 19 bits
`int recursive(int n) {
if (n == 1)
return 1;
else
return recursive(n - 1) + recursive(n - 1);
}
`
T(n) = 2 * T(n-1)
T(1) = 1
T(n) = 2 * T(n-1)
= 2 * 2 * T(n-2)
= 2^k * T(n-k)
= 2^(n-1) * T(1)
= 2^(n-1)
Graph:
Goal: Construct MST — select (n-1) edges with minimum total weight.
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 12/13
MST: Use edges (v₁-v₂), (v₂-v₃), ..., (vₙ₋₁-vₙ)
✅ Total weight = 2 × (n - 1)
Q39: Closure Under Reversal for Regular Languages
Then Mʹ accepts the first (2n × 2/3 = 4n/3) → only possible if length divisible by 3
3. Accept string x (length 2k) iff there exists y (length k) such that xy ∈ L.
4. Use a product automaton or non-determinism to guess the future k symbols and verify using M.
✅ Conclusion: Such an automaton exists. Regular languages are closed under such
length-preserving transformations.
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 13/13
Finite Automata and Recurrences
Uploaded image
answer in details
Here are the detailed answers to the questions numbered 41 to 50 from your image:
41. Prove that the class of sets accepted by finite automata is closed under
intersection.
Let M₁ and M₂ be two finite automata accepting languages L₁ and L₂, respectively.
We construct a new finite automaton M such that L(M) = L(M₁) ∩ L(M₂).
Let:
Q = Q₁ × Q₂
q₀ = (q₁, q₂)
F = F₁ × F₂
Thus, M accepts a string only if both M₁ and M₂ accept it. Hence, the class of regular languages is closed
under intersection.
T(n) = 4T(n/2) + n
Use the Master Theorem:
a = 4, b = 2, f(n) = n
Since f(n) = O(n) and n² > n, this falls under Case 1 of the Master Theorem.
Result:
T(n) = Θ(n²)
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 1/18
Input: Substring pattern `P` and text `T`
Output: Automaton that accepts when `P` is found in `T`
Steps:
1. Build states: One state for each prefix of `P`, including empty prefix.
sql
`SELECT title
FROM book AS B
WHERE (
SELECT COUNT(*)
FROM book AS T
WHERE T.price > B.price
) < 5
`
Explanation:
The query finds books that are among the top 5 most expensive books.
The subquery counts how many books are more expensive than the current book `B`.
If that count is less than 5, it means `B` is in the top 5.
a = 2, b = 2, f(k) = 1
log_b(a) = log₂(2) = 1
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 2/18
46. What are ordered indices in RDBMS? Give an example.
Ordered indices maintain the index entries in a sorted order of key values.
Example:
If a table `Employee` has an index on `Salary`, and you want to find employees with salary > 50,000,
ordered indices allow range searches efficiently.
Types:
Clustering Index
Secondary Index
Data Storage Keys and data stored in internal & leaf nodes Data stored only in leaf nodes
Search Efficiency Less efficient for range queries More efficient for range queries
Leaf Node Linking Not necessarily linked Leaf nodes are linked (sequential access)
Use Case General-purpose indexing Preferred in DBMS indexing
48. Why sparse indexing requires less storage than dense indexing?
Sparse Indexing:
Index entries are only for some records, typically one per block.
Dense Indexing:
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 3/18
Canonical Cover (Minimal Cover):
Applications:
Let me know if you'd like these answers in a Word or PDF format for submission!
Uploaded image
60)Write the steps to find the Canonical Cover of a given set of Functional Dependencies in RDBMS.
answer in details
Here are the detailed answers for questions 51 to 60 from the image you uploaded:
51. Is it mandatory to create clustered index with primary key of an RDBMS? Justify
your answer.
By default, primary keys are implemented with clustered indices for faster access.
However, you can override this and create a clustered index on a different column.
Justification: In some cases, queries might access data more efficiently using a different field (like
date or location), so clustering that column may be more beneficial.
52. What will be the maximum possible number of superkeys for the relation
schema R(E, F, G, H) with E as the key? Justify your answer.
Given key: E
Remaining attributes: F, G, H ⇒ 3 attributes
For a superkey, we must include the key E and any subset of the other attributes (including empty set):
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 4/18
Answer: 8 superkeys
Superkeys:
{E}
{E, F, G, H}
53. Why the higher normal form is not always desirable in RDBMS? Justify your
answer.
Higher normal forms (like 4NF, 5NF) reduce redundancy but may:
Justification:
If performance is critical and redundancy is not significant, sticking to 3NF or BCNF is preferred over
higher normal forms.
54. Give an example where the database is in 1NF but not in 2NF.
Example:
Functional Dependencies:
Student_ID → Name
55. When is it preferable to use a dense index rather than a sparse index?
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 5/18
Example: Primary index on a field that is not sorted or doesn’t allow large gaps between key values.
Step-by-step:
57. What will be the maximum possible number of superkeys for R(E, F, G, H) with E
as key?
Remaining: F, G, H ⇒ 2³ = 8 subsets
Combine each with E to get 8 superkeys
58. Why the higher normal form is not always desirable in RDBMS? Justify your
answer.
Conclusion: Sometimes 3NF or BCNF is a better trade-off between normalization and performance.
mathematica
`{E, F} → {G}
{F} → {I, J}
{E, H} → {K, L}
K → {M}
L → {N}
`
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 6/18
Step 1: Find closure of combinations
1. E, F → G
2. F → I, J
3. E, H → K, L
4. K → M
5. L → N
A → BC becomes A → B, A → C
Let me know if you'd like a PDF or DOCX export for submission, or help solving similar problems!
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 7/18
Here are the detailed answers for questions 61 to 70 from your uploaded images:
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 8/18
Given FDs:
AB → CD
DE → P
C→E
P→C
B→G
From AB → CD
C → E → (P from DE) → C again → closure covers all: A, B, C, D, E, P, G
Also B → G
AB → CD ✔️
C → E and P → C ⇒ transitive over AB → CD → E/P → C
C and P are non-prime (not in any candidate key) and appear on LHS ⇒ violates 3NF
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 9/18
Addressing Mode Description Example (in Assembly)
Working:
Cache stores frequently accessed memory locations to speed up CPU access.
Mapping Techniques:
2. Fully Associative: Any block can go to any cache line. Uses tags.
3. Set-Associative Mapping: Cache is divided into sets, block maps to a set and placed anywhere in it
(e.g., 2-way, 4-way).
Phases:
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 10/18
From fastest to slowest:
1. Registers
2. Cache
3. Main Memory (RAM)
As we move down:
Speed ↓
Size ↑
Allows peripherals (e.g., disk, network) to transfer data directly to/from memory without CPU
involvement
Improves speed by freeing CPU
Modes:
Burst Mode
Cycle Stealing
Transparent Mode
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 11/18
70. Types of Buses in a Computer System
Let me know if you'd like these notes formatted into a printable file (PDF/Word), or if you want diagrams
to go along with any answer.
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 12/18
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 13/18
Thanks for sharing all the questions, Pritom! Since you asked earlier for detailed answers to question
60, here’s a complete explanation:
60) Write the steps to find the Canonical Cover of a given set of Functional
Dependencies in RDBMS.
✅ Definition:
A Canonical Cover (or Minimal Cover) is a simplified set of functional dependencies that is logically
equivalent to the original set but has:
No extraneous dependencies.
Single attribute on the right-hand side (RHS) of each FD.
If an FD is like:
A → BC
Split it into:
A → B and A → C
Suppose FD is XY → Z
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 14/18
Check if X → Z can be derived from the remaining FDs (including X → Z itself).
If X → Z is sufficient, then Y is extraneous.
How to check?
Use attribute closure (X⁺) to verify whether Z is still derivable without Y.
✅ Final Output:
After performing all the steps, the remaining set of FDs is your Canonical Cover.
🔍 Example:
Given:
F = { A → BC, B → C, A → B, AB → C }
A→B
A→C
B→C
AB → C
Now F = { A → B, A → C, B → C, AB → C }
Check AB → C:
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 15/18
Let me know if you want detailed answers for any specific question numbers from the list!
71) A system has 4 GB of RAM and uses 32-bit addressing. Find the number of
addressable locations and addressable memory size.
✅ Answer:
Addressable locations = 232 = 4,294,967,296
72) A computer system has a cache hit ratio of 80%, a cache access time of 5 ns, and
a main memory access time of 50 ns. Calculate average memory access time.
📌 Formula:
Average Time = (h × tc ) + ((1 − h) × tm )
Where:
h = 0.80
tc = 5 ns
tm = 50 ns
73) A disk rotates at 7200 RPM. The average seek time is 9 ms. Find average access
time.
📌 Formula:
1
Average rotational latency = × Rotation time
2
60
Rotation time = = 0.00833 sec = 8.33 ms
7200
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 16/18
8.33
Average rotational latency = = 4.165 ms
2
✅ Answer:
Opcode field = 6 bits
Register fields = 10 bits (5 bits each for 2 registers)
75) Find out the number of RAM chips of size 256K × 1 bit required to build 2M Byte
memory.
2048
No. of chips = × 8 = 64 × 8 = 512 chips
32
76) Differentiate between Control Register, Data Register, and Address Register
with example
77) Explain the functions of Address Bus, Control Bus, and Data Bus
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 17/18
78) When a cache is 10 times faster than main memory and cache is used 90% of the
time, how much speed do we gain?
📌 Formula:
Average access time = 0.9 × tc + 0.1 × tm
= 1 unit
Let cache = tc
10
Speed gain = ≈ 5.26 × faster
1.9
79) A program reads 500 integers in range [0–100] representing scores of students.
Best way to store frequencies of scores above 50?
✅ Answer:
Use an array of size 51 (for scores 51 to 100)
python
`freq = [0]*51
for score in scores:
if score > 50:
freq[score - 51] += 1
`
80) What is the worst-case time complexity for search operations in a Binary Search
Tree (BST)?
Worst Case: When the tree is skewed (all nodes in a single line)
→ Time Complexity: O(n)
Best/Average Case: For balanced BST → O(log n)
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 18/18