Week3Quiz Flashcards

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
Q

What is contained in an HTTP Request? (select multiple)

A
Headers (metadata)
Verb
Body(data)
destination URL
response
25
Q

What is contained in an HTTP Request? (select all)

A
Headers (metadata)
Verb
Body(data_
destination URL
response
26
Q

Explain Uniform Interface

A
  • 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
Q

What is true about the Layered System principle of REST?

A

one layer cannot see beyond its functionality

28
Q

Should REST be:
- Stateless
of
- Stateful

A

Stateless

29
Q

Highest level of Richardson Maturity Model

A
  • level 3
  • HATEOAS
  • Reponses are self descriptive
30
Q

Explain the cacheable principle of REST

A

Resources should be self-contained

- cached by servers & clients - improves performance.
31
Q

How do we make use of a RESTful API?

A

Send requests with the correct data and verb to an endpoint connected to a server running the API.

32
Q

What data formats are accepted for REST? Choose Two.

  • JSON
  • XML
  • Java
  • Microsoft Word
A
  • JSON

- XML

33
Q

Which of the following is NOT a RESTful web constraint?

  • Un-cacheable
  • Client-Server architecture
  • stateless
  • Uniform Interface
A

Un-cacheable

34
Q

What is a RESTful webservice?

A

A webservice that sends a representation of data accross the web instead of the actual data

35
Q

What kind of HTTP method should be used for a request to create a new item? Where should data be in the request?

A

Use a POST request

data in the BODY

36
Q

whats the difference between HTTP GET and POST methods

A

POST requests cannot be bookmarked

37
Q

What does the 300 range of HTTP status code indicate?

A

Redirect

38
Q

HTML stands for HyperText Messaging Language (T/F)

A

false

39
Q

What is the current version of HTML?

  • 3
  • 4
  • 5
  • 6
A

5

40
Q

An attribute is

A

Extra data provided to a tag

41
Q

On an image element, the src attribute is used to

A

specify the URL of the source image

42
Q

Which of the following is -not- a valid type for input tags

  • test
  • color
  • password
  • name
A

name

43
Q

Forms are

A

Used to collect a group of input fields into a single set.

44
Q

Web browsers are primarily used for

A

creating a visual representation of an HTML document.

45
Q

CSS stands for

A

Cascading Style Sheets

46
Q

A CSS selector is

A

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
Q

A CSS property is

A

the name of a styling option which we can modify.

48
Q

The three basic selectors are

A

tag, class, and ID

49
Q

Which of the following is NOT a difference between ID and class

A

An ID is assigned as an attribute, but a class is assigned as a CSS property.