Answer YES to DS 160 question
You should answer “YES” to "Have you ever been unlawfully present, overstayed the amount of time granted by an immigration official or otherwise violated the terms of a U.S. visa?” in DS160.
Unlawful presence starts on H1B denial
Even a single day stay after your H1B denial and after your i94 has already expired is counted as “Unlawful presence”.
You Unlawful presence started on 4th Aug 2018 and continued until you left USA on 15th Aug, 2018.
No issue if you mention the Truth in DS 160
It is okay to mention this Unlawful presence time as it is a genuine time spent wrapping up your stuff to leave USA. It will not affect your application.
Chances of H1B visa denial are high if you hide Unlawful presence time
But, if you lie, then, your visa application can be denied based on “Mis-representation” of facts.