In a real-time chat application, you need to implement a feature that notifies users when someone is typing a message. How would you accomplish this using JavaScript?

  • Use AJAX polling to check typing status
  • Use WebSocket to send typing status
  • Use oninput event listener
  • Use setTimeout and clearTimeout for delay
Using WebSocket allows real-time communication between clients and the server, making it ideal for notifying users when someone is typing. setTimeout and clearTimeout are more suitable for handling delays and timeouts, not real-time updates. AJAX polling introduces unnecessary overhead and delays. The oninput event listener is used for detecting input changes, not real-time status updates.

___________ is a divide and conquer sorting algorithm.

  • Bubble Sort
  • Insertion Sort
  • Merge Sort
  • Selection Sort
Merge sort is a classic example of a divide and conquer algorithm, where the sorting process involves dividing the array into smaller subarrays, sorting them individually, and then merging them back together in sorted order.

Which Agile methodology emphasizes adaptability and customer collaboration over strict planning?

  • PRINCE2
  • Scrum
  • Six Sigma
  • Waterfall
Scrum is an Agile methodology that emphasizes adaptability and customer collaboration over strict planning. It encourages iterative development, frequent feedback, and a focus on delivering value to customers. Scrum teams are self-organizing and cross-functional, with a Scrum Master facilitating the process rather than dictating tasks. This approach promotes flexibility, continuous improvement, and customer satisfaction by responding to changing requirements throughout the development cycle.

How does Node.js handle clustering for scaling applications?

  • Implements microservices architecture
  • Utilizes Docker containers
  • Utilizes load balancing
  • Utilizes the cluster module
Node.js clustering allows applications to utilize multiple CPU cores efficiently by creating child processes (workers) using the cluster module. Each child process runs on a separate core, enabling parallel processing and improved performance. This approach is particularly effective for scaling applications across multiple cores without relying solely on the single-threaded nature of Node.js.

The _______ pattern is often used in RESTful APIs to provide access to related resources.

  • Composite
  • Composite Entity
  • Facade
  • Repository
The Repository pattern is commonly used in RESTful APIs to abstract the data access layer and provide a simplified interface for accessing related resources. It helps in organizing code and separating concerns by providing a centralized mechanism for handling database operations related to specific resources.

React's ___________ function enables developers to optimize performance by memoizing components.

  • useCallback
  • useEffect
  • useMemo
  • useState
The useMemo function in React enables developers to memoize components, which optimizes performance by caching the computed value of a function. This avoids unnecessary re-computations and enhances overall efficiency.

What is the purpose of a circular queue?

  • Avoids the need for queue resizing
  • Efficient use of limited memory
  • Ensures elements are processed in a specific order
  • Supports concurrent access to queue elements
The purpose of a circular queue is to avoid the need for resizing the queue when elements are added or removed. In a circular queue, elements are stored in a circular manner, allowing for efficient use of limited memory without the overhead of resizing operations. Additionally, a circular queue supports concurrent access to queue elements, making it suitable for scenarios where multiple processes or threads access the queue simultaneously.

In a weighted graph, a ___________ is a subset of the edges that connects all vertices together, without any cycles.

  • Dijkstra's Algorithm
  • Kruskal's Algorithm
  • Minimum Spanning Tree
  • Spanning Tree
A spanning tree is a subset of the edges of a graph that connects all vertices without any cycles. A minimum spanning tree is specifically the smallest such spanning tree, where the sum of the weights of its edges is minimized. Dijkstra's and Kruskal's algorithms are not specific to defining such subsets in a graph.

Code ___________ tools analyze code for potential issues and violations of coding standards.

  • Coverage
  • Profiling
  • Review
  • Static analysis
Static analysis tools analyze code without executing it, focusing on identifying potential issues, bugs, or violations of coding standards based on code structure, syntax, and patterns. These tools can flag issues such as unused variables, potential memory leaks, or violations of coding conventions like indentation, naming conventions, or code complexity thresholds. They are valuable in ensuring code quality, improving maintainability, and reducing the risk of introducing bugs or vulnerabilities during development. Profiling tools, on the other hand, focus on runtime behavior and performance metrics, coverage tools assess test coverage, and code review involves manual or automated inspection of code by peers or tools.

You're tasked with redesigning a legacy database system that suffers from numerous anomalies. Explain how you would approach the normalization process to address these issues and improve overall database performance.

  • Break down the database into fewer tables to simplify it
  • Combine multiple tables into one for faster access
  • Identify and eliminate redundant data by dividing tables and using foreign keys
  • Use non-normalized data to improve performance
In a legacy system, normalization involves identifying redundant data and dividing tables to eliminate anomalies such as update, insertion, and deletion anomalies. This is achieved by breaking down data into fewer tables, using foreign keys to establish relationships, and ensuring data integrity. Combining tables or using non-normalized data would not address the underlying issues of redundancy and anomalies.