json-quiz

Q1. By convention, what name is used for the first key in a JSON schema?

  • schema

  • [βœ…] $schema

  • JsonSchema

  • JSONschema

Q2. Which code is the closest JSON equivalent of the data shown?

[
    'red',
    'blue',
    'green'
]
  • [ ]

  • [_]

  • [βœ…]

{
  "color": "red",
  "color": "blue",
  "color": "green"
}
  • [ ]

{
  "red": "red",
  "blue": "blue"
}

Q3. Which JavaScript method converts a JavaScript value to Json?

  • JSON.parse()

  • [βœ…] JSON.stringify()

  • JSON.toString()

  • JSON.objectify()

Q4. Which data type is NOT part of JSON standard?

  • string

  • number

  • [βœ…] date

  • array

Q5. Which term is commonly used to refer to converting data to JSON?

  • unpacking

  • [βœ…] serialization

  • deserialization

  • parsing

Q6. Which code uses the correct JSON syntax to encode the key/value pair shown?

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?

  • /

  • [βœ…] \

  • :

  • {

Q8. Which date type is part of the JSON standard?

  • [βœ…] Boolean

  • map

  • promise

  • function

Q9. Which key name is used to specify properties that must be included for JSON to be valid?

  • important

  • base

  • core

  • [βœ…] required

Q10. Which is the valid JSON equivalent of the data shown?

{
    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],
    }
}
  • [ ]

{
  "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]
  }
}
  • [ ]

{
  "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]
  }
}
  • [βœ…]

{
  "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]
  }
}
  • [ ]

{
  "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"]
  }
}

Q11. How do you store several paragraphs of text as a string in JSON?

  • [βœ…] Escape all whitespaces expect space characters.

  • Escape line breaks.

  • Escape paragraphs.

  • Remove all whitespaces

Q12. What data type is represented by the value of the key/value pair shown?

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}

Q14. What does JSON with padding (JSON-P) use to make a request?

  • an <origin> element

  • a header request

  • [βœ…] the <script> element

  • the XMLHttpRequest object

Q15. Which value is supported in the JSON specifications?

  • undefined

  • infinity

  • NaN

  • [βœ…] null

Q16. Which JavaScript method converts JSON to a JavaScript value?

  • [βœ…] 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

  • 1.POST 2.DELETE 3.OPTIONS 4.HEADER 5.GET 6.PUT

  • [βœ…] 1.POST 2.PUT 3.HEADER 4.OPTIONS 5.GET 6.DELETE

Q18. Which code uses valid JSON syntax for the text β€œCentennial Olympics?

  • [ ]

{
"host": "Atlanta",
"year": 1996
/_ Centennial Olympics _/
}
  • [ ]

{
"host": "Atlanta",
"year": 1996,
/_ Centennial Olympics _/
}
  • [ ]

{
  "host": "Atlanta",
  "year": 1996
  // Centennial Olympics
}
  • [βœ…]

{
  "host": "Atlanta",
  "year": 1996,
  "comments": "Centennial Olympics"
}

Q19. Can trailing commas be used in objects and arrays?

  • yes

  • only if there is more than one item

  • [βœ…] no

  • only when arrays and objects contain more than 10 items

Q20. Which whitespace characters should be escaped within a string?

  • All whitespace is allowed.

  • double quotes, slashes new lines, and carriage returns

  • [βœ…] new lines and carriage returns only

  • double quotes only

Q21. Which is supported by YAML but not supported by JSON?

  • nested

  • [βœ…] comments

  • arrays

  • null values

