Algorithms and Data Structures Flashcards

1
Q

What is a Data Structure?

A

A particular way of organizing data that allows for access and modification

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

What is an Algorithm?

A

A process of way of doing something specific

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

What is an integer datatype?

A

byte, short, int, long

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

What is a float data type?

A

float, double

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

What is a boolean data type?

A

A data type that stores only true or false values

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

What is a character data type?

A

A data type that stores single characters

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

What is a String data type?

A

Used to store a sequence of characters

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

When to use float or double?

A

When precision is important, float is less precise than double

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

What is a primitive data type?

A

A predefined datatype that always has a value

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

What is a non-primitive type?

A

Also known as a reference type because they refer to objects created by the programmer
Can be used to call methods to perform certain operations

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

What are examples of non primitive types?

A

Arrays, Strings, Classes, Interface

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

What are the two types of type casting in java?

A

Widening casting and Narrowing casting

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

What is widening casting?

A

Done automatically when converting primitive data types from smaller size type to a larger size type

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

What is narrowing casting?

A

Done manually when converting a primitive data type from a larger size type to a smaller size type

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

What is Agile?

A

A set of practices that teams can use to make decisions on how to do the work of developing software

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

Why is Agile useful?

A

Its foundational for teams to use that results in better software development

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

What are the stages of Agile?

A

Project initiation, planning, development, production, retirement

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

Project initiation

A

high level inception phase which is where team members will be identified, determine time and resources

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

Planning

A

Meet with the product owner and discuss the product backlog and begin building that

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

Development

A

Start building the first iteration of the product with the aim of finishing the end of the sprint
Develop, test and repeat

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

Production

A

Product is deployed to users

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

Retirement

A

Product is retired when a new iteration is replacing the original

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

What is a product backlog

A

The list of new features, changes to existing features, bug fixes in the form of user stories

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

What is the sprint backlog?

A

Selected items from the product backlog that are broken down into user stories for implementation during the sprint

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Daily standups
daily inspection of progress towards sprint goal
26
Backlog Grooming
discuss goals, reprioritize and update backlog items
27
Retrospectives
Inspect at the end of the spring to discuss the sprint and what went well and what can be improved for next time
28
Plannings
Kickoff for discussing what will be delivered within that sprint
29
Reviews
Discussing what was accomplished during the sprint
30
Tree Traversals
Preorder, Postorder, Inorder
31
Preorder Traversal Algorithm
(root, left, right) ``` visit the root call preorder(root.left) call preorder(root.right) ``` 1. Visit the root 2. traverse the left subtree 3. traverse the right subtree
32
PostOrder Traversal Algorithm
(left, right, root) ``` call postOrder(root.left) call postOrder(root.right) visit the root ``` 1. Traverse the left subtree 2. Traverse the right subtree 3. Visit the root
33
InOrder Traversal Algorithm
(left, root, right) ``` call postOrder(root.left) visit the root call postOrder(root.right) ``` 1. Traverse the left subtree 2. Visit the root 3. Traverse the right subtree
34
Why use inOrder traversal?
Non decreasing order of a tree
35
Why use postOrder traversal?
Useful for postfix notation for evaluating algebraic expressions quickly Deletes the tree
36
Why use preOrder traversal?
Used to copy the tree prefix notation which is important because if the same operator on many operands is planned to be used, the operator wont have to be reused continuously
37
public vs private class
public means you can access the class from anywhere, whereas private can only be accessed within its class
38
Why use public class?
The class can be accessed from any other class within the same package
39
Why use a private class?
If the inner functionality of a class needs to be hidden then use private
40
Why use a private variable?
If we want the data hidden from other classes and to not be modified by other classes
41
What is an immutable object?
An object whose contents cannot be changed once its created
42
What is an immutable class
``` Example is the string class Three conditions: all private variables no setter methods no getter methods that return a mutable object ```
43
What are the main features of Object Oriented Programming?
Inheritance, Encapsulation, Polymorphism, Data Abstraction
44
What is a static method?
A static method belongs to the class and not the object, does not need to be called by the object.
45
Can a static method access non static data?
It cannot access non static data because its not an object
46
Object vs a Class
An object is created from a class and takes up memory space, they can be declared when required A class is a blueprint for an object and represents its behavior and attributes, it does not take up memory space, and is declared one time
47
What is inheritance?
A feature of OOP in which classes inherit common properties from another class this helps reduce redundant code
48
Limitations of inheritance?
Time because different classes are being referenced, modifications need to be in both child and parent classes
49
What is a superclass?
A super class is a parent class to other classes
50
What is a subclass?
A subclass inherits from the superclass
51
What is polymorphism?
The ability to exist in multiple forms
52
What is an interface?
A programming structure or syntax that forces an object to have certain properties
53
Dynamic polymorphism?
Resolved during run time an example being method ovverriding
54
What is method overriding?
feature that allows a subclass or child class to redefine a method in the parent class , the method will have the same signature, name, arguments passed and return type
55
What is method overloading?
Give a method the same name as another but the arguments passed have to differ
56
Overloading vs Overriding?
Overloading is resolved during compile time and method overriding is resolved during run time
57
what is encapsulation?
Binding the data and the code that works on that together as a single unit, also allows for data hiding
58
What is protected access modifier?
Can only be accessed within its own packaged and through inheritance if its outside of package
59
What is a package?
Groups related classes together, utilizes encapsulation to group classes together
60
Data abstraction?
Hides the unnecessary details and displays the necessary
61
What is an abstract class?
An abstract class is a class that consists of abstract methods that are declared but not defined
62
Can you create an instance of an abstract class?
No you cannot , instances of inheriting classes can create an object of this abstract class because they have to define the abstract methods within their class
63
What is a constructor?
A constructor has the same name as the class and is used to create the objects of the class