Question bank › Sorting
Dsa Sorting Easy

Student Grade Sorter

Write a program that takes a list of students with their names and grades and sorts them by grade in descending order. If two students have the same grade, sort them alphabetically by their names. The input consists of several lines, each containing a student's name followed by their grade, separated by a space. Output the sorted list of students in the same format, one per line. Example: Input: Alice 88 Bob 95 Charlie 88 Output: Bob 95 Alice 88 Charlie 88

Key concepts

sortingtuplesarrays

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.