Lesson 3 Flashcards

1
Q

What does “SOLID” stand for in OOP?

A

Single Responsibility Principle.
Open/Closed Principle.
Liskov Substitution Principle.
Interface Segregation Principle.
Dependency Inversion Principle.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the Single Responsibility Principle (SRP)?

A

A class should have only one reason to change, meaning it should have only one responsibility or job.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How can you apply the Single Responsibility Principle (SRP) in Java?

A

By creating classes that have a clear and single responsibility. If a class has multiple responsibilities, it should be split into smaller, more focused classes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the Open/Closed Principle (OCP)?

A

Software entities should be open for extension but closed for modification, allowing new functionality to be added without modifying existing code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does the Liskov Substitution Principle (LSP) state?

A

Subtypes should be substitutable for their base types without affecting the correctness of the program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How can you apply the Open/Closed Principle (OCP) in Java?

A

By designing classes that are open for extension but closed for modification, using interfaces, abstract classes, and polymorphism.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How can the Liskov Substitution Principle (LSP) be applied in Java?

A

By creating subclasses that can be used in place of their superclass, without altering the expected behavior.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the Interface Segregation Principle (ISP)?

A

Clients should not be forced to depend on interfaces they do not use. Interfaces should be small and focused.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How can you implement the Interface Segregation Principle (ISP) in Java?

A

By creating small and focused interfaces that clients only depend on as needed, avoiding large, general-purpose interfaces.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the Dependency Inversion Principle (DIP)?

A

High-level modules should not depend on low-level modules; both should depend on abstractions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Give a real-world example of the Single Responsibility Principle (SRP).

A

In a web application, a User class handles user-specific operations, while an EmailService class handles sending emails, ensuring separation of concerns.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How can you apply the Dependency Inversion Principle (DIP) in Java?

A

By using interfaces or abstract classes to define behavior and using dependency injection to provide specific implementations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Provide an example of applying the Open/Closed Principle (OCP) in a payment system.

A

Defining a PaymentProcessor interface and having multiple classes, such as CreditCardProcessor and PayPalProcessor, implement it to add new payment methods without modifying existing code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Describe a violation of the Liskov Substitution Principle (LSP).

A

A Penguin class inherits from Bird but changes the behavior of the fly() method, which is not appropriate since penguins cannot fly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How can the Interface Segregation Principle (ISP) be applied to a messaging system?

A

Instead of a single IMessage interface with multiple methods, create smaller interfaces like ISender and IReceiver for specific functionality.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How does the Dependency Inversion Principle (DIP) benefit an e-commerce application?

A

It allows the OrderProcessor class to depend on an IPaymentGateway interface, making it easy to switch between different payment providers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is Maven?

A

Maven is a build automation and dependency management tool used primarily for Java-based projects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What file does Maven use to configure a project?

A

pom.xml (Project Object Model)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What are the three main coordinates that uniquely identify a Maven project?

A

<groupId>, <artifactId>, and <version>
</version></artifactId></groupId>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is the purpose of the <dependencies> tag in pom.xml?</dependencies>

A

To specify the libraries or dependencies required by the project.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

How do you check if Maven is installed using the command line?

A

mvn –version

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is a Maven “lifecycle”?

A

A sequence of phases that define the stages in the build process, such as Validate, Compile, Test, Package, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What Maven command is used to compile a project?

A

mvn compile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What does the mvn package command do?

A

It packages the compiled code into a JAR or WAR file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What tool does Maven integrate with for code coverage analysis?

A

JaCoCo (Java Code Coverage)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What does a red diamond in a JaCoCo report indicate?

A

No branches have been exercised during the test phase.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What are the three main code coverage metrics provided by JaCoCo?

A

Line coverage, branch coverage, and cyclomatic complexity.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

What is the purpose of the <plugins> section in pom.xml?</plugins>

A

To list plugins that extend Maven’s functionality, such as JaCoCo for code coverage.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

What is the role of the <executions> tag in a Maven plugin configuration?</executions>

A

To define specific goals to be executed during particular phases of the build lifecycle.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

How do you run a specific Maven goal?

A

Use the syntax mvn plugin:goal (e.g., mvn dependency:copy-dependencies)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

What does the mvn clean verify command do?

A

Cleans the project and runs all verification tasks, including tests and coverage checks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

Why is 100% code coverage not always indicative of effective testing?

A

It only shows how much code is executed, not how well the code is tested or if all edge cases are covered.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

What does <scope> define in a dependency within pom.xml?</scope>

A

The visibility and usage of the dependency (e.g., compile, runtime, test).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

What command can generate a JaCoCo report after tests have run?

A

mvn jacoco:report

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

What is the Maven Build Lifecycle?

A

It is a predefined sequence of phases that a Maven build goes through, representing steps like compiling, packaging, and deploying the code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

What environment variable needs to be set when installing Maven on Windows?

A

PATH variable to include Maven’s bin directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

List the phases of the Maven Build Lifecycle in order.

A
  1. Validate
  2. Compile
  3. Test
  4. Package
  5. Verify
  6. Install
  7. Deploy
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

