Shared Flashcard Set

Details

Java Final Topics
Study guide questions for my Java final
12
Computer Science
Graduate
12/03/2024

Additional Computer Science Flashcards

 


 

Cards

Term
Web service and API definitions
Definition
Web service: data from a website. The client sends a URL and gets data back, usually in JSON format.

API: the protocol for how to use a web service
Term
What is Model-View-Controller? How does your Project 5 code fit in each?
Definition
-- Model-View-Controller is a software design pattern in which the frontend (e.g., HTML, CSS, JavaScript, React) is the view, the backend (e.g., Java Spring, SQL) is the model, and the controller is what links the two.

-- In Project 5, my database of CEOs, my @Entity CEO class, and my CEORepository interface are the model.

-- My React code is the view.

-- My CEOController class, which maps URLs to backend functions, along with the Axios code to fetch my backend code (via a Google Cloud web service), is the controller.
Term
What does a React component consist of? (4)
Definition
1) A function name, a body, and a return statement.

2) The body can have any computation, like variables, event handlers, and Axios.

3) The return statement is HTML code, dynamic JavaScript data from the function, and other React components, possibly from another file.

4) The React components must be capitalized and the HTML code must be lowercase.
Term
Defining persistent objects -- what classes do you define?
Definition
Define your class on the backend with the @Entity annotation. It should have data members, a constructor, and get/set methods for each data member.
Term
What does "SELECT * FROM Users" mean in SQL? How to do a filtered query, e.g., get all users with age < 30?
Definition
* is traditionally used to mean "any".
"Select any users from Users that fit this condition."

SELECT * FROM Users
WHERE age < 30
Term
super
Definition
Means "do what the parent does" and reuses parent's code. Can be used in constructors and methods.
Term
polymorphism (3)
Definition
1) The ability of an object with a certain parent type to become any child type.

2) This is achieved through method overriding.

3) The compile-time type is the parent and the runtime type is the child.
Term
Similarities between interfaces and abstract classes (2)
Definition
1) Define responsibilities for implementers or descendants

2) Cannot be instantiated
Term
Differences between interfaces and abstract classes (2)
Definition
1) Interface: only abstract, static, and default methods. Abstract class can have concrete methods.

2) Interface only has constant data members. Abstract classes can have data members.
Term
When to use an interface versus an abstract class?
Definition
Abstract classes are a blueprint for subclasses. There is an "is a" relationship. The data members and methods should be of use to the inheriting class.

Interfaces are good for when disparate classes have similar behavior in some regard. They can all implement the interface's methods, but they might implement them in completely different ways.
Term
What is n?
Definition
The size of the main data structure
Term
HashMap implementation and analysis (3)
Definition
HashMap map = new HashMap (); Hash function: loop through characters, sum of ASCII, take modulo of number of buckets O(1) put() and O(1) get()
Supporting users have an ad free experience!