Question bank › Sorting
Dsa Sorting Easy

Student Scores Sorting

You are given a list of student scores, where each score is represented as a tuple containing the student's name and their score. Your task is to sort this list primarily by score in descending order. If two students have the same score, list them in alphabetical order by their name. Print the sorted list in the format: 'Name: Score'. Input Format: - The first line contains an integer N (1 <= N <= 1000), the number of students. - The next N lines each contain a student's name (a string) and their score (an integer) separated by a space. Output Format: - Print each student's name alongside their score in the sorted order. Example: Input: 3 Alice 90 Bob 85 Charlie 90 Output: Alice: 90 Charlie: 90 Bob: 85

Key concepts

sortingarraystuples

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.