Cake is larger in size than pastry, often viewed as the whole part of pastry, but both are different.
Cake usually has a complicated recipe with more ingredients and decoration whereas pastry can be made with fewer basic ingredients in small scale.
Cake is usually round and rectangular with frosting whereas pastry can be of any shape you mold it into.
Cake is usually for a larger crowd or for a celebration, pastry can be your anytime sweet retreat for individual serving.