Help me in solving SQLP045 problem

My issue

assume there are 50 rows, out of which 12 are male then % of male = 21%.

So SELECT 100 * COUNT(CASE WHEN gender=’Male’ THEN 1 ELSE 0 END) / COUNT(*) FROM customers;

The above SQL statement should be true but “SELECT AVG(CASE WHEN gender = ‘Male’ THEN 1 ELSE 0 END) * 100 FROM customers;” is considered as true

How and why? Can anyone exlplain

Learning course: Analytics case studies
Problem Link: CodeChef: Practical coding for everyone

What do you think the output should be for this query?

Output

Output will be 4 because COUNT counts all the values, doesn’t matter if they are 0 or 1. It only ignores null values.