What is the purpose of the “compile” phase in Maven?

A

To compile the source code of the project

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

What happens during the “validate” phase of the Maven Build Lifecycle?

A

Maven checks that the project is correct and that all necessary information is available.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

What does the “test” phase do in the Maven build lifecycle?

A

Tests the compiled source code using a suitable unit testing framework, without requiring packaging or deployment.

38
Q

What occurs during the “package” phase of the Maven Build Lifecycle?

A

The compiled code is packaged into its distributable format, such as a JAR file.

39
Q

What is the “verify” phase in Maven?

A

This phase runs checks on the results of integration tests to ensure quality criteria are met.

40
Q

What does the “install” phase do in Maven?

A

Installs the package into the local repository for use as a dependency in other projects locally.

41
Q

What happens during the “deploy” phase of the Maven Build Lifecycle?

A

Copies the final package to the remote repository for sharing with other developers and projects.

42
Q

How do you invoke a specific phase of the Maven Build Lifecycle?

A

Use the command mvn phase_name in the CLI, open to the directory containing the Maven project.

42
Q

How can developers customize the Maven build lifecycle?

A

By defining custom build phases, binding plugins to specific lifecycle phases, and executing additional tasks as needed.

43
Q

Why is understanding the Maven build lifecycle important for troubleshooting build failures?

A

It helps identify which phase or plugin encountered an error, allowing for efficient problem diagnosis and resolution.

44
Q

What is the purpose of the maven-assembly-plugin in Maven?

A

To build a JAR executable with all dependencies, which is required when the default mvn package command does not produce a fully executable JAR.

45
Q

What is the Software Development Life Cycle (SDLC)?

A

SDLC is a structured process applied to software development that includes steps like Planning, Requirements, Design, Build, Document, Test, Deploy, and Maintain to improve and measure the development process.

45
Q

How do you generate a JAR with dependencies using the Maven Assembly Plugin?

A

Run the command mvn package assembly:single.

46
Q

What are the main stages of SDLC?

A

Planning
Requirements
Design
Build
Document
Test
Deploy
Maintain

47
Q

Why is SDLC important in software development?

A

SDLC provides a structured framework for developing software, helps in planning, reduces unnecessary costs, enables high-quality software development, and provides a basis for evaluating software effectiveness.

48
Q

What is done during the Planning phase of SDLC?

A

Project leaders calculate costs, create timetables, form teams, and gather stakeholder feedback. The scope and purpose of the application are defined to keep the project focused.

49
Q

What happens during the Requirements phase?

A

Requirements define what the application should do and identify necessary resources. This can involve technical specifications, user needs, and resource requirements.

50
Q

What is the purpose of the Design and Prototyping phase?

A

To create a model of how the software will work, including its architecture, user interface, platforms, communication methods, and security measures. Prototyping is used to get stakeholder feedback early in the design process.

51
Q

What does the Software Development phase involve?

A

Actual writing of code, use of source code management systems, error fixing, skill development, and documentation creation.

52
Q

What is the focus of the Testing phase?

A

To test the application thoroughly, ensuring all functions work correctly, different parts work together seamlessly, and there are no bugs or glitches before deployment.

53
Q

What is involved in the Deployment phase?

A

Making the application available to users, which could range from simple downloads to complex integrations with existing systems.

53
Q

What is the purpose of the Operations and Maintenance phase?

A

To fix bugs that users find after deployment and to plan for future releases or additional features.

54
Q

What is Agile methodology?

A

Agile is a software development model focused on customer needs, user experience, and rapid response to market changes. It emphasizes team collaboration, iterative development, and customer feedback.

55
Q

What are the advantages of Agile?

A

Provides a responsive approach to development
Focuses on one task at a time
Reduces time allocation and estimation compared to the waterfall model

56
Q

What are the disadvantages of Agile?

A

Depends heavily on customer clarity
If not implemented properly, may result in inadequate documentation

57
Q

Who are the main roles in Agile (Scrum framework)?

A

Product Owner: Maximizes product value, manages the backlog, prioritizes user stories
Scrum Master: Facilitates the process, removes impediments, ensures practices are followed
Development Team: Cross-functional group that delivers the product, self-organizing

58
Q

What are the 4 core values of Agile?

A

Individuals and interactions over processes and tools
Working software over comprehensive documentation
Customer collaboration over contract negotiation
Responding to change over following a plan

59
Q

What are User Stories in Agile?

A

A high-level definition of a work request, focusing on the user’s goals and motivations, formatted as: “As a user, I want [functionality] so that [motivation].”

60
Q

What is a Sprint in Agile?

A

A short, iterative cycle (1-3 weeks) where teams work on specific tasks. After each sprint, the product is reviewed, and adjustments are made.

60
Q

What is the purpose of a daily stand-up meeting in Agile?

A

To keep everyone informed and on track by discussing progress, tasks for the day, and any impediments, typically lasting less than 10 minutes.

61
Q

What is an Agile board?

A

A tool to track project progress, which can be a whiteboard, Kanban board, or a project management software function.

62
Q

What is the difference between Scrum and Kanban?

