Week 4 Flashcards

1
Q

Define HTML

A
  • Hypertext Markup Language

- markup language for creating the STRUCTURE and CONTENT of web pages and applications (styling is CSS and JS)

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

Attributes used on tag and elements (7)

A
  1. action
  2. target
  3. name
  4. method
  5. value
  6. placeholder
  7. required
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Explain Declaration

A
  • introduced in HTML5
  • used to inform the browser about the version of HTML used in the document
  • instructs the browser about the document type
  • Documentation Type Declaration (DTD)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Explain Character Encoding

A
  • an approach of converting bytes into characters. For validating the HTML document, a program must choose a character encoding
  • HTML5 uses UTF-8 as default character encoding, defined by “meta”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Syntax to start an HTML Document

A
  1. DOCTYPE declaration - tells browser the version of HTML being used (5)
  2. < html > - everything about webpage is nested within this tag
  3. < head > - all the metadata associated with webpage, including the title, character encoding, and references to external stylesheets
  4. < body > - contains the actual content of our page that will be rendered on the screen by the browser
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How to make a hyperlink?

A

use < a > tag with link inside the brackets

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

Tags for creating tables

A

< tr > defines table row < th > defines table headers < td > defines table cell (data)

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

What are the 2 options for making lists?

A

< ol > ordered lists (1st, 2nd, 3rd)
< ul > unordered lists (bullet points)
< li > used to list items

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

Define elements

A
  • provide the structure of the document
  • defined within HTML files using tags < >…>
  • may be nested within other elements
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Define attributes

A
  • these are key/value pairs that give metadata about the tag that are important for the browser to know.
  • EX - needs a URL inside the tags
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are HTML Forms and why would we use them?

A

a section of a document that contains controls

used to collect some information/data from the user

some tags would be: < form > < input > < label > < textarea > < button > < select > < option >

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

Examples of HTML Forms (9)

A
  1. text fields - one-line input field to input a line of text. specify the type attribute value as “text”
  2. password fields - type of text field in which the text is masked using asterisk or dots. specify the type attribute value as “password”
  3. radio buttons - let the user select exactly one value from a list of predefined options. specify the type attribute value as “radio”
  4. checkboxes - let the user select one or more values from a pre-defined set of options. specify the type attribute value as “checkbox”
  5. file select boxes - to select a local file on their computer and send it as an attachment to the webserver. specify a type attribute value as “file”
  6. text area - multi-line text input control. created by using the “textarea” element. “rows” and “cols” dictate size of box
  7. select boxes (drop-downs) - select one or more options from a drop-down list using and
  8. reset buttons - reset the form data and will display any default values. specify the type attribute as “reset”
  9. submit buttons - send the form data to the web server. specify the type attribute as “submit”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a Web Service?

A
  • a generic term for an interoperable machine-to-machine software function that is hosted from a network addressable location.
  • interoperable - different languages, hardware, environments, able to operate together thanks to some clearly defined communication protocol
  • network addressable - remote, available over a network
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Advantages of Web Services (4)

A
  1. Expand functionality of the way we use the web
  2. Expose functionality for accessibility and reuse
  3. Standardization & interoperability
  4. Loose coupling (separate technologies to function on own or together)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is REST (Representational State Transfer)?

A
  • an architectural style for web services
    1. Representational - resources (objects) are represented as JSON or XML for transfer.
    2. State - referring to a resource as it exists in that moment, a resource representation.
    3. Transfer - the resource representation is transmitted.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a resource in REST?

A
  • unit of identifiable information
  • an analog of an object in OOP
  • as a resource changes over time it is not a new resource; the same resource is in a different state
  • resources are identified by a URI (Universal Resource Identifier)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What are the 6 architectural constraints that need to be followed in order to be RESTful?

A
  1. uniform interface
  2. stateless
  3. cacheable
  4. client-server
  5. layered system
  6. code on demand (*optional)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is HTTP?

