We investigate the nonmodal physical mechanisms responsible for transient growth in a hypersonic laminar boundary layer and in the interaction of this boundary layer with an incident oblique shock wave. The optimal disturbances and growth curves are computed using an adjoint looping approach. We validate this iterative approach by applying it to several parallel boundary layers that have been studied before in great detail. For these parallel flows, the lift-up effect is generally the dominant transient growth mechanism. However, for a Mach 5.92 spatially developing boundary layer, the inviscid Orr mechanism and convective instabilities are responsible for the large transient response. Furthermore, the optimal initial condition corresponding to the oblique shock wave/boundary layer interaction could be related to both the inviscid Orr mechanism and the lift-up effect. Tilted streamwise streaks that oppose the mean shear are present in the upstream boundary layer, and centrifugal instability near the apex of the separation bubble creates small vortices that grow into elongated streamwise structures with time. Due to the strong spatial non-normality of the oblique shock wave/boundary layer interaction, one cannot obtain an accurate lower bound of the transient growth using the direct or adjoint information separately. Therefore, the nonmodal technique, which takes advantage of both the direct and adjoint operators, is an elegant solution to this problem.