Clearfunda
Simplifying Concepts for Success
Home
English Grammar
Synonyms
Salesforce Certification
Javascript Developer 1
AI Associate
Tech Quiz
HTML
JSON
GK Quiz
Geography
Inventions
Animals
Science
Food and Drinks
Yearly World Affairs
Tech Tools
JSON Formatter
Text Compare
Unit Converter
Favicon Generator
Password Generator
JS Editor
Support Us
JSON in Programming
Share it
Time limit:
15:00
End(
)
Practice Test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Question 1 of 20
Which JavaScript method is used to convert a JavaScript object into a JSON string?
Choose 1 answer
A. JSON.parse()
B. JSON.stringify()
C. JSON.toString()
D. JSON.serialize()
Question 2 of 20
What is the output of the following code? const obj = {name: 'John', age: 30}; console.log(JSON.stringify(obj));
Choose 1 answer
A. {name: 'John', age: 30}
B. "{name: 'John', age: 30}"
C. "{\"name\":\"John\",\"age\":30}"
D. {\"name\":\"John\",\"age\":30}
Question 3 of 20
Which of the following will throw a syntax error when passed to JSON.parse()?
Choose 1 answer
A. "{ \"name\": \"John\" }"
B. "{ name: 'John' }"
C. "[1, 2, 3]"
D. "\"Hello\""
Question 4 of 20
What will happen if you try to parse an invalid JSON string using JSON.parse()?
Choose 1 answer
A. It returns undefined
B. It throws a SyntaxError
C. It converts the string to an object with a 'null' value
D. It returns null
Question 5 of 20
True or False: JSON.stringify can handle circular references in JavaScript objects.
Choose 1 answer
A. True
B. False
Question 6 of 20
Which JavaScript method is used to convert a JSON string into a JavaScript object?
Choose 1 answer
A. JSON.parse()
B. JSON.stringify()
C. JSON.convert()
D. JSON.deserialize()
Question 7 of 20
What is the purpose of the 'replacer' function in JSON.stringify?
Choose 1 answer
A. It adds new properties to the JSON object
B. It controls which properties should be included in the JSON string
C. It modifies the structure of the JSON object
D. It handles error cases during serialization
Question 8 of 20
How do you catch errors when parsing invalid JSON in JavaScript?
Choose 1 answer
A. By using a try-catch block
B. By using JSON.safeParse()
C. By setting an error handler in JSON.parse()
D. By checking for null values before parsing
Question 9 of 20
True or False: JSON data is always deserialized into a dictionary-like structure in Python.
Choose 1 answer
A. True
B. False
Question 10 of 20
Which Python method is used to convert a Python dictionary to a JSON string?
Choose 1 answer
A. json.dumps()
B. json.loads()
C. json.parse()
D. json.stringify()
Question 11 of 20
In Python, which of the following functions is used to deserialize JSON data from a file?
Choose 1 answer
A. json.dump()
B. json.loads()
C. json.load()
D. json.read()
Question 12 of 20
What would be the output of json.dumps({'name': 'Alice', 'age': 30}, indent=2) in Python?
Choose 1 answer
A. A JSON string with no indents
B. A JSON string with 2 spaces indent for each level
C. A minified JSON string
D. A JSON string formatted as a list
Question 13 of 20
Which of the following statements is true regarding JSON in Java?
Choose 1 answer
A. Java has built-in support for JSON parsing
B. External libraries such as Jackson or GSON are required for JSON processing
C. JavaScript must be used to handle JSON in Java
D. JSON is not supported in Java
Question 14 of 20
In PHP, which function is used to decode a JSON string?
Choose 1 answer
A. json_decode()
B. json_encode()
C. json_parse()
D. json_to_array()
Question 15 of 20
What is the primary reason JSON is used for data interchange in many programming languages?
Choose 1 answer
A. It is a lightweight data format with human-readable syntax
B. JSON supports binary data
C. JSON has native support in all languages
D. JSON can only be used for frontend web development
Question 16 of 20
True or False: In JavaScript, JSON.parse() can accept a 'reviver' function to customize object creation.
Choose 1 answer
A. True
B. False
Question 17 of 20
Which Python function is used to load a JSON string into a Python object?
Choose 1 answer
A. json.loads()
B. json.dumps()
C. json.parse()
D. json.open()
Question 18 of 20
In Java, which class is commonly used with Jackson for deserializing JSON into Java objects?
Choose 1 answer
A. ObjectMapper
B. JSONObject
C. Gson
D. JSONSerializer
Question 19 of 20
How would you handle invalid JSON data in Python when using json.loads()?
Choose 1 answer
A. Wrap the call in a try-except block
B. Use the 'safe' parameter in json.loads()
C. Use json.safe_loads() instead
D. Invalid JSON automatically gets ignored
Question 20 of 20
What would be the output of this PHP code? $data = json_encode(["name" => "John", "age" => 30]); echo $data;
Choose 1 answer
A. {'name': 'John', 'age': 30}
B. {"name": "John", "age": 30}
C. ["name" => "John", "age" => 30]
D. {name: John, age: 30}
Previous
Next
Submit
Verify Answer
Try Other Sets
Quick Link
About Us
Privacy Policy
Terms & Condition
Query
contact@clearfunda.com
Follow Us
Clearfunda1
Clearfunda
Clearfundaofficial
©
Clearfunda.com
, All Rights Reserved