A
  • HyperText Transfer Protocol
  • client-server protocol we use the browse the web; client initiates communication
  • every communication is made up of client request and server response
  • stateless
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Each HTTP request is composed of.. (5)

A
  1. HTTP Verb - the HTTP method to execute
  2. URI - indicates the endpoint used to access the resource
  3. HTTP Version - in order to be certain of communication protocol
  4. Request Header - Metadata (info) about the request represented as key-value pairs
  5. Request Body - message content (resource representation in REST)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Each HTTP response is composed of.. (4)

A
  1. HTTP StatusCode - code indicating the status of the request
  2. HTTP Version - in order to be certain of communication protocol
  3. Response Header - Metadata (info) about the response represented as key-value pairs
  4. Response Body - message content (resource representation in REST)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

HTTP Status Codes

A

100 - Informational
200 - Success
- 201 - created / 204 - no content
300 - Redirect
- 301 - moved permanently / 304 - not modified
400 - Client Error
- 403 - forbidden / 404 - not found / 405 - method not allowed / 415 - unsupported media type / 451 - unavailable for legal reasons
500 - Server Error
- 501 - not implemented / 502 - bad gateway / 503 - service unavailable

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

What is a server?

A

software designed to process requests and deliver responses to another computer over the internet (ex Tomcat)

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

What is a client?

A

a program that runs on a local machine requesting service from the server (ex Postman)

24
Q

Types of Client-Server Architecture (3)

A
  1. 2 tier
  2. 3 tier
  3. n-tier
25
Q

Why were HTML 5 tags introduced?

What are some examples?

A
  • introduced to more accurately reflect the content of the tags

Examples: < strong > instead of < b >< em > instead of < i >< nav >< header >< footer >< section >< article>< aside > instead of reusing < div >

26
Q

Do all tags come in a pair?

A

No, tags either have a closing tag or are self-closing

27
Q

What’s the syntax for a comment?

A

< ! - - words - - >

28
Q

What is CSS?

A
  • cascading style sheets

- language for styling HTML docs by specifying certain rules for layout and display in key/value pairs

29
Q

What are the 3 ways to style an HTML file?

Which is best and why?

A
  1. inline - in the style attribute
  2. internal stylesheet - in the < style > tag in the < head >
  3. external stylesheet - using external .css files, use < link > in the < head >

External stylesheet is best practice due to separation of concerns, reusability, modularity

30
Q

Describe the CSS box model

A

The box model consists of margin (outermost box), then border, then padding, then content (innermost). All box sizes / formatting can be styled with CSS

31
Q

Which way has highest priority when styles cascade: inline, internal,and external?

A

Inline has highest priority, then internal/external depending on order.

Cascading rules are determined by:

(1) importance ( ! important flag )
(2) specificity of selector (inline has no selector, highest specificity)
(3) source order

32
Q

Syntax for styling an element?

What is a class and how to style them?

What is an id and how to style?

A

div { property: value}

. class { property: value}

id { property: value}

33
Q

What if I want to select child elements, what syntax is that?

A

use direct descendant selector ( > ) or space for any level nested element

34
Q

Can I select multiple elements at once? How?

A

Yes, with a comma

35
Q

What is a pseudo-class?

What is syntax for selecting that?

A
  • pseudo-class selects an element in a certain state - for example, when hovered over
  • Use colon ( : pseudoselector ) syntax
36
Q

What is Bootstrap?

A
  • CSS framework with pre-written CSS rules to easily style your page and incorporate responsive design seamlessly. Contains various utilities and components for making a great UI
37
Q

Describe the Bootstrap grid system

A
  • divided into 12 columns.
  • you wrap the columns in a .row which is in a .container or .container-flex
  • columns are responsive - there are classes for different screen sizes which collapse on smaller windows
38
Q

What is an HTTP verb? List 8.

A
  • describes the type of request and how it should be processed

GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, TRACE

39
Q

What is a servlet?

A
  • a Java class that takes incoming requests, processes them, and generates a response to send back to the user
40
Q

What is a servlet container?

A
  • the component of an application server that interacts with Java servlets and is responsible for managing the execution of servlets and JSP pages for Java applications
