JSON Online Quiz

Welcome to our beginner-level JSON quiz, designed to help you test and reinforce your understanding of JSON (JavaScript Object Notation). JSON is a popular data format used primarily to transmit data between a server and a web application. This quiz includes 20 multiple-choice questions that cover basic JSON syntax, structure, and usage. Whether you're just starting out or looking to refresh your knowledge, these questions will guide you through the key concepts of JSON in a clear and simple manner.

1. What does JSON stand for?

a) JavaScript Object Notation
b) Java Simple Object Notation
c) JavaScript Oriented Notation
d) Java Source Open Notation

2. Which of the following is a valid JSON format?

a) {"name": "John", "age": 30}
b) {name: "John", age: "30"}
c) {"name": John, "age": 30}
d) name: "John", age: 30

3. What data types does JSON support?

a) Strings, numbers, arrays
b) Only strings and numbers
c) Strings, numbers, objects, arrays, booleans, and null
d) All data types

4. How do you represent an array of values in JSON?

a) Using parentheses ()
b) Using curly braces {}
c) Using square brackets []
d) Using angle brackets <>

5. Which of the following is NOT a valid JSON object?

a) {"name": "Emma", "age": 28}
b) {"name": "Emma", "age": "28"}
c) {"name": "Emma", "age": null}
d) {"name": "Emma", "age": 28,}

6. In JSON, what does a null value represent?

a) An empty string
b) An undefined or empty value
c) A zero
d) A true or false value

7. How is a boolean value represented in JSON?

a) "true" or "false" as strings
b) true or false without quotes
c) TRUE or FALSE in uppercase
d) 1 for true and 0 for false

8. Which option correctly shows a nested object in JSON?

a) {"person": {"name": "John", "age": 30}, "city": "New York"}
b) {"person": ("name": "John", "age": 30), "city": "New York"}
c) {"person": [name: "John", age: 30], "city": "New York"}
d) {"person": {"name" = "John", "age" = 30}, "city" = "New York"}

9. What should be the file extension for a file containing JSON data?

a) .js
b) .json
c) .java
d) .txt

10. Which of the following is true about JSON?

a) It is a programming language.
b) It supports comments using // or /* */.
c) It is based on a subset of JavaScript.
d) It is less lightweight than XML.

11. How do you write a string in JSON?

a) With single quotes
b) With no quotes
c) With double quotes
d) With backticks

12. What is the primary use of JSON?

a) To write full applications
b) To store data locally in web browsers
c) To transmit data between a server and web applications
d) To increase the speed of programs

13. Can JSON start with an array?

a) Yes, it can start with an array.
b) No, it must start with an object.
c) No, it must start with a string.
d) No, it must start with a key/value pair.

14. Which of the following is the correct way to express an object with multiple key/value pairs in JSON?

a) {"name": "Alice", "age": 25, "city": "Denver"}
b) {"name" = "Alice", "age" = 25, "city" = "Denver"}
c) "name": "Alice", "age": 25, "city": "Denver"
d) name = "Alice", age = 25, city = "Denver"

15. How are numbers represented in JSON?

a) Enclosed in double quotes
b) Enclosed in single quotes
c) Without any quotes
d) With a number sign (#) before them

16. Which of these is a valid JSON array?

a) ["apple", "banana", "cherry"]
b) (apple, banana, cherry)
c) {apple, banana, cherry}
d) <apple, banana, cherry>

17. What error is made in this JSON object? {"name": "Sarah", "age": "29",}

a) The colon is used incorrectly.
b) The comma after the age value should not be there.
c) The quotes around the age value are incorrect.
d) The keys should not be in quotes.

18. Can JSON handle a hexadecimal number like 0xFF?

a) Yes, it can handle any number format.
b) No, it only supports decimal numbers.
c) Yes, but only inside strings.
d) No, it must be converted to binary.

19. Is it mandatory for JSON keys to be unique in an object?

a) Yes, keys must be unique.
b) No, keys can be repeated.
c) Yes, but only in arrays.
d) No, values must be unique, not keys.

20. What is the best practice when naming keys in JSON objects?

a) Use complex and detailed strings as keys.
b) Use simple, descriptive words as keys.
c) Use long sentences as keys.
d) Use non-alphanumeric characters to make it interesting.

Comments