Week3Quiz Flashcards
The @ExceptionHandler can be used to
Provide a handler for a given exception, provided it is thrown by the controller.
@GetMapping(“/{id}”)
public Object geTById(@PathVariable int id){}
Spring is
A dependency injection framework for Java
One of the problems Spring Core addresses
Tight coupling
A Spring bean is
A class which is constructed and managed by Spring
Which is NOT stereotype annotation? @Component @Bean @Controller @Service
@Bean
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
Define a class as a configuration bean.
When requesting a bean with scope “prototype”, you will always be given a new instance of the bean? (T/F)
true
The default scope of a bean is “singleton” (T/F)
true
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.
Provide a URL mapping to a resource for any HTTP method
@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.
Define that the request body should be DEserialized to a Java object from form such as XML, JSON, ect.
@PathVariable annotation is used to
Parse a variable in the requested URL and inject it into the method call as a parameter.
When used on the class, the @RestController annotation implies what on all methods? @ReponseBody @RequestBody @RequestMapping @RequestParam
@ReponseBody
Configuring a method to handle an HTTP PUT request: @PutRequest @Put @PutMapping @RequestMapping("PUT")
@PutMapping
Springboot features an “opinionated” configuration which means;
When not provided with configurations, it uses a reasonable default config
When using spring boot, you must deploy your application to a Tomcat server. (T/F)
false
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
application.yml and application.properties
Using the default configuration, Spring boot includes an embedded..:
- tomcat server
- postgres server
- in memory database
- user
tomcat server
Spring boot actuators can be used to
get runtime info about the application via HTTP
Spring Data requires some underlying ORM technology like Hibernate. (T/F)
true
Which is not a part of the class/interface hierarchy of Spring Data.
- Repository
- CrudRepository
- SQLRepository
- PagingAndSortingRepository
PagingAndSortingRepository
Spring Data’s JpaRepository features a fluent API which allows it to
Generate SQL queries by parsing an abstract method’s name
@Transactional is used to
Define that the underlying code should be executed as a database transaction.
What is REST?
An architectural style that promotes ease of communication and access to resources.
What is contained in an HTTP Request? (select multiple)
Headers (metadata) Verb Body(data) destination URL response
What is contained in an HTTP Request? (select all)
Headers (metadata) Verb Body(data_ destination URL response
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.
What is true about the Layered System principle of REST?
one layer cannot see beyond its functionality
Should REST be:
- Stateless
of
- Stateful
Stateless
Highest level of Richardson Maturity Model
- level 3
- HATEOAS
- Reponses are self descriptive
Explain the cacheable principle of REST
Resources should be self-contained
- cached by servers & clients - improves performance.
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.
What data formats are accepted for REST? Choose Two.
- JSON
- XML
- Java
- Microsoft Word
- JSON
- XML
Which of the following is NOT a RESTful web constraint?
- Un-cacheable
- Client-Server architecture
- stateless
- Uniform Interface
Un-cacheable
What is a RESTful webservice?
A webservice that sends a representation of data accross the web instead of the actual data
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
whats the difference between HTTP GET and POST methods
POST requests cannot be bookmarked
What does the 300 range of HTTP status code indicate?
Redirect
HTML stands for HyperText Messaging Language (T/F)
false
What is the current version of HTML?
- 3
- 4
- 5
- 6
5
An attribute is
Extra data provided to a tag
On an image element, the src attribute is used to
specify the URL of the source image
Which of the following is -not- a valid type for input tags
- test
- color
- password
- name
name
Forms are
Used to collect a group of input fields into a single set.
Web browsers are primarily used for
creating a visual representation of an HTML document.
CSS stands for
Cascading Style Sheets
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.
A CSS property is
the name of a styling option which we can modify.
The three basic selectors are
tag, class, and ID
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.