Olete.in
Articles
Mock Tests
🧪 JSON MCQ Quiz Hub
JSON Multiple choice Questions
Choose a topic to test your knowledge and improve your JSON skills
1. JSON name/value pair is written as
name’ : ‘value’
name = ‘value
name = “value”
“name” : “value”
2. JSON strings have to be in
single quote
double quote
single quote or double quote
None of These
3. In the below notation, Employee is of type { “Employee”: [ “Amy”, “Bob”, “John” ] }
Not a valid JSON string
Array
Class
Object
4. Which of the following is not a JSON type?
Object
date
Array
string
5. Which of these is correct about the JSON standard?
It is an open standard
It is privately developed
It requires a license to use
6. What is the file extension of JSON?
.jn
.js
.jsn
json
7. In modern websites what is the common usage for JSON?
To store information remotely.
To send and receive bits of data.
To store information locally.
None of these
8. Which of the following code will return a valid JSON object?
JSON.parse(‘({“FirstName”: “John”, “LastName”:”Doe”})’);
JSON.parse(“{‘FirstName’: ‘John’, ‘LastName’:’Doe’}”);
JSON.parse(“({‘FirstName’: ‘John’, ‘LastName’:’Doe’})”);
JSON.parse(‘{“FirstName”: “John”, “LastName”:”Doe”}’);
9. Which of these is proper a JSON array?
{ “letters” : [ “a”, “b”, “c”; ] }
{ ‘letters’ : {“a”, “b”, “c” } }
{ “letters” : [ a, b, c ] }
{ “letters” : [ “a”, “b”, “c” ] }
10. In the below notation, Employee is of type { “Employee”: { “Name”: “Amy”, “Age”: 25 } }
Object
Array
Class
Not a valid JSON string
11. Which answer represents the following order of TYPES? Object, String, Boolean, Number
“{ }”, “a string”, “false”, “0”
[ ], 0, “true”, “0”
{ }, “0”, false, 0
{ }, hello, “false”, “0”
12. In this example, what is the TYPE of employee? { “employee” : { “type” : “Director”, “functions” : [‘sales’, ‘marketing’] } }
String .
Director
type
Object
13. Given this JSON example: { “Employee”: { “Name”: “Amy”, “Age”: 25 } }; What is the type of Employee.Age ?
Number
Object
Array
String
14. Which of these is a benefit JSON has over XML?
JSON is more forgiving of poor formatting
JSON has less markup requirements and therefore is lighter than XML
JSON can be written poorly and still be parsed
JSON does not need to be stored in a file to be sent remotely
15. What does JSON stand for?
JavaScript Object Nomenclature
JavaScript Objective Notation
JavaScript Object Notation
JavaScript Orientated Nomenclature
16. JSON elements are separated by
semi-colon
line break
comma
white space
17. What keywords are reserved in JSON and cannot be used as keys?
Value
Object
There are none
Key
18. Which of the following is a valid JSON string?
{ “meals” : { “breakfast” , “lunch” , “dinner” } }
{ “meals” : [ “breakfast” , “lunch” , “dinner” ] }
[ “meals” : { “breakfast” , “lunch” , “dinner” } ]
[ {“meals” : { “breakfast” , “lunch” , “dinner” } } ]
19. Which of the following code will throw an error?
JSON.parse(null);
JSON.parse(‘{}’);
JSON.parse(undefined);
JSON.parse(‘[]’);
20. Which statement about the toJSON method is true?
It customizes JSON stringification behavior
It allows an object to determine its own JSON representation
All three statements are true
It is internally called by JSON.stringify()
21. Which of these data interchange formats has seen a decline in usage in favor of JSON?
ASCII
Plain-text
SQL
XML
22. True or false? A disadvantage of JSON is that it requires the use of JavaScript.
False, JSON is language independent.
False, JavaScript must be available although it is not necessary to use.
True, though all browsers have JavaScript enabled.
True, though JavaScript is readily available in today’s browsers.
23. Which is true about JSON namespacing?
JSON namespaces can be accessed immediately after receiving data.
JSON namespaces can be accessed after parsing data.
JSON doesn’t have namespaces. Though every object is inherently a namespace.
None of These
24. What kind of format is JSON, and what does the acronym mean?
A lightweight data-encoding framework. Java Omnipresent Notation.
A lightweight data-interchange format. JavaScript Object Notation.
A lightweight data-interchange format. Java Objective Notion.
A lightweight database framework. JavaScript Object Notation.
25. Can you use a double quote inside a JSON string?
Yes, if you use the ascii code.
Yes, you can use it without any special treatment
Yes, if it is escaped like ( ” )
No, you should use single quotes
26. In this example, what is the TYPE of employee.functions? { “employee” : { “type” : “Director”, “functions” : [‘sales’, ‘marketing’] } }
String
Object
Array
Sales, Marketing
27. Which statement about the reviver parameter in JSON.parse() is true?
All three statements are true
Used to reform generic objects into instances of pseudo-classes
A function that will be called for every key and value at every level of the final result
Each value will be replaced by the result of the reviver function
28. Which statement about the reviver parameter in JSON.parse() is true?
All three statements are true
Used to reform generic objects into instances of pseudo-classes
A function that will be called for every key and value at every level of the final result
All of the above
29. What function will convert a JavaScript object to a JSON string?
JSON.text()
JSON.serialize()
JSON.toString()
JSON.stringify()
30. In this example, what would the VALUE of employee.functions[1] be? { “employee” : { “type” : “Director”, “functions” : [‘sales’, ‘marketing’] }
null
undefined
marketing
sales
31. What is the MIME type of JSON?
application/x-json
text/json
application/json
application/javascript
32. In this example, what is the VALUE of employee.type? { “employee” : { “type” : “Director”, “functions” : [‘sales’, ‘marketing’] }
String
Object
Director
None of These
33. In this example, what would the TYPE of employee.hireDate be? { “employee” : { “type” : “Director”, “functions” : [‘sales’, ‘marketing’], “hireDate” : “March 8, 2011” } }
March 8, 2011
String
Date
Number
34. What is JSONP meant to mitigate?
Size constraints of JSON
Cross-domain communication
Future proofing JSON as JavaScript changes.
None of these
35. Which of these is supported as a JSON Value type?
Infiniti
Null
Undefined
NaN
36. When coding a string object in JSON, what must separate the string and the value?
A space
A semicolon
A comma
A colon
37. Does JSON support Unicode characters? A.
No, JSON has no support for any kind of character encoding.
No, JSON only has support for UTF-8 characters
Yes, JSON has support for Unicode characters. Allowing for almost any information in any human language
Yes, only when stored as the key in a ( key : value ) pair.
38. 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; });
{ “fruit” : “Apple”}
{ “fruit” : “Orange”}
{“Orange”}
{“Apple”}
39. In what situation would you want to use XML over JSON?
When JSON is not offered.
When you need to use tags to structure your content
You need message validation or you’re using XSLT.
Never, JSON is worlds better.
40. What is a JSONStringer used for?
It is used to quickly create JSON text.
It quickly converts JSON to Java strings.
It is used to create number strings in JSON.
It is used to create JSON ordered pairs.
41. Which of the following control characters cannot be used when writing a JSON string without escaping?
; or :
“ or
< or >
/ or {
42. 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});
{“day”:{“Monday”:”true”,”Wednesday”:”true”,”Sunday”:”false”}}
{“x”:{“Monday”:true,”Wednesday”:true,”Sunday”:false}}
{“day”:{“Monday”:true,”Wednesday”:true,”Sunday”:false}}
{“x”:[“Monday”:true,”Wednesday”:true,”Sunday”:false]}
43. How does JSON being “lightweight” translate into a benefit for the site visitors?
Faster transfer times over the internet
Parsing JSON is noticeably faster than parsing XML
Web apps have a smaller footprint
None of These
44. What error does JSON.parse() throw when the string to parse is not valid JSON?
ReferenceError
EvalError
SyntaxError
TypeError
45. What two structures is JSON built on?
A collection of name/value pairs, and an ordered list of values, or array.
A collection of object/item pairs, and an ordered list of pairs, or array.
A collection of name/value objects, and an ordered list of objects, or array.
A collection of native-value pairs, and an ordered list of arrays, or values.
46. Which of the following is not a valid way to parse JSON string?
JSON.eval()
JSON.parse()
jQuery.parseJSON()
eval()
47. Does whitespace matter in JSON?
No, it will be stripped out.
Yes, only within strings
Yes, only outside of strings
Yes, both inside and outside of strings
48. 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});
{“x”:[‘Ford’,’Toyota’,’BMW’]}
{“x”:{“Ford”,”Toyota”,”BMW”}}
{“x”:[“Ford”,”Toyota”,”BMW”]}
{“cars”:[“Ford”,”Toyota”,”BMW”]}
49. What is the value of json in the following code? var obj = { fruit: ‘apple’, toJSON: function () { return ‘orange’; } }; var json = JSON.stringify({x: obj});
{“x”:”orange”}
{“fruit”:”apple”}
{“x”:”apple”}
{“fruit”:”orange”}
50. What types of values can you have in JSON key:value pairs?
Strings, Arrays, and Primitives
Arrays, Primitives, and Objects stored as strings
Strings, Arrays, Primitives and Objects
Strings only
51. What does JSONP stand for?
JSON Procedures
JSON Parsing
JSON with padding
JSON Programming
52. Which of the following code will not throw an error?
JSON.parse(”);
JSON.parse(null);
JSON.parse();
JSON.parse({});
53. How does JSON handle numeric values that cannot be represented by a sequence of digits (like Infiniti and Nan)?
They are stored as strings and then converted when parsed.
They are not permitted.
They are stored fine but it’s the parsers job to convert them to numeric values.
None of these
54. Which of the following number formats are not used in JSON?
Octal and gate
Octal and binary
Binary and hexadecimal
Octal and hexadecimal
55. What is used by the JSONObject and JSONArray constructors to parse JSON source strings?
JSONTokener
JSONParser
JParser
ParserJ
56. Which statement about the space parameter in JSON.stringify() is false?
It controls spacing in the resulting JSON string
All three statements are false
It removes whitespace
It is an optional parameter
57. JSON stands for ________________
Java Standard Output Network
JavaScript Object Notation
JavaScript Output Name
Java Source Open Network
58. Which is correct format of writting JSON name/value pair
'name : value'
name = 'value'
name = "value"
"name" : "value"
59. Which of the following is not a type in JSON?
date
Object
Array
string
60. Who is the Father of JSON ?
Douglas Crockford
Rasmus Lerdorf
Douglas Michel
Dennis Ritchie
61. . The MIME type of JSON is -
application/json
application/x-json
application/javascript
text/json
62. JSONP stands for -
JSON Parsing
JSON Procedures
JSON Programming
JSON with padding
63. __________is not a valid way to parse JSON string.
JSON.parse()
JSON.eval()
jQuery.parseJSON()
None of the above
64. Which of the following code will throw an error?
JSON.parse(‘{}’);
JSON.parse(null);
JSON.parse(undefined);
JSON.parse(‘[]’);
65. JSON elements are separated by the -
line break
semi-colon
comma
white space
66. Which of following statement is false about the space parameter in JSON.stringify() ?
It controls spacing in the resulting JSON string
It is an optional parameter
It removes whitespace
All are false
67. What extension in used to save a JSON file?
.json .
.js .
javaN
on
68. Can you use a double quote inside a JSON string?
No, you should use single quotes
Yes, if you use the ascii code.
Yes, if it is escaped like ( " )
Yes, you can use it without any special treatment
69. . For What is a JSONStringer used for?
To converts JSON to Java strings
To quickly create JSON text
To quickly create JSON text
To quickly create JSON text
70. What are two main structures compose JSON?
Arrays and Objects
Keys and values
Class and Objects
None of above
Submit