How many degrees of freedom has a particle in a box? How many degrees of freedom has a particle in a rectangular box? Thing that confuses me is that box bounds the movement of the particle but to me it still seems like particle has 3 degrees of freedom.
What about if the box is spherical?
What about N non-interacting particles (eg. ideal gas) in each of these box shapes?
Also, does it make any difference if particle is quantum object like electron or classical object like a marble.
 A: For a simple particle in a rectangular box, there will be three degrees of freedom, one for each coordinate. The box may impose potential energy constraints in the problem, but this does not affect the kinetic degrees of freedom of the particle. For example, a particle in the center of a hard box feels no constraints from the box. 
The above applies for a spherical box as well. You might choose a spherical coordinate system to work such a problem, but this will not affect the three free dimensions in which the particle can translate.
For N non-interacting particles, in a box of either shape, each particle can be considered independent (non-interacting). That is, an individual particle in such a system feels no input from its neighbors. The walls of the box are thus the only confining potential for each particle and we can thus count degrees of freedom for each particle as we did in the N=1 case.
If we consider various types of objects moving around in three-dimensional boxes, we will still find that they have three translational degrees of freedom. Additional degrees of freedom can, however, exist if the objects have the additional ability to rotate (for instance, 3 degrees of freedom for three rotational Euler angles), or the ability to vibrate in certain ways. 
A classic example of a more complicated object is that of a diatomic molecule (two point particles bound by a spring-like potential) for which there are 6 total degrees of freedom: three translational degrees of freedom, two rotational degrees of freedom about the axes perpendicular to the connecting spring/bond (rotation of point particles about the axis of their bond is not physical), and one vibrational (compression/expansion) degree of freedom between the particles along the axis of the bond.
A: As CountT010 said, degrees of freedom for $N$ non-interacting particles are always $2\cdot \text{(dimension)}\cdot N$. For 3d it is $6N$, always, as each particle doesn't care for the others (unless you put any restriction, like 2d gas). The container size doesn't matter for degrees of freedom, the particles will be just bouncing around, they don't care.
