When implementing a database, the most appropriate data structure depends on what part of the database you’re focusing on. Among common options, the standard and most suitable choice is:
B-Tree (or B+ Tree)
Used by almost all modern databases (MySQL, PostgreSQL, Oracle, etc.) to implement indexes.
Provides efficient search, insert, delete, and range queries in O(log n) time.
Optimized for disk storage and block reads, making it ideal for large datasets.
Other data structures used in databases:
Hash Tables
Used for hash indexes and quick equality lookups (e.g., WHERE id = 100).
Very fast for exact matches but not good for range queries.
Heaps
Used to store unsorted table data.
Simple structure but inefficient for searches without indexes.
Linked Lists
Used internally for things like transaction logs and some in-memory structures.
Trie / Radix Trees
Sometimes used for full-text search or prefix matching.
There are 200 students in a school out which 120 students play football, 50 students play cricket and 30
students play both football and cricket. The number of students who play one game only is:
There are 15 points in a plane such that 5 points are collinear and no three of the remaining points are collinear
then total number of straight lines formed are:
Adjustment for collinearity:
Out of 15 points, 5 are collinear.
Lines from these 5 points = \(\binom{5}{2} = 10\).
But actually they form only 1 line.
Extra counted = \(10 - 1 = 9\).
Correct total lines:
\[
105 - 9 = 96
\]
Final Answer: The total number of straight lines formed = 96
Consider a system with 1K pages and 512 frames and each page is of size 2 KB. How many bits are required to represent the virtual address space memory:
\( y = \dfrac{1}{2 - \sin 3x} \)
Since \( \sin 3x \in [-1,1] \), we get \( 2 - \sin 3x \in [1,3] \).
Hence \( y \in \left[\tfrac{1}{3}, 1\right] \).
→ Matches with (III).
Step 2: For (B)
\( y = \dfrac{x^2 + x + 2}{x^2 + x + 1} = 1 + \dfrac{1}{x^2 + x + 1} \)
Since denominator is always positive, \( y > 1 \).
Minimum denominator = \(\tfrac{3}{4}\) at \(x = -\tfrac{1}{2}\).
So maximum \( y = 1 + \tfrac{1}{3/4} = \tfrac{7}{3} \).
Thus, Range = \((1, \tfrac{7}{3}] \).
→ Matches with (I).
Step 3: For (C)
\( y = \sin x - \cos x = \sqrt{2}\sin\!\left(x - \tfrac{\pi}{4}\right) \)
Hence, Range = \([-\sqrt{2}, \sqrt{2}] \).
→ Matches with (IV).
Step 4: For (D)
\( y = \cot^{-1}(-x) - \tan^{-1}(x) + \sec^{-1}(x) \)
Simplifying with inverse trig identities gives Range:
\(\left[\tfrac{\pi}{2}, \pi\right) \cup \left(\pi, \tfrac{3\pi}{2}\right]\).
→ Matches with (II).
We are asked about FIFO (First-In First-Out) page replacement algorithm.
Key point:
Normally, increasing the number of page frames decreases the number of page faults (because more pages can be stored).
But in FIFO, there is a special anomaly called Belady’s Anomaly.
It states that in FIFO, sometimes increasing the number of page frames may actually increase the number of page faults (depending on the access pattern).
Checking the options:
Increasing the number of page frames decreases the number of page faults.
❌ Not always true (Belady’s anomaly exists).
Increasing the number of page frames may increase or decrease the number of page faults depending on the memory access pattern.
✅ This is correct (captures Belady’s anomaly).
Increasing the number of page frames always increases the number of page faults.
❌ Wrong.
Increasing the number of page frames has no effect.
❌ Wrong.
✅ Final Answer: (2) Increasing the number of page frames may increase or decrease the number of page faults depending on the memory access pattern.
An equilateral triangle is inscribed in a parabola $y^2=8x$ whose one vertix is at the vertex of the parabola then the length of the side of the triangle is:
So the points are \((a,b), \; (ar,br), \; (ar^2,br^2)\).
Slopes:
Between first two points:
\[
m_{12} = \frac{br - b}{ar - a} = \frac{b(r-1)}{a(r-1)} = \frac{b}{a}
\]
Between second and third points:
\[
m_{23} = \frac{br^2 - br}{ar^2 - ar} = \frac{br(r-1)}{ar(r-1)} = \frac{b}{a}
\]
Since \(m_{12} = m_{23}\), the points are collinear.
Final Answer: The points \((x_1,y_1), (x_2,y_2), (x_3,y_3)\) are collinear.
Curves: \(y^2=4x\) (right-opening) and \(x^2=4y\) (upward). Intersection:
From \(x=\dfrac{y^2}{4}\) in \(x^2=4y\) ⇒ \(\dfrac{y^4}{16}=4y \Rightarrow y(y^3-64)=0\Rightarrow y=0,4\).
Thus points are \((0,0)\) and \((4,4)\) in the first quadrant.
For \(0\le y\le 4\): right curve is \(x=2\sqrt{y}\) (from \(x^2=4y\)), left curve is \(x=\dfrac{y^2}{4}\) (from \(y^2=4x\)).
Area \(=\displaystyle \int_{0}^{4}\!\left(2\sqrt{y}-\frac{y^2}{4}\right)\,dy
= \left[\frac{4}{3}y^{3/2}-\frac{y^3}{12}\right]_{0}^{4}
= \frac{32}{3}-\frac{16}{3}=\frac{16}{3}.\)
Final Answer: \(\displaystyle \frac{16}{3}\) square units.
Four students are sitting on a bench to be photogrpahed. Kamal is to the left of Amrita. Dipak is to the right of Amrita. Ankit is between Amrita and Dipak. Identify students sitting in corner’s of the bench?
Consider a completely skewed (left / right) binary search tree with n elements. What is the worst case time complexity of searching an element in this tree?
If the parametric equation of a curve is given by $x=e^t cost$ and $y=e^t sint$ then the tangent to the curve at the point $t=\frac{\pi}{4}$ makes the angle with the axis of x is
$$x = e^t \cos t,\quad y = e^t \sin t$$
To find the angle of the tangent at \( t = \frac{\pi}{4} \), compute the slope:
$$\frac{dy}{dx} = \frac{\frac{dy}{dt}}{\frac{dx}{dt}} = \frac{e^t(\sin t + \cos t)}{e^t(\cos t - \sin t)} = \frac{\sin t + \cos t}{\cos t - \sin t}$$
At \( t = \frac{\pi}{4} \),
$$\sin\left(\frac{\pi}{4}\right) = \cos\left(\frac{\pi}{4}\right) = \frac{\sqrt{2}}{2}$$
So,
$$\frac{dy}{dx} = \frac{\frac{\sqrt{2}}{2} + \frac{\sqrt{2}}{2}}{\frac{\sqrt{2}}{2} - \frac{\sqrt{2}}{2}} = \frac{\sqrt{2}}{0}$$
The slope is undefined, which means the tangent is vertical.
Final Answer: The angle with the x-axis is
$$\boxed{90^\circ}$$
To find the last node of a singly linked list, we must keep moving until the link (next pointer) becomes NULL. This ensures we stop exactly at the last node.
// Structure of node
struct Node {
int data;
struct Node* link;
};
// Function to get last node
struct Node* getLastNode(struct Node* head) {
struct Node* temp = head;
// Traverse until last node
while (temp -> link != NULL) {
temp = temp -> link;
}
return temp; // Now temp points to last node
}
Explanation:
Initialize a pointer temp with head.
Keep moving forward using temp = temp → link while temp → link != NULL.
When loop ends, temp is pointing to the last node.
where \([x]\) is the greatest integer function (GIF).
The GIF \([x]\) is discontinuous at all integers. Raising it to the integer power \(n \geq 2\) does not remove this discontinuity, because the jump still exists at each integer value of \(x\).
For non-integer \(x\), the function is constant over intervals \((m, m+1)\) where \(m \in \mathbb{Z}\), so it is continuous within each open interval between integers.
Final Answer: The function is discontinuous at all integers.
(A) If each element in a row is a constant multiplier of corresponding element of another row of a determinant, then the value of the determinant is always non-zero.
(B) If each element on one side of the principal diagonal of a determinant is zero, then the value of the determinants the product of the diagonal elements.
(C) The value of determinant of skew symmetric matrix of odd order is always non-zero.
(D) If A is non-singular matrix of order three, then $adj A=|A|^2$
Choose the correct answer from the options given below:
There is a certain relation between two given words on lieft wide of : : and one word is given on the right sideof : : while another word is missing. Select the missing word which have same relation as the word pairs on the left side of : : symbol.
A function f(x) is defined as $$f(x)=\begin{cases}{\frac{1-\cos 4x}{{x}^2}} & {;x{\lt}0} \\ {a} & {;x=0} \\ {\frac{\sqrt[]{x}}{\sqrt[]{(16+\sqrt[]{x})-4}}} & {;x{\gt}0}\end{cases}$$
if the function f(x) is continuous at x = 0, then the value of a is:
K is the son of A’s mother’s sister. Q is daughter of D, who is the father of G and grandfather of A. P is the daughter of H who is grandmother of K. D is husband of H and G is husband of L. How is P related to Q?
(A) Arrays, (C) Heap Data Structure, and (D) Linked List
Explanation:
Arrays:
Unsorted Array: Insertion is O(1), Deletion is O(n).
Sorted Array: Insertion is O(n), Deletion is O(1).
Heap Data Structure:
Binary heaps are commonly used for efficient implementation.
Insertion and Deletion take O(log n) time.
Linked List:
Can be implemented as sorted or unsorted.
Efficiency depends on the choice of implementation.
Why not Fibonacci Tree?
Fibonacci trees are not used directly for priority queues. However, Fibonacci heaps (a separate data structure) can implement priority queues efficiently.
An operating system cotains 4 user processor each requiring 5 units of resource R. The minimum number ofrequired units of R such that no deadlock will every occur is
The current allocation and Maximum requirement of different types of resources for four processes are given below:
Consider the following four statements.
(A) P2 → P4 → P1 → P3 is a safe sequence (B)
P4 → P2 → P1 → P3 is a safe sequence (C)
P4 → P2 → P3 → P1 is a safe sequence
(D) P1 → P4 → P2 → P3 is a safe sequence
Identify correct statements from the given options.
In a class, 4/5 of the students are boys and rest are girls. If 2/5 of the boys and 1/4 of girls are absent, what part of the total number of students is present?
Let $\alpha >2$ is an integer. If there are only 10 positive integers satisfying the inequality $(x-\alpha)(x-2\alpha)(x-\alpha^2)<0$ then the value/s of $\alpha$ is
Amit was counting down from 34, Punit was counting upwards the numbers starting from 2 and he was calling out only the even numbers. What common number will they call out at the same time if they were calling out at the same speed?
One day, Amit left home and cycled 15 km southwards, turned right and cycled 7 km and turned right andcycled 10 km and turned left and cycled 5 km. How many kilometers will he have to cycle to reach his home?
In a computer if the page fault service time is 10 ms and average memory access time is 30 ns. If one page faultis generated for every 106 memory accesses. What is the effective access time for the memory?
In a certain code if SCOTLAND is written as 12345678, LOAN is written as 1435, LOTS is written as 8124,DAN is written as 537 and SON is written as 458, then what will be the code for ‘C’?