JSON Multiple Choice Questions :-

JSON name/value pair is written as
A. name’ : ‘value’
B. name = ‘value’
C. name = “value”
D. “name” : “value”
Ans: D

JSON strings have to be in
A. single quote
B. double quote
C. single quote or double quote

Which of the following code will return a valid JSON object?
A. JSON.parse(‘({“FirstName”: “John”, “LastName”:”Doe”})’);
B. JSON.parse(“{‘FirstName’: ‘John’, ‘LastName’:’Doe’}”);
C. JSON.parse(“({‘FirstName’: ‘John’, ‘LastName’:’Doe’})”);
D. JSON.parse(‘{“FirstName”: “John”, “LastName”:”Doe”}’);

Which of these is proper a JSON array?
A. { “letters” : [ “a”, “b”, “c”; ] }
B. { ‘letters’ : {“a”, “b”, “c” } }
C. { “letters” : [ a, b, c ] }
D. { “letters” : [ “a”, “b”, “c” ] }

In the below notation, Employee is of type { “Employee”: [ “Amy”, “Bob”, “John” ] }
A. Not a valid JSON string
B. Array
C. Class
D. Object

Which of the following is not a JSON type?
A. Object
B. date
C. Array
D. string

Which of these is correct about the JSON standard?
A. It is an open standard
B. It is privately developed
C. It requires a license to use

What is the file extension of JSON?
A. .jn
B. .js
C. .jsn
D. .json

In modern websites what is the common usage for JSON?
A. To store information remotely.
B. To send and receive bits of data.
C. To store information locally.

In the below notation, Employee is of type { “Employee”: { “Name”: “Amy”, “Age”: 25 } }
A. Object
B. Array
C. Class
D. Not a valid JSON string

Which answer represents the following order of TYPES? Object, String, Boolean, Number
A. “{ }”, “a string”, “false”, “0”
B. [ ], 0, “true”, “0”
C. { }, “0”, false, 0
D. { }, hello, “false”, “0”

In this example, what is the TYPE of employee? { “employee” : { “type” : “Director”, “functions” : [‘sales’, ‘marketing’] } }
A. String
B. Director
C. type
D. Object

Given this JSON example: { “Employee”: { “Name”: “Amy”, “Age”: 25 } }; What is the type of Employee.Age ?
A. Number
B. Object
C. Array
D. String

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

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

What does JSON stand for?
A. JavaScript Object Nomenclature
B. JavaScript Objective Notation
C. JavaScript Object Notation
D. JavaScript Orientated Nomenclature

JSON elements are separated by
A. semi-colon
B. line break
C. comma
D. white space

What keywords are reserved in JSON and cannot be used as keys?
A. Value
B. Object
C. There are none.
D. Key

What kind of format is JSON, and what does the acronym mean?
A. A lightweight data-encoding framework. Java Omnipresent Notation.
B. A lightweight data-interchange format. JavaScript Object Notation.
C. A lightweight data-interchange format. Java Objective Notion.
D. A lightweight database framework. JavaScript Object Notation.
Ans: B

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

In this example, what is the TYPE of employee.functions? { “employee” : { “type” : “Director”, “functions” : [‘sales’, ‘marketing’] } }
A. String
B. Object
C. Array
D. Sales, Marketing

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 is a valid JSON string?
A. { “meals” : { “breakfast” , “lunch” , “dinner” } }
B. { “meals” : [ “breakfast” , “lunch” , “dinner” ] }
C. [ “meals” : { “breakfast” , “lunch” , “dinner” } ]
D. [ {“meals” : { “breakfast” , “lunch” , “dinner” } } ]

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?
B. Plain-text
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.

What function will convert a JavaScript object to a JSON string?
A. JSON.text()
B. JSON.serialize()
C. JSON.toString()
D. JSON.stringify()
Ans: D

In this example, what would the VALUE of employee.functions[1] be? { “employee” : { “type” : “Director”, “functions” : [‘sales’, ‘marketing’] } }
A. null
B. undefined
C. marketing
D. sales
Ans: C

What is the MIME type of JSON?
A. application/x-json
B. text/json
C. application/json
D. application/javascript
Ans: C

In this example, what is the VALUE of employee.type? { “employee” : { “type” : “Director”, “functions” : [‘sales’, ‘marketing’] } }
A. String
B. Object
C. Director
Ans: C

JSON Objective Questions Pdf Free Download ::

In this example, what would the TYPE of employee.hireDate be? { “employee” : { “type” : “Director”, “functions” : [‘sales’, ‘marketing’], “hireDate” : “March 8, 2011” } }
A. March 8, 2011
B. String
C. Date
D. Number
Ans: B

What is JSONP meant to mitigate?
A. Size constraints of JSON
B. Cross-domain communication
C. Future proofing JSON as JavaScript changes.
Ans: B

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 is the value of obj in the following code? var obj = JSON.parse(‘{“fruit”: “Apple”}’, function(k, v) { if (v == “Apple”) return “Orange” else return v; });
A. { “fruit” : “Apple”}
B. { “fruit” : “Orange”}
C. {“Orange”}
D. {“Apple”}
Ans: B

Does whitespace matter in JSON?
A. No, it will be stripped out.
B. Yes, only within strings.
C. Yes, only outside of strings.
D. Yes, both inside and outside of strings
Ans: B

What is the value of json in the following code? var cars = []; cars[0] = ‘Ford’; cars[1] = ‘Toyota’; cars[2] = ‘BMW’; var json = JSON.stringify({x: cars});
A. {“x”:[‘Ford’,’Toyota’,’BMW’]}
B. {“x”:{“Ford”,”Toyota”,”BMW”}}
C. {“x”:[“Ford”,”Toyota”,”BMW”]}
D. {“cars”:[“Ford”,”Toyota”,”BMW”]}
Ans: C

What is the value of json in the following code? var obj = { fruit: ‘apple’, toJSON: function () { return ‘orange’; } }; var json = JSON.stringify({x: obj});
A. {“x”:”orange”}
B. {“fruit”:”apple”}
C. {“x”:”apple”}
D. {“fruit”:”orange”}
Ans: A

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

What is the value of json in the following code? var days = {}; days[‘Monday’] = true; days[‘Wednesday’] = true; days[‘Sunday’] = false; var json = JSON.stringify({x: days});
A. {“day”:{“Monday”:”true”,”Wednesday”:”true”,”Sunday”:”false”}}
B. {“x”:{“Monday”:true,”Wednesday”:true,”Sunday”:false}}
C. {“day”:{“Monday”:true,”Wednesday”:true,”Sunday”:false}}
D. {“x”:[“Monday”:true,”Wednesday”:true,”Sunday”:false]}
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 error does JSON.parse() throw when the string to parse is not valid JSON?
A. ReferenceError
B. EvalError
C. SyntaxError
D. TypeError
Ans: C

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

What does JSONP stand for?
A. JSON Procedures
B. JSON Parsing
C. JSON with padding
D. JSON Programming
Ans: C

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

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