How stocks are priced on the stock exchange

What mechanisms ensure fair pricing on stock exchanges?

Stocks are priced on the exchange based on supply and demand. The last price at which a stock was traded becomes its current price. This price updates in real time during market hours.