Week 10 Cumulative (v2)

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Explain the different kinds of loops you can create and use in a program.

For loop - executes some number of times based on whether a condition is true or not. The condition is checked on each iteration. An iterator is also updated on each iteration. There may be some iterator that is kept track of and used in the body of the loop to manipulate elements. While loop - executes as long as some condition is true. The condition is checked on each iteration of the loop. The condition is checked at the beginning, before any code is executed, if that condition is false, the while loop is skipped entirely. Do-while loop - much like a while loop but the code is executed at least once Enhanced for loop - also known as the for-each loop, provides a simplified way to iterate over arrays and collections in Java. It eliminates the need for explicit indexing, making code cleaner and less error-prone.

What are common HTTP verbs used when a client application is making a request?

GET - Get a resource on the server POST - Create a resource on the server DELETE - Remove a resource from the server; it is meant to be idempotent PATCH - Update a resource on the server (does not replace a resource) PUT - Replaces a resource on the server if it exists, creates one otherwise. It is differentiated from POST in that it's meant to be idempotent (meaning that several identical requests should produce identical results)

What is HTTP? Why is it important to know about?

HTTP stand for hypertext transfer protocol, it the protocol that dictates the transmission of data on the internet. It's important to know about if you want to understand how data gets around on the internet

What do a pair of opening and closing curly braces represent?

In Java, a pair of opening and closing curly braces { } represents a block of code or a scope. Curly braces are crucial for defining where code blocks begin and end, determining variable scope and lifetime, and providing structure to Java programs. Variables declared within a set of braces are typically only accessible within that scope.

What is a function in SQL?

In SQL, a function is a prewritten routine that accepts parameters, performs an operation, and returns a result

What is the JDBC API and the benefits of using it?

JDBC stands for Java Database Connectivity and it is a low level Java API that provides SQL functionality. Interfaces like Statement, CallableStatement, and PreparedStatement are implemented by some RDMS for use in application code. Some benefits include database independence, the preparedstatement interface, industry standard, and a standardized API.

What is JSON? When would we work with JSON in our application?

JSON stands for JavaScript Object Notation. It is a lightweight, language independent data -interchange format that stores data as lists of key value pairs. JSON is easy to read and write as humans, it's easy for computers to parse and it's lightweight as mentioned above

What is the difference between the JDK, JRE, and JVM?

JVM - Java Virtual Machine, responsible for executing bytecode after the java compiler converts the source code. Enables Java's Write Once Run Anywhere philosophy. JRE - Java Runtime Environment, a collection of libraries that enables Java programs to be run. Typically includes the JVM. JDK - Includes the JRE and additional libraries for use by developers and a suite of development tools like the Java debugger also for use by developers

Describe Javalin.

Javalin is a lightweight web framework for Java and Kotlin designed for building REST APIs and microservices

What is the difference between a join and a set operation?

Joins operate on columns, set operations happen between queries

What is logging and what are the benefits of it?

Logging is a software development practice where information about the processes/metrics of an application are saved for potential future use. Some uses: Debugging Performance monitoring Compliance Business Intelligence

What is Maven? Why would we use it?

Maven is a build automation and dependency management tool. We use it because it makes development easier by: Handling dependencies - downloads and manages all your project dependencies based on your configuration Build Lifecycle Management - Maven offers a well-defined build process with phases like compile, test, package, install, and deploy, simplifying complex build workflows Standardized Project Structure - Maven enforces a consistent project layout, making it easier for developers to understand different projects following the same conventions.

What is the difference in syntax between calling a method and creating a method?

Methods are typically called using dot notation where the name of an object is specified, the name of the method follow, and then its parameters are included in parentheses. Methods are created by creating their method signature (a combination of access modifier, return type, name, and list of parameters) and a set of curly braces that contain the method body

What is Mockito and why would we use it?

Mockito is an open-source java framework that allows developers to create mock objects and integrate them into tests for their applications. Here are some things that Mockito is good for: Mocks: Dummy implementations that simulate real objects Stubs: Predefined responses to method calls Verification: Confirmation that expected interactions occurred

