25 C# Coding Questions – String, Char & StringBuilder (Moderate–High)
Use these questions for assessments or lab practice. Focus on correctness, edge cases, and performance.
STRING-Based Questions
- Word Frequency Counter – Count occurrences ignoring case and punctuation.
- Longest substring without repeating characters.
- Run-length encoding (e.g., "aaabbcccc" → "a3b2c4").
- Anagram checker without built-in sort.
- Reverse words but not characters.
- Remove duplicate characters while preserving order.
- Find all palindromic substrings.
- Case-insensitive replace without regex.
- Email masking ("john.doe@gmail.com" → "j***@gmail.com").
- Balanced parentheses validator.
CHAR-Based Questions
- Count uppercase, lowercase, digits, spaces, and special characters.
- Caesar cipher with shift N.
- Most frequent character.
- Toggle case using only char APIs.
- Remove all digits using char checks.
- First non-repeating character.
- Password strength validator.
- Detect consecutive duplicate characters.
STRINGBUILDER / Performance Questions
- Reverse a very large string using StringBuilder.
- Insert '*' between every two characters.
- Remove vowels efficiently.
- Compress multiple spaces into one.
- Build CSV from a list of objects.
- HTML escaper for <, >, &, and quotes.
- Log formatter using StringBuilder.