- 1
- 2
- 3
- 4
- Next Page »
A Learning Portal from Recruitment India
When a Nonstrict-read-write concurrency strategy is to be used?
Use this strategy if data hardly ever changes and a small likelihood of stale data is not of critical concern
Use this strategy for read-mostly data where it is critical to prevent stale data in concurrent transactions
Use it for reference data only
None of the above
Answer with explanation
Answer: Option AExplanation
The correct answer is Use this strategy if data hardly ever changes and a small likelihood of stale data is not of critical concern
The constrict-read-write strategy makes no guarantee of consistency between the cache and the database. Use this strategy if data hardly ever changes and a small likelihood of stale data is not of critical concern
Workspace
What would be the time complexity if the user tries to insert the element at the end of the linked list (head pointer is known)?
O(nlogn)
O(logn)
O(n)
O(1)
Answer with explanation
Answer: Option CExplanation
The answer is b, i.e., O(n). As it is mentioned in the above question that head pointer is known, so to insert the node at the end of the linked list; we have to traverse till the nth node. Therefore, the time complexity would be O(n).
Workspace
Which data structure is the best for implementing a priority queue?
Heap
Array
Linked list
Stack
Answer with explanation
Answer: Option AExplanation
The correct answer is Heap
Heap. All the data structures that are given in the above options can be used to implement a priority queue but the most efficient way of implementing a priority queue is a heap data structure.
Workspace
In the linked list implementation of queue, where will the new element be inserted?
At the tail position of the linked list
At the head position of the linked list
At the middle position of the linked list
None of the above
Answer with explanation
Answer: Option AExplanation
The correct answer is At the tail position of the linked list
If the queue is implemented using a linked list, then the new element will be inserted at the tail position of the linked list as Queue follows the FIFO principle in which a new element will always be added at the end of the Queue
Workspace
Which one of the following is the overflow condition if a circular queue is implemented using an array having size MAX?
front=(rear+1) mod max
rear=MAX
rear= MAX-1
None of the above
Answer with explanation
Answer: Option AExplanation
The correct answer is front=(rear+1) mod max
front=(rear+1) mod max. The overflow condition for the linear queue is rear =MAX-1 as there is no space left in the Queue if rear = MAX-1. On the other hand, in a circular queue, the overflow condition is front=(rear+1) mod max because the last element is connected to the first element in a circular queue.
Workspace