A

Scrum: Focuses on sprints and iterative development cycles.
Kanban: Uses visual boards to improve workflow and manage work in progress without fixed sprints.

63
Q

What are the four essential Scrum ceremonies?

A

Sprint planning, Daily stand-up, Sprint review, Sprint retrospective.

64
Q

When does Sprint Planning take place, and what is its purpose?

A

Sprint Planning occurs before the sprint and creates a road map for the upcoming product development sprint.

65
Q

What is the purpose of the Sprint Review?

A

To meet with stakeholders to showcase what was accomplished during the sprint, solicit feedback, and discuss necessary changes.

65
Q

What is the main objective of the Daily Stand-up meeting?

A

To ensure the sprint is proceeding effectively by identifying roadblocks and allowing team members to describe their current tasks, goals, and obstacles.

65
Q

What is discussed during the Sprint Retrospective?

A

The team discusses the sprint’s successes, challenges, and insights to identify how to improve future sprints.

66
Q

What are Story Points in Agile?

A

Story Points are a unit of measurement used by agile teams to estimate the effort required to complete a user story or backlog item.

67
Q

Why use Story Points instead of hours for estimating work in Agile?

A

Story Points account for the complexity, amount, and uncertainty of the work, providing a relative measure of effort instead of a precise time estimate.

68
Q

What is the Fibonacci Sequence, and how is it used in Agile estimation?

A

The Fibonacci Sequence is a series of numbers where each number is the sum of the two preceding ones. It is used in Agile to estimate effort by assigning story points that increase non-linearly, reflecting the growing uncertainty of larger tasks.

69
Q

What is a Burndown Chart in Agile?

A

A Burndown Chart illustrates a team’s progress by showing the amount of work remaining against the time left in an Agile sprint or project.

70
Q

What are the two types of Burndown Charts?

A

Sprint Burndown (shows work left in the iteration) and Product Burndown (shows work left on the entire project).

71
Q

What are the benefits of using Story Points for development teams?

A

Helps the team grasp requirements better, avoid over-planning, work at a sustainable pace, and create reasonable estimates without committing to a specific timeframe.

72
Q

What is the role of the Scrum Master in Scrum ceremonies?

A

To facilitate Scrum ceremonies, ensure everyone stays organized and on task, and act as a servant-leader or coach for the team.

73
Q

What is the Waterfall SDLC model?

A

The Waterfall SDLC model is a linear and sequential approach to software development where each phase must be completed before the next one begins.

74
Q

What are the major stages of the Waterfall method?

A

The major stages are Requirements Determination, Design (Logical and Physical), Implementation, Verification, and Maintenance.

75
Q

What are the disadvantages of the Waterfall model?

A

Disadvantages include inefficiency for complex projects, time consumption due to strict phase completion, and delayed testing leading to potential issues and technical debt.

75
Q

How is the Design phase divided in the Waterfall model?

A

It is divided into Logical Design (independent of hardware/software) and Physical Design (specific to hardware/software technologies).

75
Q

What are the advantages of the Waterfall model?

A

Advantages include simplicity, ease of implementation, clearly defined phases, and effectiveness for short projects.

76
Q

How does the Waterfall model handle the Requirements phase?

A

The Requirements phase assumes all requirements are gathered upfront and involves detailed communication with the user before moving to subsequent phases.

77
Q

In which scenarios is the Waterfall model preferred?

A

Preferred for projects where safety is critical, money and time are secondary, requirements are stable, and high oversight is needed (e.g., military, healthcare, and nuclear control systems).

78
Q

What happens during the Implementation phase in the Waterfall model?

A

The actual code is written based on the project requirements and specifications.

79
Q

How does Agile methodology differ from Waterfall methodology?

A

Agile is iterative and cyclic, with continuous feedback and adjustments, while Waterfall is sequential, with tasks handled in a linear process.

79
Q

What are the advantages of Agile project management?

A

Advantages include faster feedback cycles, early problem identification, higher customer satisfaction, improved time to market, better visibility/accountability, and flexible prioritization.

79
Q

What is the focus of the Verification phase in the Waterfall model?

A

Ensuring the project meets customer expectations and includes software testing.

80
Q

What occurs during the Maintenance phase in the Waterfall model?

A

The application is in use, and changes or fixes are made as needed due to issues or changes in user requirements.

81
Q

What are the disadvantages of Agile project management?

A

Disadvantages include unclear critical path and inter-project dependencies, organizational learning curve costs, and technical dependencies for continuous deployment.

82
Q

What are the advantages of the Waterfall model?

A

Advantages include less coordination due to sequential phases, clear project phase definitions, better cost estimation post-requirements, and structured design before coding.

83
Q

When is the Waterfall model more suitable than Agile?

A

It is more suitable for projects where requirements are well-understood and stable, such as in high-risk industries like military or healthcare.

84
Q

What are the disadvantages of the Waterfall model?

A

Disadvantages include difficulty in sharing work due to phase sequences, risk of time waste during phase transitions, additional hiring for specialized teams, and potential lower product ownership and engagement.

85
Q
A
86
Q
A