What is a mock?

Mocks indeed simulate the behavior of services or components and allow verification of interactions. They are more sophisticated than stubs because they not only provide predetermined responses but also record and verify method calls

Why would you use an interface over an abstract class?

Multiple Inheritance Future Flexibility (easier to implement new interface than change inheritance hierarchy) Loose coupling (classes are merely told what they must implement, not how to implement)

What is multiplicity?

Multiplicity defines the number of instances that can participate in a relationship between entities or classes. The three general classifications of multiplicity are *one-to-one, one-to-many, and many-to-many*.

What are some states a thread can be in?

NEW - A thread that has not yet started is in this state. RUNNABLEA thread executing in the Java virtual machine is in this state. BLOCKED - A thread that is blocked waiting for a monitor lock is in this state. WAITING - A thread that is waiting indefinitely for another thread to perform a particular action is in this state. TIMED_WAITING - A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state. TERMINATED - A thread that has exited is in this state.

What is referential integrity?

Referential integrity means that the foreign key in any referencing table must always refer to a valid row in the referenced table. Referential integrity ensures that the relationship between two tables remains synchronized during updates and deletes.

What is a RDBMS?

Relational Data Base Management Systems (RDBMS) are database management systems that maintain data records and indices in tables. Relationships may be created and maintained across and among the data and tables.

What are the SOLID design principles and are they important?

S - Single Responsibility Principle: A class should have only one reason to change, meaning it should have only one job or responsibility. O - Open/Closed Principle: Software entities should be open for extension but closed for modification, allowing behavior to be extended without altering the source code. L - Liskov Substitution Principle: Objects of a superclass should be replaceable with objects of its subclasses without affecting the correctness of the program. I - Interface Segregation Principle: No client should be forced to depend on methods it does not use, favoring multiple specific interfaces over one general-purpose interface. D - Dependency Inversion Principle: High-level modules should not depend on low-level modules; both should depend on abstractions. Abstractions should not depend on details; details should depend on abstractions.

What are some operators that can be used in SQL?

SQL can use comparison and arithmetic operators in SQL statements (=, <, >, <=, >=, !=) and (+,-,*,/,%).

What are the major differences between a List, Queue, Set, and Map?

Set: Enforces unique elements Generally unordered No index-based access Map: associates a key of some type with a value of some type. Generally unordered Keys must be unique, values can contain duplicates Queue: Typically ordered (FIFO, LIFO) Duplicates allowed Element insertion at the beginning and removal from the end List: Maintains insertion order Duplicates allowed Elements are accessed via their position (index) Only Map doesn't implement the Collection interface directly Only Set guarantees uniqueness of all elements Only List provides guaranteed order and index-based access Only Queue is optimized for ordered processing (typically FIFO)

What is the difference between source code and bytecode?

Source code refers to the human-readable text instructions written by developers in a programming language (like Java). Bytecode is an intermediate representation of the program that's generated when source code is compiled. In Java, the compiler (javac) transforms .java files into .class files containing bytecode

What is SQL and why would we use this language?

Structured Query Language or SQL is the standard language for working with RDBM systems. SQL is used to administer and manipulate SQL servers. SQL is used to, Define database structure, Manipulate stored data, Define data access permissions, Control concurrent data access, Query stored data.

What is synchronization?

Synchronization is a mechanism that ensures that only one thread accesses a shared resources at a time. For example, there might be a database and several threads that need to write to it. We can ensure that database isn't put into an inconsistent state by giving different threads a lock on the database when it's safe for them to execute their task.

How can we implement multithreading in Java?

TBD

What is test driven development?

TDD is a philosophy of development in which developers write tests that their code must pass before writing the code. This ensures that the code fulfills requirements, and its expected behavior is well-defined

Describe the different logging levels and how they should be used.

