Fundamentals of Front End Development MCQs with Answers
Practice important Fundamentals of Front End Development MCQs with answers and explanations.
Chapter: 123
Q1381:
What does the following JSON example do: var obj = JSON.parse(text);
A. Converts a JSON object to a string
B. Converts a JSON string to a native JavaScript object
C. Converts a JavaScript object to JSON
D. Converts a JavaScript string to JSON
Correct Answer:
B
Chapter: 123
Q1382:
Fill in the blank: Both JSON and XML can be fetched with an ________.
A. XMLHttpRequest
B. SQL query
C. HTTP request
D. API call
Correct Answer:
A
Chapter: 123
Q1383:
Which of the following code snippets correctly defines a JSON object in JavaScript?
A. var obj = { "firstName": "Asim", "lastName": "Adeel" };
B. <friend><firstName>Asim</firstName><lastName>Adeel</lastName></friend>
C. let obj = "firstName": "Asim", "lastName": "Adeel";
D. json = { "firstName": "Asim", "lastName": "Adeel" }
Correct Answer:
A
Chapter: 123
Q1384:
What is a key advantage of using JSON over XML in data interchange?
A. JSON requires more processing time
B. JSON uses more bandwidth
C. JSON is less flexible
D. JSON is faster and easier to parse
Correct Answer:
D
Chapter: 123
Q1385:
Fill in the blank: Unlike XML, JSON does not use ________.
A. Tags
B. Arrays
C. Objects
D. Strings
Correct Answer:
A
Chapter: 124
Q1386:
The JSON syntax is a subset of which language's syntax?
A. Java
B. Python
C. JavaScript
D. C++
Correct Answer:
C
Chapter: 124
Q1387:
Fill in the blank: JSON objects are enclosed in ________.
A. Parentheses
B. Square brackets
C. Curly braces
D. Angle brackets
Correct Answer:
C
Chapter: 124
Q1388:
Which of the following can be a JSON value?
A. An integer
B. A string
C. An array
D. All of the above
Correct Answer:
D
Chapter: 124
Q1389:
How are multiple objects contained within a JSON array?
A. Separated by semicolons
B. Separated by commas
C. Separated by colons
D. Separated by slashes
Correct Answer:
B
Chapter: 124
Q1390:
Which of the following is the correct syntax for accessing the first entry's first name in a JavaScript object array?
A. friends.firstName[0]
B. friends[0].firstName
C. friends["firstName"][0]
D. friends[0].first_Name
Correct Answer:
B
Chapter: 124
Q1391:
Fill in the blank: In JSON, an array is enclosed within ________.
A. Curly braces
B. Parentheses
C. Square brackets
D. Double quotes
Correct Answer:
C
Chapter: 124
Q1392:
What does the JSON.parse() function do in JavaScript?
A. Converts a JavaScript object to a JSON string
B. Converts a JSON string to a JavaScript object
C. Converts XML data to JSON
D. Converts a JavaScript object to an array
Correct Answer:
B
Chapter: 124
Q1393:
Which of the following is the correct syntax for modifying the first name in a JavaScript object array?
A. friends[0]["firstName"] = "Yasir";
B. friends[0].firstName == "Yasir";
C. friends[0].first_Name = "Yasir";
D. friends["firstName"][0] = "Yasir";
Correct Answer:
A
Chapter: 124
Q1394:
Fill in the blank: JSON objects consist of name/value ________.
A. Groups
B. Pairs
C. Elements
D. Units
Correct Answer:
B
Chapter: 124
Q1395:
Which of the following is a valid JSON array?
A. {"firstName":"Asim", "lastName":"Adeel"}
B. ["Asim", "Adeel", "Tanweer"]
C. ("Asim", "Adeel", "Tanweer")
D. <Asim, Adeel, Tanweer>
Correct Answer:
B
Chapter: 124
Q1396:
Which method was historically used to parse JSON text in older browsers?
A. JSON.convert()
B. eval()
C. parseJSON()
D. JSON.eval()
Correct Answer:
B
Chapter: 124
Q1397:
Fill in the blank: JSON syntax is derived from ________ object notation syntax.
A. Python
B. JavaScript
C. Ruby
D. C++
Correct Answer:
B
Chapter: 124
Q1398:
Which of the following is NOT a valid JSON value type?
A. Boolean
B. Array
C. Function
D. String
Correct Answer:
C
Chapter: 124
Q1399:
What is the correct way to access the last name in the following JSON object: {"firstName":"Asim", "lastName":"Adeel"}?
A. object["lastName"]
B. object.lastName()
C. object[lastName]
D. object.firstName
Correct Answer:
A
Chapter: 124
Q1400:
Fill in the blank: JSON is considered a ________ data-interchange format.
A. Heavy
B. Lightweight
C. Verbose
D. Complex
Correct Answer:
B