Vigtige ting Flashcards

1
Q

Make a unit test like in the lecture (calculator)

A
public class CalculatorTest{

  @BeforeEach
	
  public void setup(){
	
    Calculator c = new Calculator();
		
  }
	
  @Test
  
	public void mulTest(){
  
	  private int result = c.mul(2, 2);
		assertEquals(4, result);
  
	}

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

Write the skeleton for an if-statement:

A
boolean condition = true

if (condition) {

// something happens

} else {

// something ELSE happens

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

Write the skeleton for a while-statement:

A
while (condition) {
//something happens
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Write the skeleton for a for loop-statement:

A
for (int i = 0; i < 0; i++) {
//do something 10 times
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Write the skeleton for a for each-statement:

A
String[] mylist = {"Red", "Green", "Blue"}

for (String content : mylist) {
// do something
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Can you use “==” on Strings?

A

No, you instead use
message.equals("Hello, World");

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

Create an instance of a class:

A

Super class is Car, subclass is ElectricCar:
Car myCar = new ElectricCar();

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

how to write main?

A
public class Main{
  public static void main(String[] args) {
    System.out.println("Execute program");
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the benefits of OOP?

A

Abstraction, encapsulation, inheritance and polymorphism (maybe modularity?)

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

What is polymorphism?

A

When there are one or more classes or objects related to each other by inheritance. They behave the same. One of the benefits of polymorphism.

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

How do you use super?

A

Attributes: super(name, age);

Methods: super.animalSound();

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

Write a getter and a setter:

A
public int getPrice(){
  return price;
}

public setPrice(int price){
  this.price = price;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How to make enumeration in code?

A
enum level {
LOW,
MEDIUM, 
HIGH
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Make an abstract class with an abstract method in it:

A
public abstract class Animal{
  private int age;
  public abstract move();
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Make a constructor:

A
public class Animal{
  private int age;
	private String name;
	
  public Animal(int age, String name){
    this.age = age;
    this.name = name;
  }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is static type and dynamic type?

A

Static type is known during DEVELOPMENT
Pet somePet = new Pet();
PET IS STATIC

Dynamic type is known during EXECUTION
Pet somePet = new Dog();
DOG IS DYNAMIC

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

What does instanceof do?

A

Checks whether object is an instance of the specified type

if (Pet instanceof Dog) {
  //does something
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is method overriding and method overloading?

A

Method overriding: Changes the method implementation of the super class. Keeps the same method signature (name and parameters).

Method overloading: Provides additional implementation, and changes the method signature, by having different parameters

(drive(Direction direction) and drive(Location location), the latter is the new implementation)

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

What are arrays and lists?

A

Arrays are for fixed numbers, allows speed of access.

Lists are dynamic and allows for ease of access

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

What does abstraction mean?

A

Focusing on details (necessities), leaving out unnecessary details.

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

What is encapsulation?

A

Regulates access to members from the outside. Put them in a capsule to protect them. Use visbility modifiers for this.

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

What does inheritance mean?

A

Reusing code (rather tha duplicate) and inherits from the super class (kind of polymorphism, because behaviours and traits are shared)

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

What is an interface?

A

Specifies some methods that all classes that implements the interface, should implement. All interfaces methods are abstract and public, attributes are public, static and final.

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

How to write an interface and implement it in a class?

A
interface Animal {
  public void makesound();
  public void eat();
}

public class Pig implements Animal interface {
  // implement methods now
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What is software development?

A

ITERATIVE AND INCREMENTAL

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

Give an example of a list:

A

List allRecords = new Arraylist<>();

OR

List<Elements> content;

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

Benefits of IDEs

A

Highlighting, debugging, code completion, execution

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

What terms are used when defining a Version Control Syste (VCS)?

A

Version, development line, branch, merge, tag, merge conflict

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

What is SVN (Subversion)?

A

Client-server VCS, local working copy and remote repository.
~~~
svn import
svn checkout
svn commit
svn update
~~~

import: from working copy to remote repository
checkout: from remote repository to working copy
commit: from working copy to remote repository
update: from remote repository to working copy

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

Characteristics of SVN:

A

Checks out only PARTS of the project
Renames counts as a totally new file
Not that great for non-linear workflow

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

What is Git?

A

Distributed VCS, working copy, local repository and remote repository

git init
git clone
(git add)
git commit
git push
git pull

init: initialises from the working copy to the local repository
clone: clones from the remote repository to local repository and then working copy
commit: commits from working copy to local repository
push: pushes changes from local repository to remote repository
pull: pulls from remote repository to local repository and then working copy

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

How many releases are there?

A

Long term support: old versions, too costly to implement new version for whole firm
Stable: the current version, most people use this
Pre-release: beta, alpha, contains newest features (not tested properly)

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

What is Hadoop and Spark?

A

Both are tools used in parallel data processing.

  • Hadoop uses HDFS (Hadoop distributed file system), HiveQL
  • Spark uses RAM (therefore more expensive) SparkSQL
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

Name the data storage tools

A

Apache HBase
Apache Phoenix
Druid
Cassandra

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

Name the data calculation tools

A

Apache Pig
Apache Kafka
Apache Samza

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

Name the data query tools

A

Apache Hive
Apache Drill

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

Name the coordination tools

A

Apache Zookeeper

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

Name the machine learning tools

A

Apache Mahout
ML4J
dl4j
WEKA

39
Q

Why is software engineering difficult?

A
  • Complexity
  • Conformity
  • Changeability
  • Invisibility
40
Q

Outline software engineering

A
  • Modeling activity
  • Problem solving activity
  • Knowledge acquisition activity
  • Rationale management actvitity
41
Q

Describe the process of problem solving activity in software engineering

A
  • Formulate the problem
  • Analyse the problem
  • Search for solutions
  • Decide on appropriate solution
  • Specify the solution
42
Q

Stages in Object Oriented Software Development (OOSD)

A
  1. Requirment elicitation
  2. Analysis
  3. System design
  4. Object design
  5. Implementation
  6. Testing
43
Q

What does rationale management activity entail?

A

That the problem domain eventually stabilises

That the solution domain will constantly change

How can we reason a decision taken in the past

44
Q

What activities are common to all software processes (LIFECYCLE)?

A
  • Software specification
  • Software development
  • Software validation
  • Software evolution
45
Q

What is the spiral model?

A

An iterative and incremental model. It wants to reduce risk.
Steps:
1. Determine objectives,
2. Identify risks
3. Development and test
4. Plan next iteration

46
Q

What is the Waterfall model (not Barry’s version)?

A

Strict sequence phase model. When a milestone is complete you can move onto the phase. Possibility for feedback, but only through neighbouring phases.

Drawback: Difficult to accommodate changes

47
Q

What is the agile method process?

A

Combination of iterative and incremental methods. Smaller iterations (sprints), delivers work in increments

48
Q

When do you use change avoidance and change tolerance?

A

In the context of reducing the cost of rework

49
Q

Benefits and drawbacks of agile processes?

A

Benefits:
- Incremental and iterative process

Drawbacks:
- keeping the customers interested
- Team members may not be suited for the agile methods

50
Q

What is the V-model?

A

It’s a model good for management and tight controlling

Benefits: Integrates quality assurance

Drawbacks: Rigid, bad for requirement changing. Not suitable for software engineers

51
Q

Name 3 good practices of Extreme Programming (XP).

A
  • Pair programming
  • Simple design
  • Test-first development
  • Refactoring
52
Q

Mention 3 principles of Agile software development

A
  • Collaboration
  • Motivation
  • Communication
53
Q

Characteristics of Scrum

A

Scrum team:
- Product owner
- Developers
- Scrum master

Product backlog, sprint, sprint planning, sprint backlog, daily scrum, increment, sprint review, sprint retrospective

54
Q

Drawbacks of Scrum and XP?

A

Scrum:
Pretend to do scrum, but does the waterfall model. Bad for large systems

XP:
Programmers take shortcuts when testing, test-first development is a rigorous process

55
Q

What is verification and validation?

A

Verification: Are we building the product right?
Validation: Are we building the right product?

56
Q

How do we deal with faults?

A

Fault avoidance
Fault detection
Faul tolerance

57
Q

What is fault, erroneous state and failure?

A

Fault: bug
Erroneous state: Further processing leads to failure
Failure: Deviation of observed behaviour from specified behaviour

58
Q

What is black box testing and white box testing?

A

Black box: Tests software without knowing the source code (internal structure).
Focuses on I/O behaviour. The goal is to reduce the number of tests using equivalence classes

White box: Tests the software WHILE knowing the source code (internal strcuture)
Focuses on software working correctly. The goal is to ensure everything is tested

59
Q

What does all the coverages do?

A

Statement coverage (C_0): Executes every statement at least once
Branch coverage (C_1): Executes every branch at least once
Path coverage (C_2): Executes every path at least once

WHITE BOX TESTING

60
Q

How to deal with faults, erroneous states and failures?

A
  • Patching
  • Declaring the bug as a feature
  • Modular redundancy
  • Testing (shows only presence of bugs, not absence)
61
Q

Mention the integration tests

A
  • Big bang
  • bottom up (no stubs, needs drivers)
  • top down (no drivers, needs stubs)
62
Q

What are functional and non-functional requirements?

A

Functional requirements: How the system should behave on smaller features
Non-functional requirements: Constraints and properties. Applies to the system as a whole rather than individual features
(reliability, size, speed, ease of use, robustness, security, response time, portability)

63
Q

What are the 3 non-functional requirements in the tree?

A

Product requirement, organisational requirement, external requirement

64
Q

What are the requirement validations?

A
  • Complete
  • Consistent
  • Clear
  • Correct
65
Q

What is the requirement process?

A

Requirement elicitation (understood by user) and analysis (understood by developer)

66
Q

FURPS+ model

A

FURPS:
- Functionalit
- Usability
- Reliability
- Performance
- Supportability

+:
- Implementation

67
Q

What are some requirement elicitation techniques?

A
  • Document analysis
  • prototyping
  • questionnaire
  • interview
  • focus group
  • oberservation
68
Q

How do we manage requirement specifications?

A
  • Negotiating the requirements with clients
  • Maintaining tracebility
  • Document the requirments
69
Q

What are the 3 C’s of user stories?

A
  • Card
  • Conversation
  • Confirmation
70
Q

What is the product backlog?

A

Prioritise items. Pull of items, other items move up.
Theme: collection of RELATED user stories
Epic/saga: a larger user story (long rectangle)

71
Q

What are the relevant steps of modeling in software development

A
  • Analysis
  • System design
  • Detailed design
  • Implementation
  • Quality assurance
  • Maintenance
72
Q

Name everything in UML class diagram

A
  • Association
  • Aggregation
  • Composition
  • Association class
  • Association name
  • Role
  • Attribute
  • Class
  • Method
  • Multiplicity
  • Comment
  • Interface
  • Enumeration
  • Implements
  • Generalisation
  • Class members
73
Q

Name everything in UML object diagram

A
  • Object (can be anonymous)
  • Attributes (if relevant)
  • Associations
74
Q

Name everything in UML deployment diagram

A
  • Node
  • Artifacts
  • Stereotype
  • Communication path
  • Nested nodes
  • Titles (object)
75
Q

Difference between UML and Java (protected visbility, inheritance, association type, association classes)

A

Protected visbility: Visible only for class and subclasses
Inheritance: Multiple
Association types: Association, Aggregation, Composition
Association classes: Directly supported

Java:
Protected visbility: Visible for class, subclasses
and same package
Inheritance: Single
Association type: Reference
Association class: Need to be emulated

76
Q

Name everything in UML activity diagram

A
  • Action
  • Transition
  • Initial node
  • Final node
  • Decision
  • Guards
  • Fork
  • Join
  • Swim lanes
77
Q

Name everything in UML state machine diagram

A
  • State
  • Initial node
  • Final node
  • Transition
  • Decision
  • Trigger
  • Guards
  • Action
78
Q

Name everything in UML sequence diagram

A
  • Lifeline (write as object)
  • Activation box
  • Nested activation box
  • Synchronous message
  • Asynchronous message
  • Return message
  • Termination
79
Q

What can UML be used for?

A
  • Sketch
  • Blueprint
  • Development language
80
Q

What are the symptoms of bad software?

A
  • Confusing
  • Rigid
  • Fragile
  • Immobility (no reuseability)

(common problems in software is spaghetti code, coupling and dependencies)

81
Q

Explain coupling and cohesion?

A

Coupling: Interdependency between components (low coupling is good)
Cohesion: How related a class is (high cohesion is good)

82
Q

Name the SOLID principles and a short description

A

Single responsibility principle: “a class should only have one, and only one, reason
to change”.
Open/closed principle: “software entities should be open for extensions but closed
for modifications”. (Bertrand Meyer 1988)
Liskov substitution principle: “derived classes should be usable through the base
class interface, without the need for the user to know the difference”. (Barbara Liskov 1987)
Interface segregation principle: “many client-specific interfaces are better than
one general-purpose interface”.
Dependency inversion principle: “depend upon abstractions, do not depend upon concretions”.

83
Q

What to look for in code to see if a SOLID principle has been broken?

A

S = A class has too many responsibilities
O = You can’t extend a class
L = A subclass is not able to behave the same as the super class
I = There’s not enough interfaces
D = When in the code we can see it depends on concretions rather than abstractions

84
Q

What are design patterns?

A

Best practices and good design. Capture experience so others can use it.

85
Q

What does software architecture consist of?

A

Non-functional requirements

86
Q

What is layered architecture and name the 4 layers

A

Models interface of sub-systems. Organise into a set of layers. A changed layer will only affect the adjacent layers.

  • User interface
  • User interface management
  • Business logic
  • System support
87
Q

Architectural design is a creative process, some other connected concepts are:

A

Architectural styles: high-level abstractions, guiding the overall organisation of a system
(client/server, pipes and filters)

Architectural patterns: detailed solutions to recurring architectural problems within a specific style.
(model-view-controller)

Design patterns: specific solutions to recurring design problems at a lower level than architectural patterns
(adapter, compososite)

88
Q

What are pipes and filters?

A

A way to process/produce data. Workflow matches the structure of business processes. Not suitable for interactive systems
Filters: Processing component
Pipes: Transitions, pipeline

89
Q

What is Model-View-Controller (MVC)?

A

Supports presentation of data in different ways. Can be complex. Structured into 3 main components that:
- Models the data
- Views the data
- Controls the data

90
Q

Mention 4 design patterns and describe them shortly

A

Adapter (structural): Adapts a class that doesn’t fit the expected interface, to then fit in (object adapter and object adapter)
Composite (structural): Treats simple and complex objects as the same (recursive tree structure)
Strategy (behavioural): Groups family of algorithms together, separate classes, interchangeable
Observer (behavioural): Set of objects “observerving” the state of an object. Notifies the objects of changes and updates them

91
Q

How to find out what the design pattern is in UML

A

Adapter: Look for class that acts as a bridge for another class to fit into the expected interface (superclass) (adapter has the aggregation, points towards the different interface)
Composite: Recursion!!!! Looks like a normal subclass (generalisation), but with an aggregation on the composite to the super class
Strategy: When there’s grouped classes that points to an interface (generalisation), which points to the super class (aggregation on the superclass points towards the interface)
Observer: Observer looks like strategy, but we will assume it says observer in the class name to see the difference (look for notify as well)

92
Q

How to make an aggregation/composition in code?

A

Wherever the diamond is, is where we will declare a class. The direction it’s pointing, is the name of the list, and the content is whatever is on the association line.
~~~
public class ResourceElement {
private List<Element> content;
//...
}
~~~</Element>

93
Q

How to write methods from UML into code:
~~~
+ getPrice() : double
+ getPrice(d : double)
~~~

A
public double getPrice();
public getPrice(double d);