To identify unsupervised learning problems, see if the problem requires us to group/cluster based on the patterns in the data. Unsupervised learning problems have unlabelled data (the target column is absent).
In option A, we are grouping, hence unsupervised.
In option B we are making clusters, hence unsupervised.
In option C, We typically train a model for the following problem using labelled data to help us identify spam or not spam for future unseen emails (based on the patterns learned from the labelled data). Hence, it's a supervised problem.
In option D, we would be "grouping" the customers based on their buying behaviour to help us identify their gender. We don't have explicit labels available with us. So, this is also an unsupervised problem.