What is the difference between INNER JOIN and LEFT JOIN in SQL?

  • Only returns matched rows from both tables
  • Returns all rows from both tables
  • Returns all rows from the left table
  • Returns all rows from the right table
INNER JOIN and LEFT JOIN are both SQL join clauses used to combine rows from two or more tables based on a related column between them. INNER JOIN returns only the matched rows from both tables, while LEFT JOIN returns all rows from the left table and the matched rows from the right table.

The command "git ___________" is used to create a new branch in Git.

  • branch
  • init
  • create
  • new
The correct option is "branch." The command "git branch" is used to create a new branch in Git. This is a fundamental operation in Git for branching and managing different versions of a project. When you run "git branch" followed by the branch name, Git creates a new branch based on the current state of the repository.

What is the main drawback of the First Come First Serve (FCFS) scheduling algorithm?

  • Convoy Effect
  • High Average Waiting Time
  • Low Throughput
  • Starvation
The main drawback of FCFS is the High Average Waiting Time, as processes are executed in the order they arrive, leading to longer waiting times, especially for processes with shorter execution times but arrive later.

You're leading a project where requirements are likely to evolve over time. Which SDLC model would you recommend, and why?

  • Agile
  • RAD (Rapid Application Development)
  • Spiral
  • Waterfall
Agile is recommended for projects with evolving requirements due to its iterative and incremental approach. It allows for flexibility, constant feedback, and adaptation to changing needs, making it ideal for dynamic projects where requirements may evolve during development. Waterfall is a sequential model and may not be suitable as changes late in the process can be costly and time-consuming. Spiral and RAD also offer iterative approaches but are less suited for continuous requirement changes compared to Agile.

Which CSS property is used to change the background color of an element?

  • background
  • background-color
  • color
  • text-color
The CSS property used to change the background color of an element is background-color. This property specifies the background color of an element and can be set using color names, HEX codes, RGB values, or RGBA values, allowing for a wide range of color customization.

Imagine you're building a microservices architecture where multiple services need to communicate via RESTful APIs. How would you ensure consistency and reliability in this distributed system?

  • Implement idempotency in API operations to ensure that requests can be safely retried without unintended side effects.
  • Implement synchronous communication between services for real-time consistency.
  • Use distributed transactions across services to maintain consistency in data changes.
  • Utilize a message broker such as Kafka or RabbitMQ for asynchronous communication and eventual consistency across services.
Using a message broker for asynchronous communication ensures reliability by decoupling services and enabling eventual consistency. It also helps in handling peaks in traffic and reducing dependencies, enhancing the overall reliability of the microservices architecture.

How can you center an element horizontally in CSS?

  • Using the 'float' property with a value of 'center' on the element to be centered.
  • Using the 'margin' property with a value of 'auto' on the element to be centered.
  • Using the 'padding' property with a value of 'center' on the element to be centered.
  • Using the 'text-align' property with a value of 'center' on the parent element.
To center an element horizontally in CSS, you typically use the 'margin' property with a value of 'auto' on the element you want to center. This approach works for block-level elements by evenly distributing the remaining space on either side of the element. Using 'text-align: center' on the parent element only centers inline-level content inside it, not block-level elements. Padding and floating do not directly center elements horizontally; they serve different purposes in CSS layout. Understanding how to center elements is fundamental for creating visually appealing and well-structured web layouts.

A large e-commerce platform experiences sudden spikes in traffic during sales events. How would you architect the database infrastructure using NoSQL databases to handle this scalability requirement?

  • Implement a message queue system with Kafka or RabbitMQ
  • Set up a load balancer with multiple database instances
  • Use a distributed database like Cassandra or MongoDB with sharding and replication
  • Utilize a caching layer with Redis or Memcached
A distributed database like Cassandra or MongoDB with sharding and replication is suitable for handling sudden traffic spikes as it can scale horizontally by adding more nodes. Sharding distributes data across multiple nodes, while replication ensures data availability and fault tolerance. A caching layer improves read performance but may not handle spikes in write operations efficiently. Message queues are used for asynchronous communication and may not directly address scalability. Load balancers distribute incoming traffic across multiple servers but do not inherently handle database scalability.

The process of rearranging the contents of a file to optimize storage space is known as ___________.

  • Allocation
  • Defragmentation
  • Fragmentation
  • Fragmentation Reduction
Defragmentation involves reorganizing the data on a disk to consolidate fragmented files, reducing access time and improving overall system performance.

Compare and contrast binary search trees (BSTs) and AVL trees.

  • AVL trees are self-balancing
  • AVL trees have stricter balance criteria
  • BSTs do not guarantee balanced structures
  • BSTs have O(log n) average time complexity for search
Binary Search Trees (BSTs) and AVL trees are both binary search tree structures used in storing and retrieving data efficiently. However, AVL trees differ in that they are self-balancing, ensuring that the height difference between subtrees (balance factor) is limited to maintain logarithmic time complexity for operations like search, insertions, and deletions. In contrast, while BSTs have an average time complexity of O(log n) for search operations, they do not inherently guarantee a balanced structure, potentially leading to worst-case scenarios of O(n) complexity if the tree becomes skewed. AVL trees, due to their stricter balancing criteria, offer more predictable and consistent performance but may require additional overhead in maintaining balance during insertions and deletions compared to BSTs. Understanding the differences between these tree structures is essential for designing efficient data storage and retrieval systems.