TRACE: Very detailed information, typically useful only for diagnosing problems DEBUG: Detailed information on application flow INFO: Confirmation that things are working as expected WARN: Indication of something unexpected that isn't necessarily an error ERROR: Error events that might still allow the application to continue FATAL: Severe errors that cause the application to abort

What are terminal stream operations?

Terminal stream operations are operations that trigger the processing of the preceding operations and consumes the stream

What is the Optional class?

The Optional class (java.util.Optional) was introduced in Java 8 as a container object that may or may not contain a non-null value. It's designed to provide a more elegant solution to the common problem of null handling and NullPointerExceptions.

What is the Stream API and what is it used for?

The Stream API, introduced in Java 8, is a powerful feature for processing sequences of elements. It provides a functional approach to manipulating collections of data. The Stream API is used for: Processing sequences of elements from various sources (collections, arrays, I/O channels) Applying functional-style operations on these elements Performing aggregate operations like filtering, mapping, reducing, and collecting Supporting parallel execution for better performance on multi-core processors Enabling lazy evaluation where operations are only performed when needed Providing a pipeline of operations that process data in a declarative way

What is the difference between linear search and binary search?

The difference between these methods is in how the next element to consider is determined. Linear search simply goes in some order and follows that order, potentially visiting all elements, until the desired element is found. Binary search assumes that the set of elements itself is ordered in some way and uses that to continuously bisect the search space until the desired element is found. For finding a target in a sorted number list: Linear search: Check each number sequentially until finding the target Binary search: Compare with the middle element, then search only in the lower or upper half based on that comparison, repeating until finding the target

What is the purpose of using getter and setter methods

The purpose of getter and setter methods are to expose some way of accessing class members in a way that guarantees that the use of these class members is consistent with designer's intention. For example, rather than allowing direct access to a balance field in a BankAccount class, a setter can ensure deposits are positive values, and a getter might format the value or perform currency conversions.

What is the Reflection API and what is it used for?

The reflection API provides developers with functionality to access and use metadata about their code

What are intermediate stream operations?

These are operations that transform a stream into another stream, they are performed before the terminal operation

What is the ORDER BY clause used for?

This clause lets you choose the sorted order of rows in the result set based on the values of one or more columns

What is the Collection API?

This is a unified architecture for representing groups of objects. It defines interfaces, classes, and algorithms

What information would you need in order to successfully connect to a database?

To connect to a database you need the URI, a username, and a password

What is TCL?

Transaction Control Language manages sequences of commands as blocks where all of the commands run or, none run.

Why are unit tests important?

Unit testing helps testers and developers understand the root causes of errors. Unit testing helps with documentation. Unit testing fixes defects early in the development phase. Unit testing helps with code reusability.

What are some best practices for naming resource URLs using REST?

Use nouns for resources, not verbs Good: /articles, /users Avoid: /getArticles, /createUser Use plural nouns for collections Good: /customers, /orders Avoid: /customer, /order Use concrete names over abstract concepts Good: /tickets, /messages Avoid: /items, /entities Use resource hierarchies for relationships Good: /customers/5/orders, /orders/3/items Avoid: /customerOrders?customerId=5 Keep URLs reasonably short and readable Good: /users/42/posts Avoid: /application-data/user-management/user-generated-content/42 Use query parameters for filtering, sorting, and pagination Good: /products?category=electronics&sort=price Avoid: /electronics-products-sorted-by-price

How would we configure logging in an application?

We might choose a logging framework. In our case it would most likely be Logback. Then we would define some log levels or use the ones already provided by the framework, determine where the logs should be stored or output, and determine their format.

What is SQL Injection and how can we prevent it using the JDBC?

When a vulnerable input field is fed malicious SQL code giving unauthorized parties potentially wide-ranging access to the database

How can JUnit annotations help with running our tests?

With JUnit annotations you can specify which methods are tests, what actions should be taken before all tests, before each test, after each test, and after all tests. They let you focus on writing the test rather than the organizational concerns you might be faced with otherwise.

What are the main sections of a Git project?

Working Directory - The area where you make changes to your files before committing Staging Area (Index) - Where you prepare changes to be committed using "git add" Local Repository - Contains all committed changes and project history stored in the .git directory

