- schema
- $schema
- JsonSchema
- JSONschema
[
'red',
'blue',
'green'
]
- A
["red", "green", "blue"]- B
["red", "blue", "green"]- C
{
"color": "red",
"color": "blue",
"color": "green"
}- D
{
"red": "red",
"blue": "blue"
}- JSON.parse()
- JSON.stringify()
- JSON.toString()
- JSON.objectify()
- string
- number
- date
- array
- unpacking
- serialization
- deserialization
- parsing
accountNum: '000605802'
- "accountNum": "000605802"
- accountNum: "000605802"
- "accountNum": 000605802
- accountNum: 000605802
Q7. What character do you specify before a JSON control character when you want to use that control characters as a literal part of a string?
-
/ -
\ -
: -
{
- Boolean
- map
- promise
- function
- important
- base
- core
- required
{
photo: {
width: 1600,
height: 900,
binaries: {
url: 'https://www.example.com/images/34097349843',
thumbnail: 'https://www.example.com/images/thumbs/34097349843'
},
animated: false,
tags: [116, 943, 234, 38793],
}
}
- A
{
"photo": {
"width": 1600,
"height": 900,
"binaries": {
"url": "https://www.example.com/images/34097349843",
"thumbnail": "https://www.example.com/images/thumbs/34097349843"
},
"animated": "false",
"tags": [116, 943, 234, 38793]
}
}- B
{
"photo": {
"width": 1600,
"height": 900,
"binaries": {
"url": "https://www.example.com/images/34097349843",
"thumbnail": "https://www.example.com/images/thumbs/34097349843"
},
"animated": false,
"tags": [116, 943, 234, 38793]
}
}- C
{
"photo": {
"width": 1600,
"height": 900,
"binaries": {
"url": "https://www.example.com/images/34097349843",
"thumbnail": "https://www.example.com/images/thumbs/34097349843"
},
"animated": true,
"tags": [116, 943, 234, 38793]
}
}- D
{
"photo": {
"width": "1600",
"height": "900",
"binaries": {
"url": "https://www.example.com/images/34097349843",
"thumbnail": "https://www.example.com/images/thumbs/34097349843"
},
"animated": "false",
"tags": ["116", "943", "234", "38793"]
}
}- Escape all whitespaces except space characters.
- Escape line breaks.
- Escape paragraphs.
- Remove all whitespaces
loggedIn: true
- string
- Boolean
- number
- object
Q13. If you need to store the loggedIn status of a user in JSON as a boolean, what is the correct syntax?
- "loggedIn": (true)
- loggedIn: "true"
- "loggedIn": true
- loggedIn: {true}
- an
<origin>element - a header request
- the
<script>element - the XMLHttpRequest object
- undefined
- infinity
- NaN
- null
- JSON.parse()
- JSON.stringify()
- JSON.toString()
- JSON.objectify()
Q17. Transferring JSON information from client to server and back again often includes HTTP requests. Match each method with the best choice describing its use.
1.Sends data to specific server to create or update information.
2.Sends data to specific server to create or update information without the risk of creating the resource more than once.
3.Previews what the GET request response might be without the body of the text.
4.Learns the communication channels used by the target source.
5.Requests information from a specific source.
6.Removes information.
- 1.POST 2.DELETE 3.OPTIONS 4.HEADER 5.GET 6.PUT
- 1.POST 2.PUT 3.HEADER 4.OPTIONS 5.GET 6.DELETE
- A
{
"host": "Atlanta",
"year": 1996
/_ Centennial Olympics _/
}- B
{
"host": "Atlanta",
"year": 1996
// Centennial Olympics
}- C
{
"host": "Atlanta",
"year": 1996,
"comment": "Centennial Olympics"
}- D
{
"host": "Atlanta",
"year": 1996,
\"Centennial Olympics\"
}- E
{
"host": "Atlanta",
"year": 1996,
"comment": "\"Centennial Olympics"
}- yes
- only if there is more than one item
- no
- only when arrays and objects contain more than 10 items
- All whitespace is allowed.
- double quotes, slashes new lines, and carriage returns
- new lines and carriage returns only
- double quotes only
- nested
- comments
- arrays
- null values
-
"'|=(_)(X 72(_)|\/||\*'" -
"|=(_)(X 72(_)|\/||\*" -
"|=(_)(X\" \"72(_)|\/||\*" -
"\s(_)(X 72(_)|\/||\*"
- Convert the date to UTC and enclose in quotes.
- Encode the date as string using the ISO-8601 date format.
- Wrap the date in double quotes.
- Add a "date" key to your object and include the date as string.
JSON.parse({"first": "Sarah", "last": "Connor"}) ;
- JSON should be wrapped with curly braces.
- JSON.parse() is missing an argument.
- The value supplied to JSON.parse() is not a string.
- Nothing is wrong with it.
printNullness(JSON.parse('{ "lemmings": [] }'));
printNullness(JSON.parse('{ "lemmings": null }'));
printNullness(JSON.parse('{ "lemmings": "null" }'));
function printNullness(testMe) {
if (testMe.lemmings == null) console.log('null');
else console.log('not null');
}- A
not null
null
not null
- B
null
null
not null
- C
not null
null
null
- D
null
null
null
- JSONLint
- ValidateJSON
- JSONFiddle
- TextEdit
- double quotes
- smart (curly) quotes
- single or double quotes
- single quotes
Q28. Which code is a valid JSON equivalent of the key/value pair shown that also preserves the data type? constant: 6.022E23
-
"constant": "6.022E23" -
"constant": "6\.022\E23" -
"constant": 6.022E23 -
constant: "6.022E23"
Reference Explanation: Scientific Notation is a valid JSON number. You can use e or E.
-
<object> -
<script> -
<json> -
<meta>
- Because it's object-based.
- Because it's a simple and adaptable format for sharing data.
- Because it's based on JavaScript.
- Because it is derived from SGML.
Q31. You need to assemble a list of members, but your JSON is not parsing correctly. How do you change it?
{
"avengers": [
"iron man",
"hulk",
"thor",
"black widow",
"ant man",
"spider man'
]
}
- A
{
"avengers": ["iron man", "hulk", "thor", "black widow", "ant man", "spider man"]
}- B
{
'avengers': [
{'iron man',
'hulk',
'thor',
'black widow',
'ant man',
'spider man'}
]
}- C
{
"avengers": ["iron man", "hulk", "thor", "black widow", "ant man", "spider man"]
}- D
{
"avengers": {[
"iron man",
"hulk",
"thor",
"black widow",
"ant man",
"spider man"
]}
}Q32. When building dynamic web applications using AJAX, developers originally used the _ data format, which has since been replaced by JSON.
- XML
- GRAPHQL
- REST
- SOAP
- TRUE
- "true"
- 1
- true
- ['tatooine', 'hoth', 'dagobah']
- [tatooine, hoth, dagobah]
- ["tatooine", "hoth", "dagobah",]
- ["tatooine", "hoth", "dagobah"]
[
{
"year": 2024
},
{
"location": "unknown"
}
]- object
- array
- number
- string
- trailing commas
- trailing decimals
- whitespace
- leading zeroes
Q37. When you need to set the value of a key in JSON to be blank, what is the correct syntax for the empty value?
- FALSE
- 0
- ""
- null
- Escape the number with a backslash.
- Enclose the number in double quotes.
- Enclose the number in single quotes.
- Leave the number as is.
- "lastVisit": null
- lastVisit: null
- "lastVisit": 0
- "lastVisit": undefined
- 128514
- d83dde02
- \uD83D\uDE02
- 😂
- "largest": "blue whale"
- largest: 'blue whale'
- 'largest': 'blue whale'
- largest: "blue whale"
- data
- schemadata
- schematype
- type
Q43. Which code is a valid JSON equivalent of the key/value pair shown that also preserves the original value?
- "UPC": \043875
- UPC: "043875"
- "UPC": 043875
- UPC: '043875'
- markdown
- YAML
- XML
- JSON
Q45. Which code is valid JSON equivalent of the key/value pair shown that also preserves the data type?
- "variance": -0.0823
- variance: "-0.0823"
- "variance": "-0.0823"
- variance: -0.0823
- colon
- space
- semicolon
- comma
- :
- ->
- ::
- .
- Wrap line breaks in single quotation marks
- Make no changes, because whitespace is allowed
- Replace any line breaks with
\r - Replace any line breaks with
\n
- Fractional and Transcendental
- Infinity or Rational
- Rational and Irrational
- Infinity or NaN
- As a string with quotes
- As a string without quotes
- As a string in ISO 8583 format
- As a string in ISO 8601 format
- No, emojis must be escaped with a backslash.
- No, JSON strings are not allowed to use emojis.
- No, emojis should never be enclosed with double quotes.
- Yes, emojis are valid characters because JSON strings are unicode.
- list
- array
- struct
- indexed hash
- arrays, strings, numbers, true/false
- hashes, arrays, strings, numbers, booleans, null
- arrays, objects, lists, strings, numbers, booleans
- objects, arrays, strings, numbers, booleans, null
- key: "value"
- "key": "value"
- key, "value"
- 'key': 'value'
{
"result": [
{
"year": 2024
},
{
"location": "unknown"
}
]
}- number
- array
- string
- object
{
"series": "Star Trek",
"episodes": "The Trouble with Tribbles",
"season": 3
}- Key/value pairs should be separated by semicolons.
- Keys should be enclosed with double quotes.
- Key/value pairs should always have a trailing comma.
- Keys and values should be enclosed with single quotes.
- Wrap the comments in single quotes and place it at the bottom of the file.
- Wrap the comments in double parentheses.
- Escape comments by placing two slashes at the start of the comment.
- JSON does not support comments.
"name": 'bb-8'
- name: "bb-8"
- "name": 'bb-8'
- "name": "bb-8"
- "name": bb-8
- with brackets
- with colons
- with commas
- with parentheses
- any language, as JSON is language agnostic.
- Ruby
- JavaScript
- Python
- only numbers
- any valid JSON value
- only strings and numbers
- only strings
- reserialization
- nesting
- memorization
- minimization
-
[] -
{} -
"" -
()
- text/json
- text/javascript
- application/json
- data/json
- /
- "
- -
- :
- to provide a simple way to serialize and deserialize data between different sources
- to provide a way to store data for machine learning
- to provide an archival solution for data warehousing
- to provide a way for JavaScript to run other languages
- No, but you can sort the keys with
JSON.sort(). - Yes, object keys are always ordered alphabetically.
- Yes, but only when the object is first parsed.
- No, you can never assume object keys will be in order.
-
* -
# -
^ -
"
- 10,000
- 1000
- There is no defined limit.
- 1 million
- a swarm
- multiple resources
- a collection
- a group
- yes, but only if they are enclosed in quotes
- only with integers
- yes
- no
- dash and dot
- dash and comma
- comma and exclamation point
- dot and comma
- JSON.ingest()
- JSON.convert()
- JSON.read()
- JSON.parse()
- with right arrows
- with colons
- with semicolons
- with commas
- zero
- one
- two
- three
- arrays; objects
- objects; functions
- arrays; functions
- key/value pairs; arrays
- true, false, null
- true, false
- TRUE, FALSE, NULL
- Remove spaces from the key before accessing the value.
- Use dot notation to access the value.
- Use object key index to access the value.
- Use bracket notation to access the value.
- remove duplicate data from a server
- temporarily store data for faster access
- store excess information in chunks to be reviewed later
- clog up a web browser with useless information
Q80. What is the only valid whitespace character within a string that does not require an escape character?
- line break
- space
- tab
- return
- Store the number as a string
- Convert the number into an exponent.
- Round the number to the nearest 10-digit number.
- Split the number into smaller parts.
Q82. Which code is a valid JSON equivalent of the key/value pair shown that also preserves the data type?
variance: -0.0823
- variance: "-0.0823"
- variance: -0.0823
- "variance": "-0.0823"
- "variance": "-0.0823"
Q83. Based on the JSON object shown, which JavaScript code would you use to find out what is in this vehicle's glove box while assigning the glove box contents to a new variable?
myVehicleContents = {
van: {
inside: {
'glove box': 'maps',
'passenger seat': 'crumbs',
},
exterior: {
trunk: 'jack',
},
},
};- A
myVehicleContents.van.inside['glove box'] = gloveBoxContents;- B
var gloveBoxContents = myVehicleContents.van.inside['glove box'];
gloveBoxContents;- C
var gloveBoxContents = myVehicleContents.van.glove box.contents;
gloveBoxContents;- D
myVehicleContents.van.inside['inside'] = gloveBoxContents;- ||
- {}
- ()
- []
Q85. The JSON structure features nested objects and arrays. Sometimes the data containing these features exists in relational databases. How is the relational structure different that JSON?
- It has a flat architecture.
- It has a rewritable structure.
- It has an array-only structure.
- It has a table structure.
- arrays
- null values
- comments
- nested
YAML supports # comments but not JSON
-
"'|=(_)(X 72(_)|\/||*'" -
"\s(_)(X 72(_)|\/||*" -
"|=(_)(X\" \"72(_)|\/||*" -
"|=(_)(X 72(_)|\/||*"
{"rey",'leia',"ashoka",}
-
['rey', 'leia', "ashoka",} -
['rey', 'leia', 'ashoka',} -
["rey", "leia", "ashoka"] -
{"rey", "leia", "ashoka"}
- zero or more digits
- one or more digits
- a period
- a dollar sign
{
"students": ["Tess", "Erin", "June"]
}- Convert each student to an object, then add key/value paris to each student object as needed.
- Add additional name/value pairs, separated by commas, after "students".
- Convert each student into an array and add extra elements to the array.
- Wrap the existing "students" key with curly braces.
-
99999999999999999999 -
"42" -
-32 -
1111.00.110011
- 512 characters
- There is no defined limit.
- 2,056 characters
- 1,024 characters
{
"name": "Jane",
"job": "developer",
"skills": ["ruby", "rails", "javascript"],
"available": false
}- A
{
"name": "Jane",
"job": "developer",
"skills": ["ruby", "rails", "javascript"],
"available": true,
"seeking": "part-time"
}- B
{
"name": "Jane",
"job": "developer",
"skills": ["ruby", "rails", "javascript"],
"available": "true",
"seeking": "part-time"
}- C
{
"name": "Jane",
"job": "developer",
"skills": ["ruby", "rails", "javascript"],
"available": false,
"seeking": "part-time"
}- D
{
"name": "Jane",
"job": "developer",
"skills": ["ruby", "rails", "javascript"],
"available": "true",
"seeking": "part-time"
}Hint: true needs to be a boolean and part-time a string so in double quotes.
Q95. When you need to set the value of a key in JSON to be blank, what is the correct syntax for the empty value?
- ""
- 0
- FALSE
- null
Explanation: The other options won't work as well, as demonstrated by this StackOverflow post.
A. They are formatted to fit well on a page.
B. They shrink the report data to fit on a page.
C. They truncate the report data to fit on a single page.
D. They are both printable and shareable.
- A,D
- B OR C
- A,B,D
- A,C,D
Explanation: The true statements about paginated reports are: A. They are formatted to fit well on a page. D. They are both printable and shareable. So the correct options are A and D.
Q97. As a Scrum Master you have noticed a pattern that the most interesting stories on the sprint backlog get started right away, and the least interesting stories languish or don't get done. What should you do?
- During story point estimation, increase the points assigned to the least interesting stories so the team can boost their velocity.
- Share your observation with the team and invite them to own and solve the problem.
- Ask the team to use a lottery system to assign each story.
- Ask the Tech Lead to assign every story to a developer so they all get done efficiently and with accountability.
Explanation: Encourage open communication within the team and involve them in problem-solving to find a solution that works best for their specific context and helps address the issue of disinterest in certain stories.
Q99. When you need to set the value of a key in JSON to be blank, what is the correct syntax for the empty value?
- FALSE
- 0
- ""
- null
- an
<origin>element - a header request
- the
<script>element - the XMLHttpRequest object
JSON.parse({"first": "Sarah", "last": "Connor"}) ;
- JSON should be wrapped with curly braces.
- JSON.parse() is missing an argument.
- The value supplied to JSON.parse() is not a string.
- Nothing is wrong with it.
Q103. You need to assemble a list of members, but your JSON is not parsing correctly. How do you change it?
{"avengers": ["iron man", "hulk", "thor", "black widow", "ant man", "spider man" ]}
-
{"avengers": ["iron man", "hulk", "thor", "black widow", "ant man", "spider man"]} -
{'avengers': {'iron man', 'hulk', 'thor', 'black widow', 'ant man', 'spider man'}]} -
{"avengers": ["iron man", "hulk", "thor", "black widow", "ant man", "spider man"]} -
{"avengers": {["iron man", "hulk", "thor", "black widow", "ant man", "spider man" ]}}
- 128514
- d83dde02
- \uD83D\uDE02
- 😂
- Wrap the comments in single quotes and place it at the bottom of the file.
- Wrap the comments in double parentheses.
- Escape comments by placing two slashes at the start of the comment.
- JSON does not support comments.
Q106. What is the purpose of JSON-P (JSON with padding) in web development, and how is it typically used?
- To validate JSON data before parsing it in JavaScript.
- To provide additional padding for JSON objects to improve readability.
- To overcome the same-origin policy limitation when making cross-domain AJAX requests.
- To compress JSON data for faster transmission over the network.
Explanation:- JSON-P, or JSON with padding, serves the purpose of overcoming the same-origin policy limitation in web development. The same-origin policy restricts web pages from making AJAX requests to a different domain for security reasons. JSON-P works by wrapping JSON data in a JavaScript function call, allowing data to be retrieved from an external domain as if it were a script. This technique is commonly used for securely fetching data from external APIs, making it a valuable tool for cross-domain data exchange in web applications.
Q107. In a JSON document, how can you represent a key that contains special characters, such as spaces or hyphens, to ensure proper parsing and access in JavaScript?
- Wrap the key in single quotes.
- Enclose the key in square brackets.
- backslashes before special characters.
- Enclose the key in double quotes.
Explanation:- When you have a key in a JSON document that contains special characters, spaces, or hyphens, it is essential to enclose the key in double quotes. JSON requires keys to be represented within double quotes to ensure proper parsing and access in JavaScript. This ensures that JavaScript can correctly interpret keys with special characters or spaces and access their associated values.
- trailing commas
- trailing decimals
- whitespace
- leading zeroes
- A
{
"host": "Atlanta",
"year": 1996
/_ Centennial Olympics _/
}- B
{
"host": "Atlanta",
"year": 1996
// Centennial Olympics
}- C
{
"host": "Atlanta",
"year": 1996,
"comment": "Centennial Olympics"
}- D
{
"host": "Atlanta",
"year": 1996,
\"Centennial Olympics\"
}- E
{
"host": "Atlanta",
"year": 1996,
"comment": "\"Centennial Olympics"
}[
{
"year": 2024
},
{
"location": "unknown"
}
]- object
- array
- number
- string
-
"'|=(_)(X 72(_)|\/||\*'" -
"|=(_)(X 72(_)|\/||\*" -
"|=(_)(X\" \"72(_)|\/||\*" -
"\s(_)(X 72(_)|\/||\*"
- Whole Numbers and Decimals
- Real Numbers and Fractions
- Integer, Floating Points, and Exponents (Scientific Notation, e.g., 3e4)
- Prime Numbers and Complex Numbers
- To validate JSON data
- To store sensitive information
- To represent information between parties
- To create JSON schemas
- Remote procedure calls encoded in JSON
- Rendering graphics in web applications
- JavaScript execution control
- Data validation in JSON
- JSON uses tags
- XML is more lightweight
- JSON is easier for humans to read
- XML is used for programming, while JSON is for data exchange
Q117. Which HTTP header is commonly used to prevent cross-site scripting (XSS) attacks when working with JSON?
- Content-Encoding
- Access-Control-Allow-Origin
- JSON-Security
- XSS-Prevention
- Combine multiple JSON documents into one
- Partially update a JSON document
- Compress JSON data for storage
- Convert JSON to XML
Q119. Which method is used to parse a JSON string and return a JavaScript object in modern web browsers?
- parseJSON()
- JSON.parse()
- evalJSON()
- loadJSON()
- To enable two-way data binding in JavaScript
- To represent data in a more human-readable format
- To express structured data that is linked to other data
- To create dynamic web pages with JSON
-
[] -
{} -
null -
""
Explanation:
An empty array in JSON is represented by square brackets with nothing inside: []. Curly braces {} represent an empty object, not an array.
-
[] -
{} -
null -
""
Explanation:
An empty object in JSON is represented by curly braces with nothing inside: {}. Square brackets [] represent an empty array, not an object.
- Yes, but they must be enclosed in quotes
- No, spaces are not allowed
- Yes, without quotes
- Only in JSON5
Explanation:
JSON keys can contain spaces, but like all JSON keys, they must be enclosed in double quotes. For example: {"first name": "John"} is valid JSON.
- 10 levels
- 50 levels
- No official limit, but practical limits exist
- 100 levels
Explanation: JSON specification doesn't define a maximum nesting depth, but practical limits exist based on parser implementations. Most parsers handle reasonable nesting (typically 100+ levels), but deeply nested structures can cause performance issues.
-
-42 -
3.14159 -
0xFF -
1.5e-10
Explanation:
Hexadecimal notation like 0xFF is not valid in JSON. JSON only supports decimal numbers, including negative numbers, decimals, and scientific notation.
- Yes, using the Date type
- No, dates must be represented as strings or numbers
- Yes, using ISO 8601 format
- Only in JSON Schema
Explanation: JSON has no native date type. Dates are typically represented as strings (often in ISO 8601 format like "2024-01-01T00:00:00Z") or as numbers (Unix timestamps).
- To compress JSON data
- To define the structure and validation rules for JSON documents
- To convert JSON to XML
- To encrypt JSON data
Explanation: JSON Schema is a vocabulary that allows you to annotate and validate JSON documents, defining the expected structure, data types, and constraints.
-
mandatory -
required -
necessary -
must
Explanation:
The required keyword in JSON Schema specifies an array of property names that must be present in the JSON object.
- The schema name
- The JSON Schema version being used
- The schema author
- The schema description
Explanation:
The $schema keyword identifies which version of the JSON Schema specification the schema is written against.
- Yes, both are supported
- Yes, but only
// - No, JSON does not support comments
- Yes, but only
/* */
Explanation: Standard JSON does not support comments. However, JSON5 (an extension) does support comments. For standard JSON, you can use a special key like "_comment" if you need annotations.
- JSON version 5
- An extension of JSON with additional features like comments and trailing commas
- A compression format for JSON
- A JSON validation tool
Explanation: JSON5 is an extension to JSON that aims to make it easier for humans to write and maintain by adding features like comments, trailing commas, unquoted keys, and more.
- JSON parsing
- Cross-domain data requests (legacy technique)
- JSON compression
- JSON validation
Explanation: JSONP (JSON with Padding) was a technique to request data from a server in a different domain, bypassing same-origin policy. It's now largely replaced by CORS.
-
text/json -
application/json -
application/javascript -
text/javascript
Explanation:
The official MIME type for JSON is application/json. While text/json was sometimes used historically, application/json is the standard.
- Yes, without quotes
- No, keys must be strings
- Yes, but only integers
- Only in JSON5
Explanation:
In JSON, all keys must be strings enclosed in double quotes. Even if a key looks like a number, it must be quoted: {"123": "value"}.
- No difference
- JSON.parse() is safer and only parses JSON, eval() executes any JavaScript
- eval() is faster
- JSON.parse() is deprecated
Explanation:
JSON.parse() is the safe way to parse JSON as it only parses JSON syntax. eval() executes any JavaScript code, making it a security risk if used with untrusted data.
- Converts them to
null - Converts them to
"undefined" - Omits the property entirely
- Throws an error
Explanation:
When JSON.stringify() encounters undefined as a property value in an object, it omits that property from the output. However, undefined in arrays becomes null.
- Indentation
- Replacer function or array to filter/transform values
- Error handling
- Encoding
Explanation: The second parameter (replacer) can be a function that transforms values or an array that specifies which properties to include in the output.
- Indentation (space) for pretty-printing
- Error handling
- Encoding
- Compression
Explanation: The third parameter specifies the indentation for pretty-printing. It can be a number (spaces) or a string (like "\t" for tabs).
- Yes, using special syntax
- No, JSON.stringify() will throw an error
- Yes, but only in JSON5
- Yes, using $ref
Explanation: JSON cannot represent circular references. Attempting to stringify an object with circular references will throw a "TypeError: Converting circular structure to JSON" error.
- A pointer to JSON files
- A syntax for identifying a specific value within a JSON document
- A JSON compression technique
- A JSON validation tool
Explanation: JSON Pointer defines a string syntax for identifying a specific value within a JSON document, like "/users/0/name" to access the name of the first user.
- A JSON bug fix
- A format for expressing a sequence of operations to apply to a JSON document
- A JSON compression format
- A JSON validation format
Explanation: JSON Patch defines a format for expressing a sequence of operations (add, remove, replace, move, copy, test) to modify a JSON document.
- To convert objects to JSON
- To customize how an object is serialized by JSON.stringify()
- To parse JSON strings
- To validate JSON
Explanation:
If an object has a toJSON() method, JSON.stringify() will call it and use its return value instead of the original object.
- Yes, using binary type
- No, but it can be encoded as Base64 strings
- Yes, using hexadecimal
- Only in JSON5
Explanation: JSON has no native binary type. Binary data must be encoded as strings, typically using Base64 encoding.
- 65,536 characters
- 1 MB
- No official limit, depends on implementation
- 2^32 characters
Explanation: The JSON specification doesn't define a maximum string length. Practical limits depend on the parser implementation and available memory.
- JSON Remote Procedure
- A remote procedure call protocol encoded in JSON
- A JSON compression protocol
- A JSON validation protocol
Explanation: JSON-RPC is a stateless, light-weight remote procedure call (RPC) protocol that uses JSON to encode calls and responses.
- JSON for geography classes
- A format for encoding geographic data structures
- Geographical JSON compression
- A JSON validation tool for maps
Explanation: GeoJSON is a format for encoding a variety of geographic data structures using JSON, commonly used in mapping applications.
- To validate JSON
- To transform values during parsing
- To handle errors
- To format output
Explanation:
The reviver parameter is a function that can transform the parsed values before they are returned, useful for converting strings to dates or other custom transformations.
- Yes, all duplicates are kept
- Technically yes, but behavior is undefined; last value typically wins
- No, parser will throw an error
- Yes, but only in JSON5
Explanation: While JSON parsers typically accept duplicate keys, the behavior is undefined in the specification. Most implementations use the last value, but this should be avoided.
- Binary JSON
- Binary JSON, a binary-encoded serialization of JSON-like documents
- Better JSON
- Basic JSON
Explanation: BSON (Binary JSON) is a binary-encoded serialization format used by MongoDB. It extends JSON with additional data types like Date and Binary.
- A JSON messaging protocol
- An efficient binary serialization format similar to JSON
- A JSON compression algorithm
- A JSON validation tool
Explanation: MessagePack is an efficient binary serialization format that is more compact than JSON and supports additional types.
-
true -
True -
"true" -
1
Explanation:
JSON boolean values are lowercase: true and false. They are not strings and not capitalized.
-
null -
NULL -
"null" -
undefined
Explanation:
The null value in JSON is lowercase: null. It is not a string and not capitalized. undefined is not a valid JSON value.
- Yes, using function type
- No, JSON cannot represent functions
- Yes, as strings
- Only in JSON5
Explanation: JSON cannot represent functions. If you try to stringify an object with function properties, those properties will be omitted.
- A JSON validation token
- A compact, URL-safe means of representing claims between two parties
- A JSON encryption method
- A JSON compression token
Explanation: JWT is a standard for creating access tokens that assert claims. It consists of three parts: header, payload (JSON), and signature.
- Header, Body, Footer
- Header, Payload, Signature
- Type, Data, Hash
- Version, Content, Checksum
Explanation: A JWT consists of three Base64-encoded parts separated by dots: Header (algorithm and type), Payload (claims), and Signature (verification).
- To name the schema
- To specify the data type of a value
- To define custom types
- To import types
Explanation:
The type keyword in JSON Schema specifies the data type: "string", "number", "integer", "boolean", "array", "object", or "null".
- To enumerate properties
- To restrict a value to a fixed set of values
- To create enumerations
- To count items
Explanation:
The enum keyword restricts a value to one of a fixed set of values, like {"enum": ["red", "green", "blue"]}.
- To define patterns
- To validate strings against a regular expression
- To create patterns
- To match patterns
Explanation:
The pattern keyword specifies a regular expression that a string value must match to be valid.
- The smallest number
- The minimum value a number can have
- The minimum length
- The minimum items
Explanation:
The minimum keyword specifies the minimum value (inclusive) that a numeric value can have.
- The maximum string
- The maximum length of a string
- The maximum size
- The maximum value
Explanation:
The maxLength keyword specifies the maximum length (number of characters) that a string value can have.
- JSON Loading
- Linking data and adding semantic meaning to JSON
- JSON Linting
- JSON Debugging
Explanation: JSON-LD (JSON for Linking Data) is a method of encoding linked data using JSON, adding semantic meaning and context to data.
- The context menu
- Defines how terms in the document map to IRIs
- The execution context
- The document context
Explanation:
The @context keyword in JSON-LD defines the context for interpreting the JSON document, mapping terms to IRIs (Internationalized Resource Identifiers).
- Yes, using
Infinity - No, JSON numbers cannot represent infinity
- Yes, using
"Infinity" - Only in JSON5
Explanation:
JSON numbers cannot represent infinity or NaN. Attempting to stringify these values results in null.
-
"" -
\" -
'" -
"
Explanation:
Double quotes inside JSON strings must be escaped with a backslash: \". For example: "He said \"Hello\"".
-
\r -
\n - A literal newline
-
<br>
Explanation:
Newlines in JSON strings are represented by the escape sequence \n. Literal newlines are not allowed in JSON strings.
- Four spaces
-
\t - A literal tab
-
\tab
Explanation:
Tabs in JSON strings are represented by the escape sequence \t. Literal tabs are not allowed in JSON strings.
-
\\ -
/ -
\ -
//
Explanation:
Backslashes in JSON strings must be escaped with another backslash: \\. For example: "C:\\Users\\Name".
- Yes, using \uXXXX escape sequences or directly
- No, only ASCII
- Yes, but only in JSON5
- Yes, but only with special encoding
Explanation:
JSON supports Unicode characters either directly (if the file is UTF-8 encoded) or using \uXXXX escape sequences where XXXX is the hexadecimal code point.
- To add more properties
- To control whether properties not defined in the schema are allowed
- To define additional schemas
- To add property metadata
Explanation:
The additionalProperties keyword determines whether properties not explicitly defined in the schema are allowed in the JSON object.
- To count items
- To define the schema for array elements
- To list items
- To add items
Explanation:
The items keyword in JSON Schema defines the schema that array elements must conform to.
- A reference number
- To reference another schema or schema definition
- A reference type
- A reference counter
Explanation:
The $ref keyword allows you to reference another schema or a definition within the same schema, enabling schema reuse.
- To define terms
- To define reusable schema components
- To create definitions
- To list definitions
Explanation:
The definitions (or $defs in newer versions) keyword allows you to define reusable schema components that can be referenced with $ref.
- All of the schemas
- Requires the data to be valid against all of the given schemas
- All properties
- All items
Explanation:
The allOf keyword requires that the data validates against all of the schemas in the array, useful for combining schemas.
- Any of the properties
- Requires the data to be valid against any (one or more) of the given schemas
- Any items
- Any values
Explanation:
The anyOf keyword requires that the data validates against at least one of the schemas in the array.
- One of the properties
- Requires the data to be valid against exactly one of the given schemas
- One item
- One value
Explanation:
The oneOf keyword requires that the data validates against exactly one (and only one) of the schemas in the array.
- To negate values
- Requires the data to NOT be valid against the given schema
- To exclude properties
- To deny access
Explanation:
The not keyword requires that the data does not validate against the given schema, useful for excluding certain patterns.
- JSON security protocol
- HTTP header that can restrict JSON loading from external sources
- JSON encryption standard
- JSON validation policy
Explanation: Content Security Policy is an HTTP header that helps prevent XSS attacks. It can restrict which sources can load JSON and other resources.
- To format output
- To specify semantic validation for strings (email, uri, date, etc.)
- To format JSON
- To create formats
Explanation:
The format keyword provides semantic validation for string values, like "email", "uri", "date-time", "ipv4", etc.
- A hyperlinked JSON
- An extension of JSON Schema for describing hypermedia APIs
- A JSON compression format
- A JSON validation tool
Explanation: JSON Hyper-Schema extends JSON Schema to describe hypermedia APIs, including links and link relations.
- Load everything into memory
- Use streaming parsers for large files
- Compress before parsing
- Split into multiple files
Explanation: For large JSON files, streaming parsers (like SAX-style parsers) are recommended as they process the file incrementally without loading everything into memory.
- \tab
- \t
- \t
- A JSON validation tool
- A specification for building APIs in JSON
- A JSON compression format
- A JSON encryption method
- They are identical
- GraphQL uses JSON for data exchange but provides a query language
- GraphQL cannot use JSON
- JSON is a replacement for GraphQL
- To define external dependencies
- To specify property dependencies (if one property exists, others must too)
- To define package dependencies
- To create circular references
- \cr
- \r
- \r
- To define constants
- To specify that a value must be exactly equal to the given value
- To define immutable properties
- To create constant arrays
- "true"
- TRUE
- true
- 1
- To define arrays
- To specify that a number must be a multiple of the given value
- To define multiple properties
- To create multiplication operations
- \ff
- \f
- \f
- A JSON compression method
- A format for expressing partial modifications to a JSON document
- A JSON validation tool
- A JSON encryption method
- REST APIs cannot use JSON
- JSON is the most common format for REST API data exchange
- REST APIs must use XML
- JSON and REST are incompatible
- To define conditional logic in data
- To apply conditional validation based on property values
- To create if-else statements
- To define optional properties
- 255
- 65,536
- No defined maximum, depends on implementation
- 1 million
- To list all property names
- To validate the names of properties in an object
- To define required properties
- To create property aliases
- NoSQL databases cannot store JSON
- Many NoSQL databases natively support JSON documents
- JSON is only for SQL databases
- NoSQL requires XML instead of JSON
- To define the data type
- To specify the MIME type of string content
- To compress content
- To encrypt content
- \bs
- \b
- \b
- A JSON compression context
- A way to map terms to IRIs in JSON-LD
- A JSON validation context
- A JSON encryption context
- Microservices cannot use JSON
- JSON is commonly used for inter-service communication in microservices
- Microservices require XML
- JSON is too slow for microservices
- To define character encoding
- To specify the encoding used for string content (e.g., base64)
- To compress content
- To encrypt content
- null
- ""
- { }
- [ ]
- A JSON compression feed
- A format for syndicating content similar to RSS/Atom but using JSON
- A JSON validation feed
- A JSON encryption feed
- WebSockets cannot transmit JSON
- JSON is commonly used as the message format in WebSocket communication
- WebSockets require binary data only
- JSON and WebSockets are incompatible
- To define read-only files
- To indicate that a property should not be modified by clients
- To create immutable objects
- To define constants
- NaN
- "NaN"
- 0/0
- JSON does not support NaN
- A JSON compression tool
- A JSON-based standard for resumes
- A JSON validation tool
- A JSON encryption method
- JSON prevents CORS issues
- CORS policies apply to JSON API requests from browsers
- JSON bypasses CORS
- CORS only applies to XML
- To define write-only files
- To indicate that a property should not be returned in responses
- To create write-protected objects
- To define mutable properties
- 10 levels
- 100 levels
- No defined maximum, depends on implementation
- 1000 levels
- A JSON validation tool
- A JSON format for statistical data dissemination
- A JSON compression format
- A JSON encryption method
- JSON cannot be cached
- JSON responses can be cached using HTTP caching headers
- JSON requires special caching mechanisms
- Caching is disabled for JSON
- To define required examples
- To provide sample values that validate against the schema
- To create example objects
- To validate examples
- \u{1F600}
- \u1F600 (for BMP) or \uD83D\uDE00 (surrogate pair for non-BMP)
- 😀
- U+1F600
- A JSON compression format
- A specification for describing tabular data in JSON
- A JSON validation tool
- A JSON encryption method
- JSON doesn't support ETags
- ETags can be used with JSON responses for cache validation
- ETags are only for HTML
- JSON requires special ETag handling
- To delete properties
- To indicate that a property or schema is deprecated
- To remove validation
- To create legacy schemas
- \
- \
- \\
- /
- A JSON compression frame
- A way to shape JSON-LD data into a specific structure
- A JSON validation frame
- A JSON encryption frame
- JSON doesn't support pagination
- JSON APIs commonly implement pagination using metadata fields
- Pagination requires XML
- JSON automatically paginates data
- To define the data type
- To provide human-readable information about the schema
- To validate titles
- To create documentation
- 3 levels
- 5 levels
- No strict limit, but 5-7 levels is generally recommended
- 10 levels
- { "date": new Date() }
- { "date": "2024-01-15T10:30:00Z" }
- { "date": Date.now() }
- { "date": 2024-01-15 }
- Compressing JSON data
- Converting an object or data structure into a JSON string
- Encrypting JSON data
- Validating JSON syntax
- They are identical
-
nullis a valid JSON value,undefinedis not -
undefinedis a valid JSON value,nullis not - Both are invalid in JSON
- Encrypting JSON data
- Defining a string syntax for identifying a specific value within a JSON document
- Compressing JSON files
- Converting JSON to XML
- 201
- 200
- 204
- 202
- To compress JSON data
- To validate JSON structure
- To encrypt JSON data for secure transmission
- To convert JSON to binary format
Q228. In a RESTful API, which HTTP method is typically used to send JSON data for creating a new resource?
- GET
- POST
- PUT
- DELETE
- text/json
- application/json
- application/x-json
- text/plain
- JSONLint only
- ESLint
- JSON Schema validators like Ajv
- JSHint
- To define the data type
- To specify which version of JSON Schema the schema follows
- To encrypt the schema
- To compress the schema
- { null }
- {}
- { "" }
- { empty }
- A JSON compression algorithm
- Binary JSON, a binary-encoded serialization of JSON-like documents
- A JSON validation tool
- A JSON encryption method
- They are identical
- JSONP is a technique for requesting data by loading a script tag
- JSONP is more secure than JSON
- JSON cannot be used in browsers
- 255 characters
- 65,536 characters
- No defined maximum, depends on implementation
- 1 million characters
- ASCII
- ISO-8859-1
- UTF-8 (or UTF-16/UTF-32)
- ANSI
- To compress JSON files
- To define a format for expressing a sequence of operations to apply to a JSON document
- To encrypt JSON data
- To convert JSON to XML
- The data type of a property
- Which properties must be present in the object
- The maximum value of a number
- The format of a string
- stringify converts objects to strings, parse converts strings to objects
- They perform the same function
- stringify validates JSON, parse creates JSON
- parse converts objects to strings, stringify converts strings to objects
- // comment
- /_ comment _/
- # comment
- JSON does not support comments
- The fifth version of JSON
- An extension to JSON that allows comments and other JavaScript features
- A compression format for JSON
- A JSON validation tool
- "false"
- FALSE
- false
- 0
- To define required properties
- To specify whether properties not defined in the schema are allowed
- To set default values
- To define the data type
- They are identical
- JSON is a subset of JavaScript object literal notation
- JavaScript objects are a subset of JSON
- They are completely different
- To compress JSON data
- To digitally sign JSON data to ensure integrity and authenticity
- To encrypt JSON data
- To validate JSON syntax
- Success
- Bad Request (invalid JSON or request)
- Not Found
- Server Error
Q247. What is the recommended way to handle large numbers in JSON that exceed JavaScript's Number.MAX_SAFE_INTEGER?
- Use scientific notation
- Represent them as strings
- Split them into multiple numbers
- Use hexadecimal format
- [1, 2, 3,]
- [1, 2, 3]
- [1; 2; 3]
- {1, 2, 3}
- To define numeric types
- To restrict a value to a fixed set of values
- To enable enumeration of properties
- To define array types
- "null"
- NULL
- null
- undefined
- A JSON compression protocol
- A remote procedure call protocol encoded in JSON
- A JSON validation standard
- A JSON encryption method
- They must be valid JavaScript identifiers
- They must be strings enclosed in double quotes
- They can be numbers
- They can be boolean values
- To define references to external files
- To reference and reuse schema definitions
- To create circular references
- To define relationships between objects
- '"'
- "
- ""
-
"
- 1 MB
- 10 MB
- No defined maximum, depends on implementation and available memory
- 100 MB
- Storing binary data
- Executing code
- Data interchange between client and server
- Creating user interfaces
- To define the data type
- To specify semantic validation for strings (e.g., email, uri, date-time)
- To format output
- To compress data
- { }
- [ ]
- null
- ""
- They are identical
- JSON is more lightweight and easier to parse than XML
- XML is more lightweight than JSON
- JSON supports attributes, XML doesn't
- To define a single property
- To validate that data matches exactly one of the specified schemas
- To define optional properties
- To create unions of types
- 1.5 * 10^3
- 1.5e3
- 1.5E+3 only
- Scientific notation is not supported
- A JSON compression format
- A format where each line is a valid JSON value
- A JSON validation tool
- A JSON encryption method
- Accept: application/json
- Content-Type: application/json
- Content-Encoding: json
- Transfer-Encoding: json
- To define all required properties
- To validate that data matches all of the specified schemas
- To define all possible values
- To create arrays
- "-5"
- -5
- (-5)
- minus 5
- To define the data type
- To specify a default value if the property is not present
- To define required properties
- To validate the schema
- They are identical
- YAML is a superset of JSON (all JSON is valid YAML)
- JSON is a superset of YAML
- They are completely incompatible
- To define any data type
- To validate that data matches at least one of the specified schemas
- To define optional properties
- To create arrays
- "3.14"
- 3.14
- 3,14
- 3.14f
- To define null values
- To validate that data does NOT match the specified schema
- To negate boolean values
- To define optional properties
- 0x1F
- 077
- 31
- 31L
- To define array sizes
- To specify minimum and maximum string lengths
- To define number ranges
- To define object sizes
- null
- {}
- { "" }
- undefined
- A JSON compression format
- An extension of JSON Schema for defining hypermedia APIs
- A JSON validation tool
- A JSON encryption method
- Properties must be in alphabetical order
- JSON objects are unordered collections of key-value pairs
- Properties must be in the order they were defined
- JSON requires a specific property order
- To define string lengths
- To specify minimum and maximum numeric values
- To define array sizes
- To define date ranges
- Infinity
- "Infinity"
- 1/0
- JSON does not support infinity
- To define design patterns
- To specify a regular expression that a string must match
- To define repeating structures
- To create templates
- MongoDB stores data in JSON format
- MongoDB stores data in BSON (Binary JSON) format
- MongoDB cannot work with JSON
- JSON and BSON are identical
- To define unique object properties
- To specify that all items in an array must be unique
- To create unique identifiers
- To validate unique keys
Q281. What is the purpose of JSON-P (JSON with padding) in web development, and how is it typically used?
- A. To validate JSON data before parsing it in JavaScript.
- B. To provide additional padding for JSON objects to improve readability.
- C. To overcome the same-origin policy limitation when making cross-domain AJAX requests.
- D. To compress JSON data for faster transmission over the network.
Q282. In a JSON document, how can you represent a key that contains special characters, such as spaces or hyphens, to ensure proper parsing and access in JavaScript?
- A. Wrap the key in single quotes.
- B. Enclose the key in square brackets.
- C. Use backslashes before special characters.
- D. Enclose the key in double quotes.
