Question bank › Sorting
Dsa Sorting Easy

Sort Student Records

You are given a list of student records. Each record contains a student name and their score, separated by a space. The goal is to sort these records primarily by score in descending order, and then by name in ascending order. Input format: - The first line contains an integer n, the number of records. - The next n lines each contain a record in the format "Name Score". Output format: - Print the sorted records, each on a new line, in the format "Name Score". Example input: 3 Alice 90 Bob 85 Charlie 90 Output: Alice 90 Charlie 90 Bob 85

Key concepts

sortingarraysstrings

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.