04 - JSON and XML Comparison

 1. JSON and XML are the two _________________________________________________ between the server and the web application.

  methods for detecting IP addresses and connecting to the internet

  typical search engines used for communicating

  standard methods for transferring data

  file formats used to block unauthorised communication

 2. XML uses curly braces as part of its format and JSON uses angle brackets.



 3. The features of JSON include:

  It is easier to create and easier for computers to parse/quicker to parse

  All of the above options are valid features/advantags of JSON

  it is easy for a human to read

  it is compact (arguably more compact and concise than XML)

 4. The syntax and structure of JSON is simple and straightforward however, it does not allow the use of arrays.



 5. Both JSON and XML can be used to receive data from a web server



 6. Which of the following examples of JSON and what is the example actually doing?
Example 1

    { "firstName":"John", "lastName":"Doe" },
    { "firstName":"Anna", "lastName":"Smith" },
    { "firstName":"Peter", "lastName":"Jones" }

Example 2
        <firstName>John</firstName> <lastName>Doe</lastName>
        <firstName>Anna</firstName> <lastName>Smith</lastName>
        <firstName>Peter</firstName> <lastName>Jones</lastName>

  The first example is JSON and it defines a single array with one object (i.e name) in it.

  The first example is JSON and it defines an employees object, with an array of 3 employees

  The second example of JSON and it defines an employees object with an array of three names

  The second example is JSON and it defines a 'Name' object with three names

 7. JSON is like XML for the following reason …..

  They are both heirarchical (values within values) and can be fetched with an XMLHttpRequest

  Both can be parsed and used by different programming languages

  They are both 'self describing' - this means they are human readable

  All of the above options are valid similarities between JSON and XML

 8. Which of the following in the list are differences between JSON and XML?
JSON doesn't use end tag
JSON is self describing - human readable
JSON is shorter
JSON can be fetched with an XMLHttpRequest
JSON is quicker to read and write
JSON can use arrays
XML has to be parsed with an XML parser. 
JSON can be parsed by a standard JavaScript function.

  All of them, except Point 2. and Point 4.

  All of them except for Point 1, Point 2, Point 3, and Point 6

  The only valid differences between JSON and XML are the fact that JSON is shorter and can use arrays

  The only valid difference on the list is the fact that JSON doesn't use an end tag. Otherwise, they are completely alike.

 9. The general consensus/agreement is that XML is much more difficult to _________ than JSON

  parse (parsing generally means interpreting)


  define (create or decide a definition for)


 10. JSON is parsed into a ____________________________

  ready-to-use JavaScript object

  ready-made XML formatted sheet

  CPU (directly)

  finite set of bits

 11. Generally speaking, XML is considered more 'lightweight' than JSON



 12. JSON is built on two structures - one of them is similar to a _____________ in python. (a collection of key or name/value pairs)


  binary tree



 13. JSON is a language-independent data format. It was derived from ___________ but as of 2017 many programming languages include code to generate and parse JSON-format data





 14. What is the following JSON 'snippet' describing?
  "firstName": "John",
  "lastName": "Smith",
  "isAlive": true,
  "age": 27,
  "address": {
    "streetAddress": "21 2nd Street",
    "city": "New York",
    "state": "NY",
    "postalCode": "10021-3100"
  "phoneNumbers": [
      "type": "home",
      "number": "212 555-1234"
      "type": "office",
      "number": "646 555-4567"
      "type": "mobile",
      "number": "123 456-7890"
  "children": [],
  "spouse": null

  a single data type

  an address

  an array of different objects, e.g. addresses, humans, mobiles

  a person

 15. JSON stands for JavaScript Object Notation and it’s a data format.