Column names vs reference numbers

Why do I get different results between these 2 queries?

(A)
SELECT category, ROUND(AVG(valuation), 2)
FROM startups
GROUP BY 1
ORDER BY 2 DESC;

(B)
SELECT category, ROUND(AVG(valuation), 2)
FROM startups
GROUP BY category
ORDER BY valuation DESC;

The only difference is that the first uses reference numbers to the columns selected, the second uses the column names. Oddly, using the column names does not put both null values at the bottom of the list:

|Data Analytics | null |
|E-commerce |60250000.0|
|Video Streaming| null |

https://www.codecademy.com/courses/learn-sql/projects/fakeapps?action=resume_content_item