Q22. Which is an invalid JSON value?

  • β€œβ€˜|=()(X 72()|/||*’”

  • β€œ|=()(X 72()|/||*”

  • β€œ|=()(X" "72()|/||*”

  • [βœ…] β€œ()(X 72()|/||*”

Q23. How do you encode a date in JSON?

  • 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.

Q24. What’s wrong with this JavaScript?

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.

Q25. What does this JavaScript code print?

printNullness(JSON.parse('{ "lemmings": [] }'));
printNullness(JSON.parse('{ "lemmings": null }'));
printNullness(JSON.parse('{ "lemmings": "null" }'));

function printNullness() {
  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

Q26. What tool might you use to validate your JSON?

  • [βœ…] JSONLint

  • ValidateJSON

  • JSONFiddle

  • TextEdit

Q27. What characters denote strings in JSON?

  • [βœ…] 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"

Explanation: Scientific Notation is a valid JSON number. You can use e or E. (Reference)

Q29. Which element is added to the DOM to create a JSON-P request?

  • <object>

  • [βœ…] <script>

  • <json>

  • <meta>

Q30. Why do so many APIs use JSON?

  • 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

Q33. How is a true boolean value represented in JSON?

  • TRUE

  • β€œtrue”

  • 1

  • [βœ…] true

Q34. Which array is valid JSON?

  • [β€˜tatooine’, β€˜hoth’, β€˜dagobah’]

  • [tatooine, hoth, dagobah]

  • [β€œtatooine”, β€œhoth”, β€œdagobah”,]

  • [βœ…] [β€œtatooine”, β€œhoth”, β€œdagobah”]

Q35. What data type is encoded in the outermost component of the JSON shown?

[
  {
    "year": 2024
  },
  {
    "location": "unknown"
  }
]
  • object

  • [βœ…] array

  • number

  • string

Q36. Which is ignored by JSON but treated as significant by YAML?

  • 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

Q38. How do you assign a number value in JSON?

  • Escape the number with a backslash.

  • Enclose the number in double quotes.

  • Enclose the number in single quotes.

  • [βœ…] Leave the number as is.

Q39. Which code uses the correct JSON syntax for encoding a key/value pair with a null value?

  • [βœ…] β€œlastVisit”: β€œnull”

  • lastVisit: null

  • β€œlastVisit”: 0

  • β€œlastVisit”: undefined

Note: None of the above options appear to be correct. A correct answer would be "lastVisit": null

Q40. Which reference to the Unicode character U+1F602 complies with the JSON standard?

  • 128514

  • d83dde02

  • [βœ…] 83D

  • &#128514;

Q41. Which code uses the correct JSON syntax for a key/Value pair containing a string?

  • [βœ…] β€œlargest”: β€œblue whale”

  • largest: β€˜blue whale’

  • β€˜largest’: β€˜blue whale’

  • largest: β€œblue whale”

Q42. Which key name is used to specify data type in a JSON schema?

  • 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’

NONE OF THESE ARE CORRECT A CORRECT ANSWER WOULD LOOK LIKE "UPC": "043875"

Q44. Which data format is a JSON schema written in?

  • 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

Q46. With what character should key/value pairs be separated?

  • [βœ…] colon

  • space

  • semicolon

  • comma

Q47. What character separates keys from values?

  • [βœ…] :

  • ->

  • ::

  • .

Q48. If a string contains line breaks, what should you do?

  • Wrap line breaks in single quotation marks

  • Make no changes, because whitespace is allowed

  • Replace any line breaks with

  • [βœ…] Replace any line breaks with

Q49. Which number types are available in javascript but not supported in json?

  • Fractional and Transcendental

  • Infinity or Rational

  • Rational and Irrational

  • [βœ…] Infinity or NaN

Q50. How should a date value be stored in JSON?

  • As a string with quotes

  • As a string without quotes

  • As a string in ISO 8583 format

  • [βœ…] As a string in ISO 8601 format

Q51. Is the JSON code shown here valid?

  • 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.

Q52. What data structure do you use to encode ordered information?

  • list

  • [βœ…] array

  • struct

  • indexed hash

Q53. What are valid values in JSON?

  • arrays, strings, numbers, true/false

  • hashes, arrays, strings, numbers, booleans, null

  • arrays, objects, lists, strings, numbers, booleans

  • [βœ…] objects, arrays, strings, numbers, booleans, null

Q54. Which key format is valid JSON?

  • key: β€œvalue”

  • [βœ…] β€œkey”: β€œvalue”

  • key, β€œvalue”

  • β€˜key’: β€˜value’

Q55. What data type is encoded in the outermost component of the JSON shown?

{
  "result": [
    {
      "year": 2024
    },
    {
      "location": "unknown"
    }
  ]
}
  • number

  • array

  • string

  • [βœ…] object

Q56. What’s wrong with this JSON object?

{
  "series": "Star Trek",
  "episodes": "The Trouble with Tribbles"
}
  • 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.

Q58. How would you make the following string valid in JSON?

  • name: β€œbb-8”

  • β€œname”: 'bb-8'

  • [βœ…] β€œname”: β€œbb-8”

  • β€œname”: bb-8

Q59. How are values separated in JSON?

  • with brackets

  • with colons

  • [βœ…] with commas

  • with parentheses

Q60. With which programming language is JSON best used?

  • [βœ…] any language, as JSON is language agnostic.

  • Ruby

  • JavaScript

  • Python

Q61. What values can arrays contain?

  • only numbers

  • [βœ…] any valid JSON value

  • only strings and numbers

  • only strings

Q62. What technique can be used to represent complex objects with JSON?

  • reserialization

  • [βœ…] nesting

  • memorization

  • minimization

Q63. What characters are used to enclose an array?

  • [βœ…] []

  • {}

  • β€œβ€

  • ()

Q64. What is the official MIME type for JSON?

  • text/json

  • text/javascript

  • [βœ…] application/json

  • data/json

Q65. What character cannot be part of string within JSON without additional formatting?

  • /

  • [βœ…] ”

  • -

  • :

Q66. Which data type is part of the JSON standard?

  • function

  • promise

  • [βœ…] Boolean

  • map

Q67. Which data type is not part of the JSON standard?

  • number

  • string

  • array

  • [βœ…] date

Q68. Which character separates keys from values?

  • [βœ…] :

  • ->

  • ::

  • .

Q69. What is the purpose of 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

Q70. Can you assume the order of keys in an object?

  • [βœ…] 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.

Q71. With what character should object keys be enclosed?

  • *

  • #

  • ^

  • [βœ…] "

Q72. What is the maximum number of key/value pairs that JSON supports?

  • 10,000

  • 1000

  • [βœ…] There is no defined limit.

  • 1 million

Q73. What is the recommended term used to refer to multiple resources?

  • a swarm

  • [βœ…] multiple resources

  • a collection

  • a group

Q74. Does JSON support signed numbers?

  • yes, but only if they are enclosed in quotes

  • only with integers

  • [βœ…] no

  • yes

Q75. What two nonnumerical characters can numbers contain?

  • [βœ…] dash and dot

  • dash and comma

  • comma and exclamation point

  • dot and comma

Q76. What JavaScript method is used to load JSON data?

  • JSON.ingest()

  • JSON.convert()

  • JSON.read()

  • [βœ…] JSON.parse()

Q77. How are the values in an array separated?

  • with right arrows

  • with colons

  • with semicolons

  • [βœ…] with commas

Q78. What is the minimum number of values in an array?

  • [βœ…] zero

  • one

  • two

  • three

Q79. In JSON, a set of brackets ([]) is used to denote _, whereas curly braces ({}) denote _.

  • [βœ…] arrays; objects

  • objects; functions

  • arrays; functions

  • key/value pairs; arrays

Q80. How does JSON represent truth, falsity and nullness?

  • [βœ…] true, false, null

  • true, false

  • TRUE, FALSE, NULL

  • true, false, null

Q81. Which character cannot be part of string data within JSON without additional formatting?

  • /

  • [βœ…] ”

  • :

  • -

Q82. If an object key contains spaces, how can you access its value in JavaScript?

  • 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.

Q83. When parsing JSON, β€œcaching” is a method used to _.

  • 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

Q84. What is the only valid whitespace character within a string that does not require an escape character?

  • line break

  • [βœ…] space

  • tab

  • return

Q85. What technique can you use to safely encode very large numbers?

  • [βœ…] 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.

Last updated