Which of these is a benefit JSON has over XML?
A. JSON is more forgiving of poor formatting
B. JSON has less markup requirements and therefore is lighter than XML
C. JSON can be written poorly and still be parsed
D. JSON does not need to be stored in a file to be sent remotely
Ans:B

Which statement about the replacer parameter in JSON.stringify() is true?
A. If null or omitted, all properties of the object are included in the resulting JSON string
B. If a function, transforms values and properties encountered while stringifying
C. All three statements are true
D. If an array, specifies the names of the properties in the object to include in the resulting JSON string
Ans:C

Can you use a double quote inside a JSON string?
A. Yes, if you use the ascii code.
B. Yes, you can use it without any special treatment
C. Yes, if it is escaped like ( \” )
D. No, you should use single quotes
Ans:C

Which statement about the reviver parameter in JSON.parse() is true?
A. All three statements are true
B. Used to reform generic objects into instances of pseudo-classes
C. A function that will be called for every key and value at every level of the final result
D. Each value will be replaced by the result of the reviver function
Ans: A

Which of the following code will throw an error?
A. JSON.parse(null);
B. JSON.parse(‘{}’);
C. JSON.parse(undefined);
D. JSON.parse(‘[]’);
Ans: C

Which statement about the toJSON method is true?
A. It customizes JSON stringification behavior
B. It allows an object to determine its own JSON representation
C. All three statements are true
D. It is internally called by JSON.stringify()
Ans: C

Which of these data interchange formats has seen a decline in usage in favor of JSON?
A. ASCII
B. Plain-text
C. SQL
D. XML
Ans: D

True or false? A disadvantage of JSON is that it requires the use of JavaScript.
A. False, JSON is language independent.
B. False, JavaScript must be available although it is not necessary to use.
C. True, though all browsers have JavaScript enabled.
D. True, though JavaScript is readily available in today’s browsers.
Ans: A

Which is true about JSON namespacing?
A. JSON namespaces can be accessed immediately after receiving data.
B. JSON namespaces can be accessed after parsing data.
C. JSON doesn’t have namespaces. Though every object is inherently a namespace.
Ans:C

True or false? The order of elements in JSON arrays is always preserved.
A. False
B. True
Ans: B

Which of these is supported as a JSON Value type?
A. Infiniti
B. Null
C. Undefined
D. NaN
Ans: B

When coding a string object in JSON, what must separate the string and the value?
A. A space
B. A semicolon
C. A comma
D. A colon
Ans: D

Does JSON support Unicode characters?
A. No, JSON has no support for any kind of character encoding.
B. No, JSON only has support for UTF-8 characters.
C. Yes, JSON has support for Unicode characters. Allowing for almost any information in any human language
D. Yes, only when stored as the key in a ( key : value ) pair.
Ans: C

What types of values can you have in JSON key:value pairs?
A. Strings, Arrays, and Primitives
B. Arrays, Primitives, and Objects stored as strings
C. Strings, Arrays, Primitives and Objects
D. Strings only
Ans: C

In what situation would you want to use XML over JSON?
A. When JSON is not offered.
B. When you need to use tags to structure your content.
C. You need message validation or you’re using XSLT.
D. Never, JSON is worlds better.
Ans: C

What is a JSONStringer used for?
A. It is used to quickly create JSON text.
B. It quickly converts JSON to Java strings.
C. It is used to create number strings in JSON.
D. It is used to create JSON ordered pairs.
Ans: A

Which of the following control characters cannot be used when writing a JSON string without escaping?
A. ; or :
B. “ or \
C. < or >
D. / or {
Ans: B

How does JSON being “lightweight” translate into a benefit for the site visitors?
A. Faster transfer times over the internet
B. Parsing JSON is noticeably faster than parsing XML
C. Web apps have a smaller footprint
Ans: A

What two structures is JSON built on?
A. A collection of name/value pairs, and an ordered list of values, or array.
B. A collection of object/item pairs, and an ordered list of pairs, or array.
C. A collection of name/value objects, and an ordered list of objects, or array.
D. A collection of native-value pairs, and an ordered list of arrays, or values.
Ans: A

Which of the following is not a valid way to parse JSON string?
A. JSON.eval()
B. JSON.parse()
C. jQuery.parseJSON()
D. eval()
Ans: A

Which of the following code will not throw an error?
A. JSON.parse(”);
B. JSON.parse(null);
C. JSON.parse();
D. JSON.parse({});
Ans:B

How does JSON handle numeric values that cannot be represented by a sequence of digits (like Infiniti and Nan)?
A. They are stored as strings and then converted when parsed.
B. They are not permitted.
C. They are stored fine but it’s the parsers job to convert them to numeric values.
Ans: B

Which of the following number formats are not used in JSON?
A. Octal and gate
B. Octal and binary
C. Binary and hexadecimal
D. Octal and hexadecimal
Ans: D

What is used by the JSONObject and JSONArray constructors to parse JSON source strings?
A. JSONTokener
B. JSONParser
C. JParser
D. ParserJ
Ans: A

Which statement about the space parameter in JSON.stringify() is false?
A. It controls spacing in the resulting JSON string
B. All three statements are false
C. It removes whitespace
D. It is an optional parameter
Ans: C

True of False? The external form of a JSON object always begins and ends with {}
A. True
B. False
Ans: A

True of False. The order of JSON objects is always preserved.
A. False
B. True
Ans: A