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
Q

Daily standups

A

daily inspection of progress towards sprint goal

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

Backlog Grooming

A

discuss goals, reprioritize and update backlog items

27
Q

Retrospectives

A

Inspect at the end of the spring to discuss the sprint and what went well and what can be improved for next time

28
Q

Plannings

A

Kickoff for discussing what will be delivered within that sprint

29
Q

Reviews

A

Discussing what was accomplished during the sprint

30
Q

Tree Traversals

A

Preorder, Postorder, Inorder

31
Q

Preorder Traversal Algorithm

A

(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
Q

PostOrder Traversal Algorithm

A

(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
Q

InOrder Traversal Algorithm

A

(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
Q

Why use inOrder traversal?

A

Non decreasing order of a tree

35
Q

Why use postOrder traversal?

A

Useful for postfix notation for evaluating algebraic expressions quickly

Deletes the tree

36
Q

Why use preOrder traversal?

A

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
Q

public vs private class

A

public means you can access the class from anywhere, whereas private can only be accessed within its class

38
Q

Why use public class?

A

The class can be accessed from any other class within the same package

39
Q

Why use a private class?

A

If the inner functionality of a class needs to be hidden then use private

40
Q

Why use a private variable?

A

If we want the data hidden from other classes and to not be modified by other classes

41
Q

What is an immutable object?

A

An object whose contents cannot be changed once its created

42
Q

What is an immutable class

A
Example is the string class
Three conditions: all private variables 
no setter methods 
no getter methods that return a mutable object
43
Q

What are the main features of Object Oriented Programming?

A

Inheritance, Encapsulation, Polymorphism, Data Abstraction

44
Q

What is a static method?

A

A static method belongs to the class and not the object, does not need to be called by the object.

45
Q

Can a static method access non static data?

A

It cannot access non static data because its not an object

46
Q

Object vs a Class

A

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
Q

What is inheritance?

A

A feature of OOP in which classes inherit common properties from another class this helps reduce redundant code

48
Q

Limitations of inheritance?

A

Time because different classes are being referenced, modifications need to be in both child and parent classes

49
Q

What is a superclass?

A

A super class is a parent class to other classes

50
Q

What is a subclass?

A

A subclass inherits from the superclass

51
Q

What is polymorphism?

A

The ability to exist in multiple forms

52
Q

What is an interface?

A

A programming structure or syntax that forces an object to have certain properties

53
Q

Dynamic polymorphism?

A

Resolved during run time an example being method ovverriding

54
Q

What is method overriding?

A

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
Q

What is method overloading?

A

Give a method the same name as another but the arguments passed have to differ

56
Q

Overloading vs Overriding?

A

Overloading is resolved during compile time and method overriding is resolved during run time

57
Q

what is encapsulation?

A

Binding the data and the code that works on that together as a single unit, also allows for data hiding

58
Q

What is protected access modifier?

A

Can only be accessed within its own packaged and through inheritance if its outside of package

59
Q

What is a package?

A

Groups related classes together, utilizes encapsulation to group classes together

60
Q

Data abstraction?

A

Hides the unnecessary details and displays the necessary

61
Q

What is an abstract class?

A

An abstract class is a class that consists of abstract methods that are declared but not defined

62
Q

Can you create an instance of an abstract class?

A

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
Q

What is a constructor?

A

A constructor has the same name as the class and is used to create the objects of the class