When would you use an Agile methodology versus Waterfall?

You would use Agile when rapid iteration and a user feedback loop are appropriate for your project. You would use Waterfall when your project must be as complete as possible on it's first iteration and where failures are to be mitigated as much as possible.

Why would I use the WHERE clause?

You would use the where clause if you need to filter your result set based on some condition. For example, let's say I have a table of hospital patients. I would like to find all the patients in the hospital admitted becauase of chest pain. The statement I would construct looks like this: select * from patients where reason_admitted = 'chest pain';

What is a lambda? Give an example of how we can use one.

a concise way to represent an anonymous function - a function without a name that can be passed around as data. You might use a lambda to define a function that sorts strings by length: Collections.sort(names, (s1, s2) -> s1.length() - s2.length()); This function implements the Comparator interface's abstract method and passes it into Collections.sort in a concise and easy to read manner

What is an algorithm?

a set of well-defined steps for performing a task or solving a problem

What are some common operations you would be performing when using Git?

git add - adds a file(s) to the stating area git status - gives the status (with respect to git) of all files in the working directory git commit - commit the changes you've made to your files git push - upload your changes to some remote repository git branch - create a branch git checkout - change branches

How can we create a thread?

implementing runnable Create a thread object and pass a lambda to its constructor that defines the thread's behavior Extend the Thread class

What are some common Linux commands? Why are they useful?

pwd - prints the directory you are currently working in cat - displays the content of a file to your terminal nano - opens a minimal text editor in your terminal ls - lists the files in your current directory cd - changes your directory to some other directory These commands are useful because they are shorthand ways of doing something that might take many clicks in a regular GUI. They may also be used in scripts to enable automation.

Describe what a join is and explain the different types of joins we can create.

A JOIN operation is used when you want to combine columns from different tables based on a related column For example, let's say you gave two tables, one for Employees of company X and one for Departments in company X. You could write a query like select * from employees join departments on employees.department_id = departments.department_id

What is the difference between a Simple and Prepared JDBC statement?

A Simple Statement lets you execute static SQL, it is not parameterized. A Prepared Statement lets you execute a parameterized SQL statement. It also caches the execution plan so that performance on repeat executions is improved. Prepared Statements help protect against SQL injection since it separates the logic of the SQL statement from the data being fed into it. This allows you to do data sanitation and validation before executing any SQL.

What is a Collection?

A collection represents a group of objects. It is the root of the collection interface hierarchy

What is a conditional statement?

A conditional statement allows you to execute a block of code based on whether a condition is true or not. Some types of conditional statements include if, if-else, if-else-if, and switch An example of this would be if (user.getAge() < 18){ System.out.println("You're too young to play this game, come back in" + (18 - user.getAge()) + "years") System.exit(1); }

What is the Singleton design pattern?

A design pattern that ensures only one instance of a class exists and provides a global access point to that instance. An example of this would be a logger. A new instance of the logger does not need to be created every time an event needs to be logged, instead a single instance of the logger can be passed around and invoked when needed.

What is the Factory design pattern?

A factory design pattern is where an interface, called the factory, handles the creation of objects without showing the implementation or logic. It can utilize parameters to create many different kinds of objects as well. (e.g. a ShapeFactory class can contain a getShape method, which will return a new shape object based on the parameters passed into the getShape method.)

What is a foreign key?

A foreign key is a column or group of columns in one table that refers to the primary key of another table

What is a functional interface and why would we use one?

A functional interface is an interface that contains exactly one abstract method that must be implemented. They allow us to: Write more concise code using lambda expressions instead of anonymous classes Create function-like objects that can be passed around as parameters Enable functional programming paradigms within Java Make code more readable and maintainable

What is a handler?

A handler is a specialized function or object designed to respond to specific events or requests in an application. This is usually referring to functions used to handle specific incoming HTTP requests in our projects so far.

Describe a linked list.

