Convexifiability of continuous and discrete nonnegative quadratic programs for gap-free duality