Google's parent company Alphabet and its rival Microsoft have surprised the markets as they announced better-than-expected earnings on Tuesday.