A linked list is a linear data structure where elements are stored in nodes, and each node contains both data and a reference (or link) to the next node in the sequence.

What is a method?

A more complete definition would explain methods as named blocks of code that perform specific tasks, can accept parameters, return values, and help organize code into logical, reusable units

What is a primitive datatype? Please list a few and explain them.

A primitive data type is a representation of simple data in Java. Some examples include: int - a 32 bit signed integer double - a 64 bit signed double precision floating point number float - a 32 bit, single precision floating point number char - represents a 16 bit Unicode character, is actually an integer under the hood that maps to a Unicode character according to Unicode convention boolean - represents a truth value, either true or false short - a 16 bit signed integer long - a 64 bit signed integer byte - an 8 bit signed integer

What is a stored procedure in SQL?

A stored procedure stores SQL as subroutines inside a relational database, enabling flow control, iteration over a result set, and requires elevated privileges for creation and maintenance.

What is source control management? Why is it useful?

A system that tracks changes to files over time, allowing multiple people to collaborate on projects while maintaining a history of modifications Why it's useful: Prevents accidental overwrites or loss of work Creates an audit trail of who changed what and when Enables experimentation without risking project stability Facilitates coordinated teamwork across different locations Serves as a backup system for code and project assets

What is a thread?

A thread is a software construct that allows developers to enact concurrency in their applications. It allows simultaneous execution of different tasks in an application.

What is a transaction?

A transaction is a group of SQL statements that are executed together and either all succeed or fail

What is a trigger in SQL?

A trigger in SQL is a special type of stored procedure that automatically executes when a specified database event occurs For example, let's say you have a database that stores bank account information. Let's say that a withdrawal of an amount more than what's in the bank account. There might be a trigger that automatically applies an overdraft fee to that account.

What is a variable?

A variable is a named reference to some location in memory. In the case of Java, primitives haves their values directly stored in variables while objects have their references stored in variables.

What is a view and why is it useful?

A view is a named SQL query whose internal representation is a virtual table. This query can be called by the name given in any other query

What is an index in SQL?

An SQL index is a database structure that improves the speed of data retrieval operations on database tables. It works similarly to an index in a book, allowing the database engine to find data without scanning the entire table.

What is the difference between an aggregate and a scalar function?

An aggregate function take many inputs (operate on many rows at once) and gives a singular output. A scalar function takes 1 input and gives you 1 output (They operate on each row independently).

What is an endpoint?

An endpoint is a specific URL or URI that serves as a point of connection between different software systems, allowing them to communicate with each other. In web development and API design, endpoints are essentially the "doors" through which clients can access specific functionality or resources provided by a server.

Describe encapsulation and how would you use it in a project?

Encapsulation is the bundling of data and behavior. An example where this might be useful in a project is creating a User class that contains all the user data like a username, password, email, etc. You might also include some methods that act on that data like updateEmail or mutators.

What is the SDLC? Why is it important?

- The Software Development Life Cycle (SDLC) is the application of standard business practices to building software applications. - It's typically divided into six to eight steps: Planning, Requirements, Design, Build, Document, Test, Deploy, Maintain. - Some project managers will combine, split, or omit steps, depending on the project's scope.

Describe the Producer Consumer problem.

- a producer must wait until the buffer has space before it can put something in - a consumer must wait until something is in the buffer before it can take something out problem: make sure that the producer won't try to add data into the buffer if it's full and the consumer won't try to remove data from an empty buffer

What are some common HTTP status codes that can be included in a response?

1xx - informational response 2xx - successful response 3xx - more info needed from the client, a redirect 4xx - client error 5xx - sever error

What are the properties of a transaction?

