  We study a class of quadratically constrained quadratic programs (QCQPs),
called {\em diagonal QCQPs\/}, which contain no off-diagonal terms $x_j x_k$
for $j \ne k$, and we provide a sufficient condition on the problem data
guaranteeing that the basic Shor semidefinite relaxation is exact. Our
condition complements and refines those already present in the literature and
can be checked in polynomial time. We then extend our analysis from diagonal
QCQPs to general QCQPs, i.e., ones with no particular structure. By
reformulating a general QCQP into diagonal form, we establish new,
polynomial-time-checkable sufficient conditions for the semidefinite
relaxations of general QCQPs to be exact. Finally, these ideas are extended to
show that a class of random general QCQPs has exact semidefinite relaxations
with high probability as long as the number of constraints grows no faster than
a fixed polynomial in the number of variables. To the best of our knowledge,
this is the first result establishing the exactness of the semidefinite
relaxation for random general QCQPs.
