JSON Quiz - Multiple Choice Questions (MCQ)

JSON (JavaScript Object Notation) is a widely used data interchange format known for its simplicity and ease of use. It is often used to transmit data between a server and a web application as an alternative to XML. 

Let's put your JSON knowledge to the test with this JSON Quiz! Each question is multiple-choice, and after each question, you'll find the correct answer along with a detailed explanation. Let's dive in and see how well you know your JSON!

1. What does JSON stand for?

a) JavaScript Oriented Notation 
b) JavaScript Object Notation 
c) Java Ordered Notation 
d) Java Object Notation 

2. What is the file extension commonly used for JSON files? 

a) .xml 
b) .js 
c) .json 
d) .html 

3. How do you represent data in JSON? 

a) Key-Value pairs 
b) Metadata 
c) Binary Data 
d) Key-Object pairs 

4. Is JSON case-sensitive? 

a) Yes 
b) No 

5. Which symbol is used to enclose JSON objects? 

a) [] 
b) () 
c) {} 
d) "" 

6. In JSON, keys must always be of which data type? 

a) String 
b) Number 
c) Boolean 
d) Object 

7. Which symbol is used to separate key-value pairs in JSON? 

a) : 
b) ; 
c) , 
d) = 

8. Can you store functions in JSON? 

a) Yes 
b) No 

9. What can JSON format be used for? 

a) Storing data 
b) Sending data to the server 
c) Receiving data from the server 
d) All of the above 

10. What does the following JSON represent?

{
   "firstName": "Ramesh",
   "lastName":"Fadatare",
   "age": 30,
   "isMarried": false
}
a) An object with four properties 
b) An array with four elements 
c) A string with JSON data 
d) A function with four arguments 

11. How do you represent an array in JSON? 

a) [1, 2, 3] 
b) (1, 2, 3) 
c) {1, 2, 3} 
d) "1, 2, 3" 

12. Which of the following is true about JSON? 

a) JSON is a language 
b) JSON is a database system 
c) JSON is a data format 
d) JSON is an HTML tag 

13. How would you write a Boolean value in JSON? 

a) {'value': true} 
b) {'value': "true"} 
c) {'value': 1} 
d) {'value': 'true'} 

14. JSON can be parsed using which of the following functions in JavaScript? 

a) JSON.parse() 
b) JSON.stringify() 
c) JSON.decode() 
d) JSON.encode() 

15. Can JSON contain a date? 

a) Yes 
b) No 

16. What does the "null" value represent in JSON? 

a) An empty string 
b) Zero 
c) An undefined value 
d) No value or absence of value 

17. How do you access the value "Ramesh" from the following JSON?

{
   "firstName": "Ramesh",
   "lastName":"Fadatare",
   "age": 30,
   "isMarried": false
}
a) json.get("firstName") 
b) json.firstName
c) json["firstName"] 
d) Both b) and c) options are correct

18. How do you access the value "apple" from the following JSON?

{
  "fruits": ["banana", "apple", "orange"]
}
a) json.fruits[0] 
b) json.fruits[1] 
c) json.fruits.apple 
d) json.apple 

19. What is the correct way to represent a nested object in JSON?

a)
{
  "name": "John",
  "address": {
    "city": "New York",
    "country": "USA"
  }
}
b)
{
  "name": "John",
  "address": ("city": "New York", "country": "USA")
}
c)
{
  "name": "John",
  "address": ["city", "New York", "country", "USA"]
}
d)
{
  "name": "John",
  "address": "city: New York, country: USA"
}

20. What is the result of parsing the following JSON?

[
  {
    "name": "Tom",
    "age": 30
  },
  {
    "name": "Lucy",
    "age": 25
  }
]
a) An array of objects 
b) A JavaScript function 
c) A string representation of the JSON 
d) An error, JSON cannot be parsed 

Conclusion

Congratulations on completing the JSON Quiz! JSON is a powerful data interchange format, and understanding its structure and manipulation methods is essential for web developers working with APIs and data transmission. 

Keep practicing and exploring JSON to become proficient in working with data effectively. Happy coding!

Comments

Spring Boot 3 Paid Course Published for Free
on my Java Guides YouTube Channel

Subscribe to my YouTube Channel (165K+ subscribers):
Java Guides Channel

Top 10 My Udemy Courses with Huge Discount:
Udemy Courses - Ramesh Fadatare