Gson MCQ Questions And Answers - Java Technologies
Gson MCQs : This section focuses on "basics" of Gson. These Multiple Choice Questions (MCQ) should be practiced to improve the Gson skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.
1. Google Gson is an?
A. Open source
B. Java-based library
C. Reliable and fast
D. All of the above
View Answer
Ans : D
Explanation: Google Gson is an open source, Java-based library developed by Google.
2. Google Gson provides extensive support for generics?
A. Yes
B. No
C. Can be yes or no
D. Can not say
View Answer
Ans : A
Explanation: Yes, Google gson provides extensive support for generics
3. Which of the following are features of gson?
A. Gson API provides a high-level facade to simplify commonly used use-cases
B. Gson API provides default mapping for most of the objects to be serialized
C. Gson creates a clean and compact JSON result which is easy to read
D. All of the above
View Answer
Ans : D
Explanation: All of the above most prominent features of Gson.
4. Which of the following prepares an in-memory tree representation of the JSON document?
A. Streaming API
B. Tree Model
C. Data Binding
D. All of the above
View Answer
Ans : B
Explanation: Tree Model : It prepares an in-memory tree representation of the JSON document. It builds a tree of JsonObject nodes. It is a flexible approach and is analogous to DOM parser for XML.
5. Which is used to constructs a Gson object with default configuration?
A. Ggson()
B. JGSON()
C. Gson()
D. Json()
View Answer
Ans : C
Explanation: Gson() : Constructs a Gson object with default configuration.
6. How many types of Data Binding API ?
A. 1
B. 2
C. 3
D. 4
View Answer
Ans : B
Explanation: Data Binding API has two types : Primitives Data Binding and Objects Data Binding
7. Converts JSON to and from Java Maps, Lists, Strings, Numbers, Booleans, and NULL objects known as ?
A. Objects Data Binding
B. Data Binding
C. Primitives Data Binding
D. None of the above
View Answer
Ans : C
Explanation: Primitives Data Binding : Converts JSON to and from Java Maps, Lists, Strings, Numbers, Booleans, and NULL objects.
8. Tree Model prepares an in-memory tree representation of the JSON document.
A. Yes
B. No
C. Can be yes or no
D. Can not say
View Answer
Ans : A
Explanation: Yes, Tree Model prepares an in-memory tree representation of the JSON document. It builds a tree of JsonObject nodes. It is a flexible approach and is analogous to DOM parser for XML.
9. JsonReader and JsonWriter read/write the data as token, referred as?
A. Token
B. JsonToken
C. GsonToken
D. Jtoken
View Answer
Ans : B
Explanation: Streaming API is used to read JSON token by token. It reads and writes JSON content as discrete events. JsonReader and JsonWriter read/write the data as token, referred as JsonToken.
10. Gson performs the _____________ of objects using its inbuilt adapters
A. serialization
B. deserialization
C. serialization or deserialization
D. None of the above
View Answer
Ans : C
Explanation: Gson performs the serialization/deserialization of objects using its inbuilt adapters. It also supports custom adapters.
Discussion