Describe the difference between composition and inheritance in OOP.

  • Composition allows creating complex objects by combining simpler ones, while inheritance allows a class to inherit properties and behavior from another class.
  • Composition and inheritance are two terms that mean the same thing in OOP.
  • Composition is not used in Object-Oriented Programming.
  • Composition is used for creating new objects, while inheritance is used for modifying existing objects.
Composition and inheritance are both mechanisms for reusing code in OOP, but they differ in their approach. Composition involves creating complex objects by combining simpler ones, whereas inheritance involves creating a new class based on an existing class, inheriting its properties and behavior.

What command is used to stage files for committing in Git?

  • git add
  • git commit
  • git push
  • git stage
The command used to stage files for committing in Git is git add. This command adds changes to the staging area, preparing them for the next commit. It allows for selective committing of changes.

What does SDLC stand for?

  • Software Development Life Cycle
  • Structured Design and Life Cycle
  • System Design and Life Cycle
  • Systematic Development Life Cycle
SDLC stands for Software Development Life Cycle. It is a systematic process for planning, creating, testing, deploying, and maintaining information systems.

Which AWS service is used for serverless computing?

  • AWS Lambda
  • Amazon EC2
  • Amazon RDS
  • Amazon S3
AWS Lambda is the AWS service used for serverless computing. It allows developers to run code without provisioning or managing servers. It's a cost-effective way to build applications that respond to events and scale automatically.

You are designing a banking application where multiple users can transfer money between accounts concurrently. How would you ensure data consistency and avoid concurrency issues?

  • Caching without Locking
  • Optimistic Concurrency Control
  • Pessimistic Concurrency Control
  • Using Database Transactions
In a banking application, ensuring data consistency during concurrent transactions is critical. Using database transactions provides a reliable method to maintain atomicity, consistency, isolation, and durability (ACID properties). This approach helps prevent issues such as lost updates or inconsistent states.

_______ logs are typically human-readable and provide information about system events and errors.

  • Binary
  • JSON
  • Text
  • XML
Text logs are typically human-readable and provide information about system events and errors. They are easy to interpret and analyze, making them widely used in logging for their simplicity and accessibility.

What is caching in web development?

  • Compressing images in a web application
  • Defining the layout of a webpage
  • Encrypting data for security
  • Storing frequently used data temporarily
Caching in web development refers to storing frequently used data temporarily. It helps improve performance by reducing the need to fetch the same data repeatedly from the server.

TDD promotes writing _______ that fail before writing new code to pass them.

  • Comments
  • Documentation
  • Requirements
  • Tests
Test-Driven Development (TDD) promotes writing tests that fail before writing new code to pass them. This iterative approach ensures that each new piece of code is validated against predefined test cases, contributing to a more robust and reliable codebase.

Explain a real-world scenario where the use of ACID properties in a database transaction is critical to ensuring data integrity.

  • Blog Comments
  • Logging Inventory Changes
  • Online Banking Transactions
  • User Authentication
In online banking transactions, the use of ACID properties (Atomicity, Consistency, Isolation, Durability) is critical to ensure the integrity of financial data. A failed transaction could lead to inconsistencies in the user's account balance, emphasizing the need for transactional reliability.

The indexOf() method in JavaScript returns the position of the first occurrence of a specified _______ within a string.

  • Character
  • Element
  • Substring
  • Value
The indexOf() method returns the position of the first occurrence of a specified character within a string. It helps in finding the index of a particular character or substring.