Discuss the trade-offs between consistency, availability, and partition tolerance in NoSQL databases.

  • Availability ensures that a distributed system remains operational and responsive despite failures.
  • Consistency ensures that a distributed system can handle network partitions.
  • Consistency ensures that all nodes in a distributed system have the same data at the same time.
  • Partition tolerance ensures that a distributed system can handle network partitions.
NoSQL databases face trade-offs between Consistency, Availability, and Partition tolerance. For example, choosing strong consistency sacrifices Availability, while prioritizing Availability can lead to eventual consistency. Understanding these trade-offs is essential for designing scalable and resilient systems.

External fragmentation occurs when there are many small free ___________ scattered throughout the memory.

  • Blocks
  • Pages
  • Partitions
  • Segments
External fragmentation happens when there are many small free memory blocks scattered throughout the memory, but the total free memory is sufficient to satisfy a process's memory request. This fragmentation reduces the efficiency of memory utilization as it may prevent larger processes from being allocated memory even though there is enough free space overall.

Explain the concept of a double-ended queue (deque).

  • A data structure that allows insertion and deletion at both ends.
  • A data structure that allows insertion and deletion only at the front end.
  • A data structure that allows insertion and deletion only at the rear end.
  • A data structure that allows insertion at one end and deletion at the other end.
A deque is a versatile data structure that supports insertion and deletion from both ends, making it suitable for algorithms requiring efficient manipulation at both the front and rear. It's commonly used in scenarios like managing browser history or implementing breadth-first search.

The ___________ file in Node.js contains configuration settings for a Node.js application.

  • app.js
  • config.js
  • package.json
  • settings.json
The package.json file in a Node.js application contains important metadata and configuration settings, including dependencies, scripts, version information, and other project-specific details.

How does a priority queue differ from a regular queue?

  • Elements are removed based on a priority level
  • Elements are removed based on a secondary key
  • Elements are removed in a random order
  • Elements are removed in the order they were added
A priority queue differs from a regular queue in that elements are removed based on a priority level assigned to each element. This means that elements with higher priority levels are removed before elements with lower priority levels, regardless of the order they were added. In contrast, a regular queue removes elements in the order they were added, following the FIFO (First-In-First-Out) principle.

What is the purpose of a version control system like Git?

  • To track changes
  • To manage code
  • To automate testing
  • To write comments
Option 1: Version control systems like Git are used primarily to track changes made to files in a project. This enables developers to collaborate effectively, revert to previous versions if needed, and manage code history.

A stack follows the principle of ___________ (FIFO/LIFO) order.

  • FIFO
  • LIFO
  • Stack
  • Queue
The correct option is 'LIFO.' A stack follows the Last-In-First-Out (LIFO) order, meaning the last element added to the stack is the first one to be removed, resembling a stack of plates.

___________ testing is performed without knowledge of the internal workings of the software.

  • Black-box
  • Functional
  • Integration
  • Structural
Black-box testing involves testing the software from an external perspective, focusing on inputs and outputs without considering the internal code structure or logic. This approach helps assess the software's functionality and behavior based on various inputs and conditions, mimicking how end users interact with the software. Unlike structural testing (also known as white-box testing), black-box testing doesn't require knowledge of the internal code implementation, making it suitable for evaluating software based on specifications and requirements rather than implementation details.

What is the key difference between a tree and a graph?

  • Graph can have cycles
  • Graph can't have loops
  • Tree has a hierarchical structure
  • Tree is always acyclic
The key difference between a tree and a graph lies in their structure. While a tree has a hierarchical structure without cycles, a graph can have cycles and represents a more general structure for relationships between nodes.

In a text processing application, you're tasked with finding all occurrences of a given word within a large document. How would you approach this problem using arrays and strings efficiently?

  • Apply the Boyer-Moore algorithm
  • Implement a trie data structure
  • Use a hash table for word occurrences
  • Utilize a binary search tree
Tries efficiently store and search strings, making them suitable for word occurrence tasks.