Shapes of Clusters and Groups of Galaxies: Comparison of Model Predictions With Observations