41
Q

Describe the servlet class inhertitance hierarchy.

A
  • The Servlet interface is the root interface of the servlet class hierarchy
  • the GenericServlet class implements Servlet, ServletConfig, and Serializable interfaces
  • the HttpServlet class extends the GenericServlet class and implements the Serializable interface
42
Q

What is the deploymentdescriptor?

What file configures your servlet container?

A
  • a file to define the URLs that map to servlets, and to determine which URLs require authentication and additional information
  • specifies the classes, resources, and configuration of the application and how the web server uses them to serve HTTP requests
  • web.xml file
43
Q

Explain the lifecycle of a servlet (5 steps).

What methods (3) are called and when are they called?

A
  1. loading of servlet - servlet container deploys and loads all servlet classes
  2. creating an instance of servlet - default is one instance for each servlet class
  3. invoke init() method - used to initialize the servlet and called once
  4. invoke service() method repeatedly for each client request - servlet container calls the service method each time a request is received. service method determines the type of Http request (GET, POST, PUT, etc), and calls doGet(), doPost(), etc methods as appropriate
  5. invoke destroy() method once - called only once at the end of a servlet’s life. servlet container calls this method before removing servlet instance
44
Q

What are some tags you would find in the web.xml file?

A

< web-app >< servlet >< servlet - name >< servlet - class >< servlet - mapping >< url - pattern >

*all need closing tags < / >

45
Q

What is the difference between the ServletConfig and ServletContext objects?

How do you retrieve these in your servlet?

A
  • both are created by the Servlet Container
  • ServletConfig is used to pass initial params or configuration info to a particular servlet during initialization. retrieved by the getServletConfig() method of HttpServlet
  • ServletContext is used to share params or configuration info to ALL servlets and other components. retrieved by the getServletContext() method of HttpServlet
46
Q

What is the RequestDispatcher?

A
  • interface that defines an object that passes along the client’s request to any other resources (servlet, JSP file, or HTML file) on the server
47
Q

Explain the difference between RequestDispatcher.forward() and HttpServletResponse.sendRedirect()

A
  • RequestDispatcher.forward() method is used to pass the same request to a new destination resource
  • the Response.sendRedirect() method is used to send an entirely new request for the destination resource
48
Q

What are 4 different ways of tracking a session with servlets?

A
  1. cookies
  2. hidden form fields
  3. URL writing
  4. HttpSession API
49
Q

What is object mapping? Any Java libraries for this?

A
  • enables you to relate objects in your application to data in a datebase
50
Q

How would you send text or objects back in the body of the HTTP response from a servlet?

A

PrintWriter out = response.getWriter();

out.println(“_____”);

51
Q

What is the difference between getParameter() and getAttribute() methods?

A
  • getParameter() returns http request parameters, those passed from the client to the server
  • getAttribute() is for server-side usage only - you fill the request with attributes that you can use within the same request
52
Q

Explain the front controller design pattern

A
  • provides a single handler for all the incoming requests for a resource in an application
  • then dispatches the requests to the appropriate secondary handler for that type of request
  • the front controller may use other helper APIs to achieve the dispatching mechanism
53
Q

What is the front controller in front controller design pattern?

A
  • a single entry point for all requests, and routes incoming user requests
54
Q

What is the dispatcher in front controller design pattern?

A
  • responsible for the action and view management, including locating and routing to the specific actions that will service a request, and finding the appropriate view
55
Q

What is the helper in front controller design pattern?

A
  • classes to break out specific features and make the application easier to build and maintain
  • used for:
  • retrieval of content
  • validation of user-entered information
  • processing of business logic
  • data processing
56
Q

What is view in front controller design pattern?

A
  • represents and displays information to the client (think an HTML/CSS/JS page)
  • retrieves info from model objects
57
Q

Eager vs lazy loading

A
  • lazy loading delays the initialization of a resource
  • eager loading initializes or loads a resource as soon as the code is executed. also involves preloading related entities referenced by a resource