The length (l) of the box is 9 inches, its width (w) is 6 inches and its height (h) is 27 inches.
\The formula for the volume of rectangular prism is
.
Substitute the values of
in the formula of volume of rectangular prism.

.
The length (a) of side of the of the cube is 3 inches.
\The formula for the volume of cube is
.
Substitute the value of
in the formula of volume of the cube.

.
Let x be the number of cubes.
\The volume of x cubes is 
The volume of x cubes is the the volume of rectangular box.
\Therefore
.
Divide each side by 27.
\
Cancel common terms.
\
.
The number of cubes is 54.
The option H is correct answer.