JSON MCQs – Introduction to JSON

11.) How are key-value pairs separated in a JSON object?

A) Colon (:)
B) Semicolon (;)
C) Equal sign (=)
D) Comma (,)

Answer: Option A

Explanation: Key-value pairs in JSON are separated by a colon(:).

12.) How are multiple key-value pairs separated in a JSON object?

A) Semicolon
B) Comma
C) Hyphen
D) Dot

Answer: Option B

Explanation: Multiple key-value pairs in a JSON object are separated by commas. eg: {“name”: “John”, “age”: 30}

13.) What can be the root structure of a JSON document?

A) Only an object
B) Only an array
C) A string
D) Either an object or an array

Answer: Option D

Explanation: JSON documents can have either an object {} or an array [] as the root structure.

14.) Which of these is a valid boolean value in JSON?

A) “true”
B) TRUE
C) true
D) True

Answer: Option C

Explanation: JSON boolean values are true or false (case-sensitive and without quotes).

15.) How is null represented in JSON?

A) NULL
B) null
C) “null”
D) (null)

Answer: Option B

Explanation: In JSON, null is represented as the lowercase keyword null.

16.) JSON is a strict subset of which language?

A) XML
B) JavaScript
C) Python
D) SQL

Answer: Option B

Explanation: JSON is derived from JavaScript’s object notation syntax.

17.) Which of the following is NOT a valid JSON key?

A) “123name”
B) “_name”
C) “name!”
D) name

Answer: Option D

Explanation: JSON keys must be strings enclosed in double quotes.

18.) Which of the following files often uses JSON for configuration?

A) config.xml
B) settings.json
C) preferences.ini
D) config.txt

Answer: Option B

Explanation: JSON is commonly used in configuration files like settings.json.

19.) What is the typical file extension for JSON files?

A) .json
B) .js
C) .txt
D) .xml

Answer: Option B

Explanation: JSON files use the .json file extension.

Leave a Reply

Your email address will not be published. Required fields are marked *