What is the time complexity of the binary search algorithm?
- O(1)
- O(log n)
- O(n log n)
- O(n)
The time complexity of the binary search algorithm is O(log n), where n is the number of elements in the sorted array. This efficiency is due to the algorithm halving the search space in each step.
Which wireless technology is commonly used for short-range communication between devices, such as smartphones and smartwatches?
- Bluetooth
- LTE
- NFC
- Zigbee
Bluetooth is the wireless technology commonly used for short-range communication between devices like smartphones and smartwatches. It operates on the 2.4 GHz frequency band and is known for its low power consumption.
The ___________ time is the maximum amount of time a process can execute before being interrupted in preemptive scheduling.
- Arrival
- Burst
- Quantum
- Response
The quantum time, also known as time slice or time quantum, is the maximum amount of time a process can execute before being interrupted in preemptive scheduling algorithms like Round Robin. It defines the length of each time slot during which a process can run before the scheduler switches to another process.
___________ is a popular React feature that enables seamless integration with existing JavaScript codebases.
- Babel
- JSX
- TypeScript
- Webpack
JSX (JavaScript XML) is a syntax extension used in React for writing HTML-like code within JavaScript. It allows developers to create React components more elegantly and expressively. While TypeScript, Webpack, and Babel are all crucial tools in the React ecosystem, JSX stands out as the correct answer because it directly relates to React's unique approach to building user interfaces with a blend of JavaScript and HTML-like syntax.
Which operation in queues removes an element from the front?
- Dequeue
- Enqueue
- Peek
- Push
The operation in queues that removes an element from the front is called dequeue. Dequeue removes the element that has been in the queue the longest, following the First In, First Out (FIFO) principle. This operation is essential for processing data in the order it was received, such as handling tasks in a computer's task queue or managing requests in a web server's request queue.
Which type of redundancy does database normalization aim to eliminate?
- Data Redundancy
- Functional Redundancy
- Indexing Redundancy
- Structural Redundancy
Database normalization aims to eliminate Functional Redundancy, where the same piece of data is stored in multiple places, leading to inconsistencies and potential data integrity issues.
When would you choose the Strategy design pattern over the State design pattern?
- When an object's behavior changes based on internal state
- When behavior changes based on state and transitions are simple
- When behavior needs to vary independently of its context
- When there are multiple behaviors and transitions between them
The Strategy design pattern is chosen when different algorithms or behaviors need to be selected at runtime independently of the context. In contrast, the State pattern is used when an object's behavior changes based on internal state changes. Understanding the nature of behavior variation and the complexity of state transitions helps in selecting the appropriate pattern.
In a distributed system, processes communicate over the network and may encounter deadlocks. How would you design a deadlock detection and recovery mechanism for such a system?
- Design a distributed lock manager to coordinate access
- Implement a distributed deadlock detection algorithm
- Use a timeout mechanism to detect potential deadlocks
- Utilize a distributed consensus protocol like Paxos
Implementing a distributed deadlock detection algorithm enables processes in a distributed system to detect potential deadlocks by exchanging information about their resource allocations. This approach helps in identifying circular wait conditions and allows for recovery strategies such as resource preemption or requesting additional resources to break the deadlock and restore system functionality.
A ___________ is a tree in which no node can have a degree greater than two.
- AVL Tree
- Binary Heap
- Binary Search Tree
- Binary Tree
A tree in which no node can have a degree greater than two is specifically known as a binary search tree. In a binary search tree (BST), each node can have at most two children, referred to as the left child and the right child. This property is crucial for maintaining the ordering of elements within the tree, allowing for efficient searching, insertion, and deletion operations.
Which containerization technology is known for its lightweight and fast startup times?
- Docker
- Kubernetes
- VMware
- VirtualBox
Docker is renowned for its lightweight nature and rapid startup times, making it a preferred choice for developers and organizations seeking efficient containerization solutions.