Given the following JSON object, write code to output the email address and each student's math marks.
1Times asked
Jun 2026Last seen
Jun 2026First seen
💡 Model Answer
You can parse the JSON and iterate over the students array to print the email and each student's math score. In JavaScript:
js
const data = {
ename: "Sha",
Section: "Yr1",
Details: {
contacts: {
email: "jack@yahoo.com",
Mobile: "123456789"
}
},
students: [
{ id: "A3", Sname: "Jim", math: 60 },
{ id: "A4", Sname: "Dwight", math: 89 },
{ id: "A5", Sname: "Kevin", math: 79 }
]
};
console.log(`Email: ${data.Details.contacts.email}`);
console.log("Student marks:");
for (const s of data.students) {
console.log(`${s.Sname}: ${s.math}`);
}This prints the email followed by each student's name and math score. Complexity is O(n) where n is the number of students, as we traverse the array once.
This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.
🎤 Get questions like this answered in real-time
Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.
Get Assisting AI — Starts at ₹500