Question bank › Sorting
Dsa Sorting Warm-up

Alphabetical Sort

Write a program that sorts a list of names in alphabetical order. The program should read from standard input and output the sorted names, maintaining case sensitivity (all uppercase letters are sorted before lowercase). Input format: - The first line contains an integer n (1 ≤ n ≤ 100). The second line contains n names separated by spaces. Output format: - A single line containing the sorted names separated by spaces. Example: Input: 4 john Alice bob Charlie Output: Alice Charlie bob john

Key concepts

sortingstringsalphabetical

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.