11.) How do you merge two JSON objects?
A) Use Object.assign()
B) Use JSON.merge()
C) Use array.push()
D) Use JSON.stringify()
12.) What happens if a JSON object has circular references when using JSON.stringify()?
A) It converts successfully
B) It throws a TypeError
C) It returns an empty object
D) It skips the circular reference and continues
13.) Which data structure is not directly supported by JSON?
A) Array
B) Object
C) Set
D) String
14.) How do you reference the parent key in a deeply nested JSON object?
A) JSON does not support parent references
B) Use parent() function
C) Use a library to navigate JSON paths
D) Use key.parent
15.) What happens if a key in a JSON object contains special characters?
A) It throws an error
B) The key must be enclosed in double quotes
C) The key is ignored
D) The special characters are escaped automatically
16.) How do you handle very large JSON data efficiently in JavaScript?
A) Load the entire JSON object in memory
B) Use streaming parsers like JSONStream
C) Split the JSON file into multiple smaller files
D) Both B and C
17.) What does the following JSON structure represent?
{
"department": "HR",
"employees": [
{ "name": "Alice", "id": 1 },
{ "name": "Bob", "id": 2 }
]
}
A) A single JSON object
B) A JSON object containing a nested array of objects
C) A JSON array containing objects
D) An invalid JSON structure
18.) How do you access the value 30 in the following JSON structure?
{
"person": {
"name": "John",
"age": 30
}
}
A) person[age]
B) person.age
C) person->age
D) person(“age”)
19.) How do you access the second object in this JSON array?
[
{ "id": 1, "name": "Alice" },
{ "id": 2, "name": "Bob" }
]
A) array(1)
B) array[2]
C) array[1]
D) array->1
Related