lf all the particles of a system lie in a cube, is it necessary that the centre of mass be in the cube?
yes
If all particles are in a cube, then obivously the COM of all there particles should lie in the same cube. Because we know,
xCOM = ∑ mixi∑ mi
yCOM = ∑ miyi∑ mi
zCOM = ∑ mizi∑ mi