Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a component that sorts a hardcoded array of objects by a nested property (e.g., person.address.zipcode) and displays the sorted array.

Hard

Problem Statement

Write a component that sorts a hardcoded array of objects by a nested property (e.g., person.address.zipcode) and displays the sorted array.

Sample Input

Array:
 [
  { "name": "Alice", "address": { "zipcode": 12345 } },
  { "name": "Bob", "address": { "zipcode": 54321 } },
  { "name": "Charlie", "address": { "zipcode": 11111 } }
 ]

Sample Output

Sorted Array: [{ name: 'Charlie' }, { name: 'Alice' }, { name: 'Bob' }]

Limits

Time: 2s · Memory: 256 MB

Code Editor

Try your code in this preview. Submit marks it done.

import React from "react";
 
 const SortByNestedProperty = () => {
  return (
  <div>
  {/* Display sorted array */}
  </div>
  );
 };
 
 export default SortByNestedProperty;