It is a hard question to answer. In World War I and World War II, axis powers thought that wars would be short and decisive. First Korean War of the 1950s lasted 3 years.
If North Korea fights alone with America and South Korea, the war would not last a single month. DPRK does not have resources, financial capital, modern weapons and manpower to survive a long war with South Korea and a superpower like America.
But we cannot simply assume that China will not join the war. China’s initial reaction will be neutral if Pyongyang attacks ROK and United States’ forces first. It is true; it would look bad for China if it supports an aggressor from the beginning. I think Beijing would launch a diplomatic offensive to make a ceasefire between the two countries.
When China fails to make peace between them and North Korea shows the signs of collapse or defeat in the war, China would inevitably join the war on behalf of North Korea to save the Kim regime.
Now, the question is—why would China do that? China will fight America as it did in the First Korean War. North Korea acts as a buffer zone between China and the United States’ military forces in South Korea. If Pyongyang falls apart, South Korea will absorb it and American forces would be in Chinese borders. No one in Beijing desires this outcome.
So, China would not have options other than entering the war. If China enters, it will be a large and long war. China has enormous resources and manpower to continue the war for a long time. If America can fight a war 10000 kilometers away from its home, then China can also fight that, as it is within its borders.