Week3Quiz Flashcards

(50 cards)

1
Q

The @ExceptionHandler can be used to

A

Provide a handler for a given exception, provided it is thrown by the controller.

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

@GetMapping(“/{id}”)

A

public Object geTById(@PathVariable int id){}

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

Spring is

A

A dependency injection framework for Java

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

One of the problems Spring Core addresses

A

Tight coupling

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

A Spring bean is

A

A class which is constructed and managed by Spring

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
Which is NOT stereotype annotation? 
@Component
@Bean
@Controller
@Service
A

@Bean

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

Which of these is the @Configuration annotation used for?

  • Provide XML configuration
  • Define a class as a configuration bean
  • Provide annotation driven configuration
  • Do the same as @Autowired
A

Define a class as a configuration bean.

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

When requesting a bean with scope “prototype”, you will always be given a new instance of the bean? (T/F)

A

true

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

The default scope of a bean is “singleton” (T/F)

A

true

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

The @RequestMapping annotation is used to

  • Provide a URL mapping to a resource for any HTTP method.
  • Provide a URL mapping to a resource for only GET methods.
  • Map a path variable to an array index.
  • Provide data contained in a request body as a HashMap.
A

Provide a URL mapping to a resource for any HTTP method

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

@RequestBody annotation is used for which of these?

  • Define a class as a controller.
  • Define that the return value of a method should be serialized to some form such as XML, JSON, ect.
  • Define that the request body should be deserialized to a Java object from form such as XML, JSON, ect.
  • Parse the a variable in the requested URL and injected to the method call as a parameter.
A

Define that the request body should be DEserialized to a Java object from form such as XML, JSON, ect.

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

@PathVariable annotation is used to

A

Parse a variable in the requested URL and inject it into the method call as a parameter.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
When used on the class, the @RestController annotation implies what on all methods?
@ReponseBody
@RequestBody
@RequestMapping
@RequestParam
A

@ReponseBody

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
Configuring a method to handle an HTTP PUT request:
@PutRequest
@Put
@PutMapping
@RequestMapping("PUT")
A

@PutMapping

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

Springboot features an “opinionated” configuration which means;

A

When not provided with configurations, it uses a reasonable default config

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

When using spring boot, you must deploy your application to a Tomcat server. (T/F)

A

false

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

Configuration can be provided to spring using which files?

  • application.xml and application.yml
  • application.properties and application.xml
  • application.xml and bootstrap.xml
  • application.yml and application.properties
A

application.yml and application.properties

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

Using the default configuration, Spring boot includes an embedded..:

  • tomcat server
  • postgres server
  • in memory database
  • user
A

tomcat server

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

Spring boot actuators can be used to

A

get runtime info about the application via HTTP

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

Spring Data requires some underlying ORM technology like Hibernate. (T/F)

A

true

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

Which is not a part of the class/interface hierarchy of Spring Data.

  • Repository
  • CrudRepository
  • SQLRepository
  • PagingAndSortingRepository
A

PagingAndSortingRepository

22
Q

Spring Data’s JpaRepository features a fluent API which allows it to

A

Generate SQL queries by parsing an abstract method’s name

23
Q

@Transactional is used to

A

Define that the underlying code should be executed as a database transaction.

24
Q

What is REST?

A

An architectural style that promotes ease of communication and access to resources.

25
What is contained in an HTTP Request? (select multiple)
``` Headers (metadata) Verb Body(data) destination URL response ```
25
What is contained in an HTTP Request? (select all)
``` Headers (metadata) Verb Body(data_ destination URL response ```
26
Explain Uniform Interface
- Resource URIs follow a certain convention and include certain information. - All websites should have more or less the same-looking interface. - Resource URIs should be saved into the server's cache. - Only one interface per resource.
27
What is true about the Layered System principle of REST?
one layer cannot see beyond its functionality
28
Should REST be: - Stateless of - Stateful
Stateless
29
Highest level of Richardson Maturity Model
- level 3 - HATEOAS - Reponses are self descriptive
30
Explain the cacheable principle of REST
Resources should be self-contained - cached by servers & clients - improves performance.
31
How do we make use of a RESTful API?
Send requests with the correct data and verb to an endpoint connected to a server running the API.
32
What data formats are accepted for REST? Choose Two. - JSON - XML - Java - Microsoft Word
- JSON | - XML
33
Which of the following is NOT a RESTful web constraint? - Un-cacheable - Client-Server architecture - stateless - Uniform Interface
Un-cacheable
34
What is a RESTful webservice?
A webservice that sends a representation of data accross the web instead of the actual data
35
What kind of HTTP method should be used for a request to create a new item? Where should data be in the request?
Use a POST request | data in the BODY
36
whats the difference between HTTP GET and POST methods
POST requests cannot be bookmarked
37
What does the 300 range of HTTP status code indicate?
Redirect
38
HTML stands for HyperText Messaging Language (T/F)
false
39
What is the current version of HTML? - 3 - 4 - 5 - 6
5
40
An attribute is
Extra data provided to a tag
41
On an image element, the src attribute is used to
specify the URL of the source image
42
Which of the following is -not- a valid type for input tags - test - color - password - name
name
43
Forms are
Used to collect a group of input fields into a single set.
44
Web browsers are primarily used for
creating a visual representation of an HTML document.
45
CSS stands for
Cascading Style Sheets
46
A CSS selector is
a pattern of elements and other terms that tell the browser which HTML elements should be selected to have the CSS property values inside the rule applied to them.
47
A CSS property is
the name of a styling option which we can modify.
48
The three basic selectors are
tag, class, and ID
49
Which of the following is NOT a difference between ID and class
An ID is assigned as an attribute, but a class is assigned as a CSS property.