Programming exercises for Q