Create a flash card for json: 31 MCQs

All 31 multiple-choice questions from this kit, free and with no sign-up.

Warm-up · 23 questions

Q1. Which of the following is the correct JSON syntax for a key-value pair?

Beginner
A key = value
B key: value
C "key": value
D "key" = "value"

Answers and explanations are in the Veda app.

Q2. What data type is the JSON value `true`?

Beginner
A Boolean
B String
C Object
D Number

Answers and explanations are in the Veda app.

Q3. Which of the following is a valid JSON array?

Beginner
A ["apple", "banana", "cherry"]
B <"apple", "banana", "cherry">
C ("apple", "banana", "cherry")
D {"apple", "banana", "cherry"}

Answers and explanations are in the Veda app.

Q4. What is the correct JSON representation of a number?

Beginner
A forty-two
B 42
C '42'
D "42"

Answers and explanations are in the Veda app.

Q5. Which of the following JSON objects is syntactically correct?

Beginner
A {"name": "Alice", "age": 30
B {"name": "Alice", "age": 30}
C {"name": "Alice", "age": 30,}
D {name: "Alice", age: 30}

Answers and explanations are in the Veda app.

Q6. What is the JSON value for null?

Beginner
A undefined
B "null"
C null
D None

Answers and explanations are in the Veda app.

Q7. Which of the following is NOT a valid JSON value type?

Beginner
A Array
B Function
C String
D Object

Answers and explanations are in the Veda app.

Q8. How are strings enclosed in JSON?

Beginner
A Double quotes
B Single quotes
C No quotes
D Backticks

Answers and explanations are in the Veda app.

Q9. What does the following JSON represent? `{"items": [1, 2, 3]}`

Beginner
A An array of objects
B An object with a key "items" whose value is an array of numbers
C An object with a key "items" whose value is a string
D An array containing an object

Answers and explanations are in the Veda app.

Q10. Which of the following is a valid JSON string?

Beginner
A "Hello World'
B 'Hello World'
C Hello World
D "Hello World"

Answers and explanations are in the Veda app.

Q11. What is the correct JSON syntax for an empty object?

Beginner
A "{}"
B null
C []
D {}

Answers and explanations are in the Veda app.

Q12. Which of the following is a valid JSON number?

Beginner
A "3.14"
B 3.14.0
C 3.14
D 3,14

Answers and explanations are in the Veda app.

Q13. What is the correct JSON representation of a boolean value?

Beginner
A true
B TRUE
C "true"
D True

Answers and explanations are in the Veda app.

Q14. In JSON, keys can be unquoted if they contain only letters.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q15. A JSON array can contain a mix of different data types, such as strings, numbers, and objects.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q16. The JSON value `"null"` is the same as the JSON value `null`.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q17. Whitespace (spaces, tabs, newlines) is allowed in JSON to improve readability.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q18. A JSON object must have at least one key-value pair.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q19. Which of the following is the correct JSON syntax for a key-value pair where the key is "name" and the value is "Alice"?

Beginner
A `"name": "Alice"`
B `"name": Alice`
C `name: Alice`
D `name: "Alice"`

Answers and explanations are in the Veda app.

Q20. What is the correct JSON representation of an empty array?

Beginner
A `null`
B `[""]`
C `{}`
D `[]`

Answers and explanations are in the Veda app.

Q21. Which of the following is a valid JSON object with one key-value pair?

Beginner
A `{score: 95}`
B `{"score": 95,}`
C `{"score": 95}`
D `{"score": 95`

Answers and explanations are in the Veda app.

Q22. What is the correct JSON syntax for a string value?

Beginner
A `Hello`
B `Hello` (without quotes)
C `'Hello'`
D `"Hello"`

Answers and explanations are in the Veda app.

Q23. Which of the following JSON snippets contains a trailing comma that makes it invalid?

Beginner
A `{"a": 1}`
B `{"a": 1, "b": 2,}`
C `{"a": 1, "b": 2}`
D `[1, 2, 3]`

Answers and explanations are in the Veda app.

Building up · 5 questions

Q24. Consider the following JSON snippet: ```json { "flashcards": [ {"front": "What is JSON?", "back": "A data format"}, {"front": "What is a key?", "back": "A string identifier"}, ] } ``` Why is this JSON invalid?

Intermediate
A The array `"flashcards"` contains objects with different key names.
B The strings inside the objects use double quotes, which is not allowed.
C There is a trailing comma after the last object in the array.
D The key `"flashcards"` must be enclosed in single quotes.

Answers and explanations are in the Veda app.

Q25. Given the requirement to store a flash card with a mathematical expression as the "front" and its LaTeX representation as the "back", which of the following JSON objects correctly represents this data?

Intermediate
A ```json {"front": $E = mc^2$, "back": "E = mc^2"} ```
B ```json {"front": "$E = mc^2$", "back": "The equation $E = mc^2$ represents mass-energy equivalence."} ```
C ```json {"front": "E = mc^2", "back": "$E = mc^2$"} ```
D ```json {"front": "E = mc^2", "back": "$$E = mc^2$$"} ```

Answers and explanations are in the Veda app.

Q26. A developer creates a JSON structure for a set of flash cards where each card has a "tags" field that can contain multiple tags. Which of the following JSON snippets correctly represents a card with the tags "math", "physics", and "relativity"?

Intermediate
A ```json {"question": "What is E=mc^2?", "tags": ("math", "physics", "relativity")} ```
B ```json {"question": "What is E=mc^2?", "tags": [math, physics, relativity]} ```
C ```json {"question": "What is E=mc^2?", "tags": ["math", "physics", "relativity"]} ```
D ```json {"question": "What is E=mc^2?", "tags": "math, physics, relativity"} ```

Answers and explanations are in the Veda app.

Q27. Compare the following two JSON structures for storing a flash card with nested metadata: Structure 1: ```json { "card": { "front": "Define JSON", "back": "JavaScript Object Notation", "metadata": {"difficulty": "easy", "created": "2023-01-01"} } } ``` Structure 2: ```json { "card": { "front": "Define JSON", "back": "JavaScript Object Notation", "metadata": {"difficulty": "easy", "created": "2023-01-01",} } } ``` Which statement is correct?

Intermediate
A Structure 1 is valid; Structure 2 is invalid due to a trailing comma in the nested `"metadata"` object.
B Structure 2 is valid because trailing commas are allowed in nested objects.
C Neither structure is valid because the `"card"` key must be a string without quotes.
D Both structures are valid JSON because nested objects are allowed.

Answers and explanations are in the Veda app.

Q28. A flash card application stores cards in a JSON array. Which of the following JSON arrays is syntactically correct and contains exactly three cards, each with a "front" and "back"?

Intermediate
A ```json [ {"front": "Q1", "back": "A1"}, {"front": "Q2", "back": "A2"} {"front": "Q3", "back": "A3"} ] ```
B ```json [ {"front": "Q1", "back": "A1"}, {"front": "Q2", "back": "A2"}, {"front": "Q3", "back": "A3"}, ] ```
C ```json [ {"front": "Q1", "back": "A1"} {"front": "Q2", "back": "A2"} {"front": "Q3", "back": "A3"} ] ```
D ```json [ {"front": "Q1", "back": "A1"}, {"front": "Q2", "back": "A2"}, {"front": "Q3", "back": "A3"} ] ```

Answers and explanations are in the Veda app.

Topper level · 3 questions

Q29. A flash card application imports a JSON file containing an array of cards. The file has the following structure: ```json [ { "front": "What is the capital of France?", "back": "Paris" }, { "front": "What is the square root of 16?", "back": "4" }, { "front": "What is the boiling point of water?", "back": "100°C" } ] ``` A developer notices that the third card's "back" value contains the degree symbol (°). The JSON parser throws an error. Which of the following is the most likely cause?

Advanced
A The array contains three objects, but JSON arrays can only hold up to two objects.
B The degree symbol is a reserved character in JSON and must be escaped with a backslash.
C The JSON file is not encoded in UTF-8, causing the degree symbol to be misinterpreted.
D The degree symbol is not a valid UTF-8 character, so it must be escaped as `\u00b0`.

Answers and explanations are in the Veda app.

Q30. A developer needs to store a flash card with a mathematical formula that includes a fraction. The front of the card is: "Solve for x: $\frac{3x + 2}{5} = 7$". The developer writes the following JSON: ```json { "front": "Solve for x: $\frac{3x + 2}{5} = 7$", "back": "x = 11" } ``` When parsed, this JSON is invalid. Which of the following corrections will make the JSON valid while preserving the LaTeX expression exactly as intended?

Advanced
A Remove the dollar signs: `\frac{3x + 2}{5} = 7`.
B Enclose the entire string in single quotes instead of double quotes.
C Replace the backslashes with forward slashes: `$\frac{3x + 2}{5} = 7$` becomes `$/frac{3x + 2}{5} = 7$`.
D Escape each backslash with an additional backslash: `$\\frac{3x + 2}{5} = 7$`.

Answers and explanations are in the Veda app.

Q31. A flash card dataset is stored in a JSON file with the following structure: ```json { "deck": "Advanced Math", "cards": [ { "front": "What is the integral of $e^x$?", "back": "$e^x + C$" }, { "front": "What is the limit of $1/x$ as $x \\to \\infty$?", "back": "0" } ] } ``` A developer claims that this JSON is invalid because the second card's "front" contains a LaTeX expression with escaped backslashes (`\\to` and `\\infty`). Which of the following statements is correct?

Advanced
A The developer is incorrect; the JSON is valid because the double backslashes correctly represent literal backslashes in the LaTeX expression.
B The developer is correct; the JSON is invalid because the second card's "front" contains a space after the comma in `$x \\to \\infty$`, which is not allowed.
C The developer is incorrect; the JSON is valid only if the entire file is encoded in ASCII, but the presence of `$` symbols makes it invalid.
D The developer is correct; the double backslashes are not valid in JSON strings and must be single backslashes.

Answers and explanations are in the Veda app.

Make your own

Your notes can be a kit like these

Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free to start, in more than 40 languages.

  • Chapter notes
  • Flashcards
  • Practice MCQs
  • Scored tests
  • Paper Solver

Get Veda free See what students get

Free to start · Android app and web · More than 40 languages