JSON MCQs – JSON Syntax and Basics

21.) Which of the following is NOT a JSON data type?

A) Boolean
B) Null
C) String
D) Date

Answer: Option D

Explanation: JSON does not have a date data type; dates are usually represented as strings.

22.) What separates two key-value pairs in a JSON object?

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

Answer: Option B

Explanation: In JSON, key-value pairs are separated by commas.

23.) Can JSON keys have spaces?

A) Yes, with quotes
B) Yes, without quotes
C) No
D) Only in arrays

Answer: Option A

Explanation: JSON keys can have spaces but must be enclosed in double quotes.

24.) Which tool is used to validate JSON syntax?

A) Postman
B) JSONParser
C) XMLParser
D) JSONLint

Answer: Option D

Explanation: JSONLint is commonly used to validate JSON syntax.

25.) Which data structure is JSON closest to?

A) Arrays
B) Relational tables
C) Key-value store
D) Trees

Answer: Option C

Explanation: JSON is similar to key-value stores in structure.

26.) What is the purpose of application/json MIME type?

A) To define JSON structure
B) To identify JSON data format
C) To parse JSON
D) To convert JSON to XML

Answer: Option B

Explanation: The MIME type application/json identifies JSON content.

27.) Can JSON values be arrays?

A) Yes
B) No
C) Only in objects
D) Only for strings

Answer: Option A

Explanation: JSON values can be arrays, objects, or other data types.

28.) Which of the following is the correct way to represent an empty JSON object?

A) {}
B) []
C) null
D) “”

Answer: Option A

Explanation: An empty JSON object is represented as {} with no key-value pairs inside.

29.) How are negative numbers represented in JSON?

A) negative123
B) -123
C) (123)
D) [123]

Answer: Option B

Explanation: Negative numbers in JSON are represented with a leading -.

30.) Can JSON arrays contain objects?

A) Yes
B) No
C) Only strings
D) Only numbers

Answer: Option A

Explanation: JSON arrays can contain objects, arrays, or other data types.

Leave a Reply

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