Question bank › Sorting
Dsa Sorting Medium

Student Grades Sorting

You are provided a list of student names and their grades in the format 'Name,Grade'. Your task is to sort the students first by their grades in ascending order, and in the case of ties, by their names in alphabetical order. Print the sorted list in the same 'Name,Grade' format. Input format: - The first line contains an integer n (1 ≤ n ≤ 1000), the number of students. - The following n lines each contain a student's record. Output format: - Print the sorted student records, one per line. Example: Input: 3 Alice,85 Bob,70 Charlie,85 Output: Bob,70 Alice,85 Charlie,85

Key concepts

sortingdata aggregationtuples

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 Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.