ACID Atomicity - Either all actions succeed or fail Consistency - All actions must be consistent with the constraints of the database. For example, let's say you have a database that stores the details of user accounts on some social media website. The email is required to be unique and non-null. If I try to insert a record that inserts a null value into the email field, the database should reject that action because it is not consistent with the constraint that emails be non-null. Isolation - If there are concurrent transactions taking place, they should resolve as if they were executed sequentially. For example, let's say you have a database with user information like passwords, emails, usernames, card info, billing address etc. Transaction 1: Rep A is updating the customer's shipping address to "123 Main St" Transaction 2: Rep B is updating the customer's email address to "[email protected]" Transaction 1 reads customer record: {address: "456 Oak Ave", email: "[email protected]"} Transaction 2 reads customer record: {address: "456 Oak Ave", email: "[email protected]"} Transaction 1 updates the address field to "123 Main St" Transaction 2 updates the email field to "[email protected]" Transaction 1 writes the entire record: {address: "123 Main St", email: "[email protected]"} Transaction 2 writes the entire record: {address: "456 Oak Ave", email: "[email protected]"} Result: The final record is {address: "456 Oak Ave", email: "[email protected]"} - the address update from Transaction 1 was lost! Durability - Once a transaction is committed, it stays committed and that commit should persist through system failures like: Power outages System crashes Hardware failures Network interruptions

Describe abstraction and how would you use it in a project?

Abstraction is the creation of simplified interfaces that we interact that provide almost the same effect without having to deal with all the details of the underlying system. An example of abstraction that might be useful in a project is the DAO design pattern. Instead of having your services rely on database implementation directly, instead have them rely on and interact with this simpler interface instead.

What is the difference between Bubble Sort and Merge Sort?

Bubble sort repeatedly compares and swaps adjacent elements, while merge sort divides the list into smaller sublists, sorts them, and then efficiently combines them back together.

What is REST and what are its key constraints?

Client-Server: Separation of interface from data storage Statelessness: Each request contains all needed information Cacheability: Responses must declare if they're cacheable Uniform Interface: Standardized resource identification and manipulation Layered System: Component hierarchy invisible to clients Code on Demand (optional): Servers can send executable code to clients

What are constraints and can you describe a few constraints?

Constraints limit what can be put into a table or column. Some constraints include: UNIQUE - no value in this column may be a duplicate NOT NULL - no value in this column may be null Primary Key - this column must be not null and unique as it uniquely identifies each row Check - ensures all values in a column satisfy a specific condition

Explain the main method.

Definition: The main method is the primary location where code begins executing for a Java program. Typically when you execute a java program the main method is called and all other methods and actions originate from the main method. Real World Example: public static void main(String[] args){System.out.println("Hello, World!");}

How would you describe time complexity?

Describes the worst, best, and average case amount of time an algorithm takes to run depending on algorithm's input size

What is the DAO Design Pattern and why should we use it?

DAO stands for Data Access Object, and it is a design pattern where a layer of abstraction is put between services and database access/persistence. Services interact with the DAO and the DAO interacts with the database. We should use it because it provides a common interface for dealing with your database, it prevents boilerplate code, it enhances readability, it decouples services from the underlying database technology.

What are the SQL sublanguages and their purpose?

DML - Data Manipulation Language, this sublanguage is used to manipulate data in the database. Some manipulations include inserting data, deleting data, updating data etc. DDL - Data Definition Language, this sublanguage is used to define the structure and constraints of the database DQL - Data Query Language, this sublanguage is used to retrieve data from the database and perform various aggregation and functional operations on said data TCL - Transaction Control Language, this sublanguage is used to manage transactions in the database, including committing changes, rolling back changes, and setting savepoints DCL - Data Control Language, this sublanguage defines data access permissions

What is DCL?

Data Control Language: GRANT and REVOKE. Controls permissions to manipulate the database.

What is normalization?

Database normalization is a technique for organizing data in a database to reduce redundancy and improve data integrity. It's a process of structuring a relational database according to a series of "normal forms" to minimize data duplication and eliminate undesirable characteristics like insertion, update, and deletion anomalies.

What is the difference between deadlock and livelock?

