Java Spring Questions and Answers for experienced on “JSON with REST”.
1. Payload format for REST services.
a) RSS
b) Atom
c) JSON
d) All of the mentioned
Answer: d
Clarification: JSON, in addition to RSS and Atom, has blossomed into a favorite payload format for REST services.
2. All REST service payloads rely on XML markup.
a) True
b) False
Answer: b
Clarification: JSON is different in the sense that its content is a special notation based on the JavaScript language.
3. Class that forms part of Spring to apply JSON content.
a) MappingJacksonJsonView
b) MappingJsonView
c) MappingJacksonJson
d) JsonView
Answer: a
Clarification: In addition to relying on Spring REST support, we will also use the MappingJacksonJsonView class that forms part of Spring to facilitate the publication of JSON content.
4. The MappingJacksonJsonView class depends on Jackson JSON processor library.
a) org.codehaus.jackson
b) jackson-mapper-asl
c) all of the mentioned
d) none of the mentioned
Answer: a
Clarification: The MappingJacksonJsonView class depends on the presence of the Jackson JSON processor library which can be downloaded at http://wiki.fasterxml.com/JacksonDownload.
5. Information you wish to publishas a JSON Object can be located in a RDBMS or text file, accessed through JDBC or ORM.
a) True
b) False
Answer: a
Clarification: This information can be located in a RDBMS or text file, accessed through JDBC or ORM, inclusively be part of a Spring bean or some other type of construct.
6. JSON payload consists of text and separators like.
a) { , }
b) ( , )
c) :
d) All of the mentioned
Answer: d
Clarification: a JSON payload consists of text and separators like { , }, ( , ), : and “.
7. To access JSON in a Spring application, library used is:-
a) JSON-LIB
b) SpringJSON-lib
c) JSON-lib
d) None of the mentioned
Answer: a
Clarification: Though it’s technically possible to access JSON in a Spring application (i.e., on the server side), using a third-party Java library like JSON-LIB (http://json-lib.sourceforge.net/ ).
8. You are often better served accessing and manipulating REST services with XML payloads in Spring applications.
a) True
b) False
Answer: a
Clarification: The Java platform’s native support for XML, in addition to the fact that XML is more intuitive and does not have the same processing limitations as browsers.
9. Class which is capable of performing a multitude of operations on REST services.
a) RestTemplate
b) XPathTemplate
c) XMLTemplate
d) JavaTemplate
Answer: a
Clarification: Spring RestTemplate class is capable of performing a multitude of operations on REST services in order for their payloads to be used inside Spring applications, processing elaborate XML responses requires using a set of approaches beyond those of this last class.
10. XML query language for selecting nodes from an XML document.
a) XPathTemplate
b) XPath
c) All of the mentioned
d) None of the mentioned
Answer: b
Clarification: XPath—an XML query language for selecting nodes from an XML document— knowledge about Spring HttpConverterMessage, as well as supporting facilities like Spring XPathTemplate.
11. The Handler method assigns the returning XML payload to a String.
a) True
b) False
