How does memoization differ from tabulation in dynamic programming?

  • Memoization is faster than tabulation in all cases.
  • Memoization stores solutions top-down while tabulation does not.
  • Tabulation stores solutions bottom-up while memoization does not.
  • They both store computed values but memoization uses recursion.
Memoization involves storing the results of expensive function calls and returning the cached result when the same inputs occur again. Tabulation, on the other hand, builds the table from the ground up, typically using iterative loops. This is a top-down approach, while tabulation is bottom-up, starting from the smallest subproblems. Memoization is often easier to implement but can be less efficient for some problems compared to tabulation.

What is the purpose of a file system in an operating system?

  • To control the hardware resources of a computer
  • To maintain system logs and error messages
  • To manage user permissions and access control
  • To organize and manage files and directories efficiently
A file system in an operating system primarily serves to organize and manage files and directories efficiently, enabling users and applications to store, retrieve, and manipulate data effectively. This organization includes managing file metadata such as permissions, timestamps, and file locations. The file system also ensures data integrity and reliability through mechanisms like journaling and redundancy. Overall, it provides a structured approach to data storage and retrieval within an operating system.

The ___________ scheduling algorithm selects the process with the shortest burst time.

  • First Come First Serve
  • Priority
  • Round Robin
  • Shortest Job First
Shortest Job First (SJF) scheduling algorithm selects the process with the shortest burst time to execute next. This minimizes the average waiting time and improves system throughput by prioritizing smaller jobs. SJF can be either preemptive or non-preemptive, where in preemptive SJF, a new job with a shorter burst time can interrupt the currently running job.

Imagine you're working on a social media platform where users can follow each other. How would you design SQL queries to retrieve the list of followers for a given user and to find mutual followers between two users?

  • Use INNER JOIN for follower list, and LEFT JOIN for mutual followers
  • Use JOIN and WHERE clause for follower list, and INNER JOIN for mutual followers
  • Use LEFT JOIN for follower list, and OUTER JOIN for mutual followers
  • Use OUTER JOIN for follower list, and JOIN for mutual followers
When designing SQL queries for a social media platform where users can follow each other, you would typically use JOIN operations to retrieve follower lists and find mutual followers. For retrieving the list of followers for a given user, you can use an INNER JOIN with a WHERE clause to match follower IDs with the user's ID. This ensures that only followers related to the specific user are returned. To find mutual followers between two users, you would also use INNER JOIN, but this time between the follower lists of both users, ensuring that only followers common to both users are included. Using JOIN operations with appropriate clauses helps efficiently fetch follower information and identify mutual connections on the platform.

A ___________ is a predefined set of inputs along with their expected outputs used to validate software behavior.

  • Test case
  • Test plan
  • Test scenario
  • Test suite
A test case is a specific set of inputs, execution conditions, and expected results designed to verify a particular aspect or functionality of software. Test cases are part of a broader test suite, which comprises multiple test cases organized to validate different parts of the software. A test suite, in turn, can be part of a larger test plan that outlines the overall testing strategy, objectives, resources, and schedules for testing the software. Test scenarios are broader descriptions of possible interactions or workflows, often used to derive specific test cases within a test suite.

What is the role of indexing in improving the performance of database queries?

  • Enhanced data security
  • Faster data retrieval
  • Increased data redundancy
  • Reduced storage space
Indexing helps in faster data retrieval by creating a data structure that allows the database system to locate and access rows quickly. It does not directly affect storage space or data redundancy but can indirectly impact them based on implementation. Indexing does not enhance data security; it primarily focuses on query performance.

What are the different types of NoSQL databases, and how do they differ from each other?

  • Document-oriented, Key-value, Columnar, Graph
  • In-memory, Cache-based, Distributed, Indexed
  • Relational, Hierarchical, Wide-column, Time-series
  • Tabular, Spatial, Structured, Semi-structured
NoSQL databases come in various types, each designed for specific data handling needs. Document-oriented databases like MongoDB store data in flexible, JSON-like documents, while key-value stores like Redis use simple key-value pairs. Columnar databases such as Cassandra organize data in columns rather than rows. Graph databases like Neo4j focus on relationships between data entities. Understanding these differences helps in choosing the right database for specific use cases.

What is the default branch name in Git?

  • master
  • main
  • default
  • dev
Option 2: The default branch name in Git has evolved; historically, it was often 'master,' but newer conventions use 'main.' This is the branch where development typically begins and where stable versions are merged.

How can query execution plans help in optimizing database queries?

  • All of the above
  • Identifying inefficient operations
  • Providing insights into query performance
  • Suggesting index usage
Query execution plans show how a database will execute a query, helping to identify inefficient operations and suggesting improvements such as index usage. This insight is crucial for optimizing database queries and improving overall performance.

What is the main advantage of using NoSQL databases over traditional relational databases?

  • ACID Compliance
  • Data Consistency
  • Scalability
  • Schema Flexibility
NoSQL databases offer schema flexibility, allowing developers to store and manage unstructured or semi-structured data without predefined schemas. This flexibility is advantageous in scenarios where the data model is evolving or where dealing with highly variable data types. Unlike traditional relational databases that enforce a strict schema, NoSQL databases can adapt to changing data requirements, making them more scalable and agile in certain use cases.