Deadlock - Two or more processes are permanently blocked, each waiting for resources held by the others. In this state, processes are completely stuck and cannot proceed. Livelock - Processes are actively changing state relative to one another22222 but still not making meaningful progress toward completion. The primary difference is that in deadlock, processes are completely frozen, while in livelock, processes continue to execute but make no progress toward their goals. An example of both: Deadlock: Thread 1 holds a lock on resource 1 but wants to acquire resource 2. Thread 2 holds a lock on resource 2 but wants to acquire resource 1. Both threads are waiting for a resource held the other. Neither thread can make progress. Livelock: Two people are walking down a hallway, both move to the same side to let the other pass, they then move to the other side to let the other pass. Repeat ad infinitum

What is the difference between assigning and declaring a variable?

Declaring a variable simply indicates its type and name. Assigning it gives it a value or something to point to.

Describe the POM.xml file and its importance.

Define: POM stands for Project Object Model and POM files hold the meta data about dependencies, project location, and plugins. Why is It Important: POM files are important because without the meta data they contain Maven would not be able to properly handle the dependencies between different files. POMs also standardize builds, enable project inheritance, and facilitate multi-module projects.

Describe relational database tables.

Define: a table is a RDB object that stores and organizes data in columns(Attribute), rows(TUPLE) and constraints, where each row is a single data instance, each column represents and aspect of the data like name or id number, and constraints limit what can be put into the table or column.

Give me an example of how you would test a method that takes in two integers as input and returns an integer representing the sum.

I might use a testing framework like JUnit. I would create a class and, in that class, I would have a few functions that test the behavior of that method. One test might be sumTestPostiveNumbers. I would have one variable to contain the expected result and one variable that contains the actual result when this sum method is called. I might use the Assert.assertEquals() method to find out if these two results match each other. This particular case would just add 2 and 3 to get 5. I might define another method that tests the sum method's behavior with negative numbers. sumTestNegativeNumbers would be the same as the previous test with the exception that the signs are flipped. So -2, -3, -5 instead of their positive counterparts. I might also define a method where the signs are not the same. sumTestDifferentSignedNumbers would be the same as the previous test except one number would be positive and the other would be negative. the expected value would also change depending on the order of the addends so those two scenarios might be different assertion statements but in the same test.

What are the four levels of access we can give to class members? How are they different from one another?

Private Accessible only within the class where declared Cannot be accessed from subclasses or other classes Used for internal implementation details Default (Package-Private) No explicit modifier keyword (absence of modifier) Accessible to all classes in the same package Not accessible from different packages Protected Accessible within the declaring class Accessible to subclasses (even in different packages) Accessible to classes in the same package Balances inheritance with encapsulation Public Least restrictive access level Accessible from anywhere in the application Forms the class's external API Should be used carefully to maintain encapsulation

What is the GROUP BY clause used for?

The group by clause divides rows into groups based on what values they have in specific columns. For instance, a query like: SELECT department, job_title, AVG(salary) as avg_salary FROM employees GROUP BY department, job_title; Might return a result set where each row is the combination of some department and some title and the average for that combination across every person that fits that combination. So one row might be: department | job_title | avg_salary Engineering | Senior Dev | 120000 This would mean that the average salary for the group "belongs to the engineering department and job title is Senior Dev" is $120000

What is the difference between a Stack and a Queue?

The main difference is in how elements are processed and accessed. Queues allow access to elements from both ends while stacks only allow access to from the top. Queues are typically concerned with processing the first or last element, the stack is only concerned with the most recently added element.

What are the Maven build lifecycle phases?

validate - Validates that the project is correct and all necessary information is available compile - Compiles the source code of the project test - Tests the compiled source code using a suitable unit testing framework package - Takes the compiled code and packages it in its distributable format, such as a JAR verify - Runs any checks to verify the package is valid and meets quality criteria install - Installs the package into the local repository for use as a dependency in other projects locally deploy - Copies the final package to the remote repository for sharing with other developers and projects


Ensembles d'études connexes

the 5 major types of species interactions; science

View Set

NUR 236 PrepU Chapter 37: Nursing Care of the Child With an Infectious or Communicable Disorder

View Set

Texas Statutes and Rules Common to All Lines

View Set