Alphabet's second-quarter results exceeded expectations, driven by strong AI investments and adverti…