Interview QC Questions Part 3 Flashcards

1
Q

What are generics?

A

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;
}
}

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

What is an Arraylist?

A

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.

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

What is a linked list?

A

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.

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

What is a queue/stack?

A

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.

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

What is a HashMap?

A

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).

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

What is an abstract data type?

A

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.

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

What is Junit? What is mocking?

A

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.

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

What is HTTP?

A

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.

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

What are cookies?

A

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.

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

What are some HTTP verbs/methods?

A

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.

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

List and explain the common HTTP methods.

A

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.

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

HTTP request lifecycle?

A

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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a servlet?

A

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.

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

What is REST?

A

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.

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

What are the REST constraints?

A

Uniform Interface
Stateless
Client-Server
Layered System
Cacheable
Code on demand (optional)

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

What is HTML?

A

Hypertext Markup Language (HTML) is a language that uses markup codes.

The HTML document is a plain text file with embedded markup codes. The markup codes are typed into a document and control the formatting and layout of your finished document.

17
Q

How have you used CSS so far?

What are 3 ways we can style a page?

How do we achieve responsive web design?

A

We have used CSS to style individual div elements in our projects. Mainly the navigation system, and footer.

We can style a page using inline styling, an internal stylesheet, and the more commonly used approach, the external stylesheet.

We can achieve a responsive web design easily by using Bootstrap libraries.

18
Q

What does <a> do?</a>

A

You can break this href down into simple parts.
href=”%E2%80%9C%E2%80%9D” can be written like this:

E2 80 9C E2 80 9D.

These two codes are a form of UTF-8 unicode that, when used, prints unicode characters.

The first, E2 80 9C, means LEFT DOUBLE QUOTATION MARK

The second, E2 80 9D, means RIGHT DOUBLE QUOTATION MARK

When used together it essentially prints two quotation marks. One on the left, and one on the right. to create something like this:

“example”

“ e2 80 9c LEFT DOUBLE QUOTATION MARK
” e2 80 9d RIGHT DOUBLE QUOTATION MARK

For more information visit the following link:

https://www.utf8-chartable.de/unicode-utf8-table.pl?start=8192&number=128

19
Q

What is the DOM?

A

The Document Object Model (DOM) is a programming interface for web documents. It represents the page so that programs can change the document structure, style, and content. The DOM represents the document as nodes and objects; that way, programming languages can interact with the page.

20
Q

What does the fetch methods do in JS?

A

The fetch() method in JavaScript is used to request to the server and load the information on the webpages. The request can be of any APIs that return the data of the format JSON or XML. This method returns a promise.

21
Q

What are arrow functions in JS?

A

Arrow functions are a new way to write anonymous function expressions, and are similar to lambda functions in some other programming languages, such as Python.

Arrow functions differ from traditional functions in a number of ways, including the way their scope is determined and how their syntax is expressed.

22
Q

What is agile?

A

Agile Java weaves all test-driven development, object-oriented design, and software architecture into a single, clean approach for building robust and highly scalable software systems.

23
Q

What is JSON?

A

JSON stands for JavaScript Object Notation. JSON is a lightweight format for storing and transporting data. JSON is often used when data is sent from a server.

24
Q

How to style all the html elements with a class of person? How about id of person?

A

In order to style a class you must use a period followed by the class name using a stylesheet.

Example:

HTML: <div class="personclass"> thing </div>
CSS: .personclass{ color: blue; }

The above example will style all div elements using the class “personclass”.

In order to style an id of person you must use a hashtag (#).

Example:

HTML: <div> thing </div>
CSS: #personid { color: blue; }

The above example will style a single div element matching the id. id’s are conventionally used to identify specific div elements apart from others. When one wishes to style multiple divs at a time, classes should be used.

25
Q

What are the data types in JS?

A

The set of types in the JavaScript language consists of primitive values and objects.

Primitive values (immutable datum represented directly at the lowest level of the language)

Boolean type
Null type
Undefined type
Number type
BigInt type
String type
Symbol type

Objects (collections of properties)

26
Q

== vs ===?

A

Double equals (==) is a comparison operator, which transforms the operands having the same type before comparison.

So, when you compare string with a number, JavaScript converts any string to a number. An empty string is always converts to zero. A string with no numeric value is converts to NaN (Not a Number), which returns false.

=== (Triple equals) is a strict equality comparison operator in JavaScript, which returns false for the values which are not of a similar type. This operator performs type casting for equality. If we compare 2 with “2” using ===, then it will return a false value.

27
Q

What is the difference between “let” and “var” in JavaScript?

A

The main difference is scoping rules. Variables declared by var keyword are scoped to the immediate function body (hence the function scope) while let variables are scoped to the immediate enclosing block denoted by { } (hence the block scope).

Variable declared by let cannot be redeclared and must be declared before use whereas variables declared with var keyword are hoisted.

let
let is block-scoped.
let does not allow to redeclare variables.
Hoisting does not occur in let.

var
var is function scoped.
var allows to redeclare variables.
Hoisting occurs in var.

28
Q

How do I access HTML elements with Javascript?

A

getElementById

getElementByClassName

getElementByName

getElementByTagName

getElementByCssSelector