Interview QC Questions Part 3 Flashcards
What are generics?
A Generic class simply means that the items or functions in that class can be generalized with the parameter, T for example, to specify that we can add any type as a parameter in place of T like Integer, Character, String, Double or any other user-defined type.
Example code:
class Solution
{
T data;
public static T getData(){
return data;
}
}
What is an Arraylist?
The ArrayList class is a resizable array. The difference between a built-in array and an ArrayList in Java, is that the size of an array cannot be modified.
What is a linked list?
The LinkedList class is almost identical to the ArrayList. The LinkedList, however, stores its items in “containers.” The list has a link to the first container and each container has a link to the next container in the list. To add an element to the list, the element is placed into a new container and that container is linked to one of the other containers in the list.
What is a queue/stack?
Stack and Queue are Linear Data Structures. These structures are used to store the same type of data and retrieve the data in a specific order.
Stack follows the LIFO principle i.e. Last In First Out.
Queue follows the FIFO principle i.e. First In First Out.
What is a HashMap?
A HashMap provides the basic implementation of the Map interface of Java. It stores the data in (Key, Value) pairs, and you can access them by an index of another type (e.g. an Integer).
What is an abstract data type?
An Abstract Data Type (ADT) is a data type that has values and operations that are not defined in the language itself.
In Java, an ADT is implemented using a class, or an interface.
What is Junit? What is mocking?
JUnit is a unit testing open-source framework for the Java programming language. Java Developers use this framework to write and execute automated tests. In Java, there are test cases that have to be re-executed every time a new code is added. This is done to make sure that nothing in the code is broken.
Mocking and Mock Objects is a unit testing technique in which a code chunk is replaced by dummy implementations that emulate real code. This helps one to write unit tests targeting the functionality provided by the class under test.
What is HTTP?
Hypertext Transfer Protocol (HTTP) is an application-layer protocol for transmitting hypermedia documents, such as HTML. It was designed for communication between web browsers and web servers.
What are cookies?
Cookies are files created by websites you visit. They make your online experience easier by saving browsing information. With cookies, sites can keep you signed in, remember your site preferences, and give you locally relevant content.
What are some HTTP verbs/methods?
The primary or most-commonly-used HTTP verbs (or methods, as they are properly called) are POST, GET, PUT, PATCH, and DELETE. These correspond to create, read, update, and delete (or CRUD) operations, respectively.
List and explain the common HTTP methods.
POST
A POST request is used to send data to the server, for example, customer information, file upload, etc. using HTML forms.
GET
The GET method is used to retrieve information from the given server using a given URI. Requests using GET should only retrieve data and should have no other effect on the data.
PUT
Replaces all current representations of the target resource with the uploaded content.
PATCH
PATCH is used to modify resources. The PATCH request only needs to contain the changes to the resource, not the complete resource.
DELETE
Removes all current representations of the target resource given by a URI.
HTTP request lifecycle?
A user opens their browser, types in a URL, and presses Enter.
When a user presses Enter, the browser makes a request for that URL . The request hits the Rails router (config/routes.rb). The router maps the URL to the correct controller and action to handle the request. The action receives the request and passes it on to the view. The view renders the page as HTML. The controller sends the HTML back to the browser. The page loads and the user sees it.
What is a servlet?
A servlet is a Java programming language class that is used to extend the capabilities of servers that host applications accessed by means of a request-response programming model.
What is REST?
Representational State Transfer (REST) is an architectural style that specifies constraints, such as the uniform interface, that if applied to a web service induce desirable properties, such as performance, scalability, and modifiability, that enable services to work best on the Web.
What are the REST constraints?
Uniform Interface
Stateless
Client-Server
Layered System
Cacheable
Code on demand (optional)