Can I take the second driver's license exam after the second-generation ID card expires?

You can't.

People's Republic of China (PRC) Identity Card Law

Article 11 If the resident identity card expires, the citizen's name changes or the certificate is badly damaged and unrecognizable, an application shall be made for a replacement; If there are errors in the registration of resident identity cards, the public security organ shall promptly correct them and issue a new card; When you get a new card, you must return the original card. If a resident identity card is lost, it shall apply for a replacement.

Extended data:

The validity period of the resident identity card of citizens over the age of 16 is divided into ten years, twenty years and long term. Sixteen to twenty-five years old, issued a resident identity card valid for ten years; Twenty-six to forty-five years old, issued a valid identity card for twenty years; Those over 46 years old will be issued with long-term valid identity cards.

Citizens under the age of sixteen who voluntarily apply for a resident identity card shall be issued a resident identity card valid for five years.

Article 6 The pattern of resident identity cards shall be formulated by the public security department of the State Council. Resident identity cards are uniformly produced and issued by public security organs.

The resident ID card has two functions: visual reading and machine reading. The contents of visual inspection and machine reading are limited to the items specified in the first paragraph of Article 3 of this Law.

The public security organ and its people's police shall keep confidential the personal information of citizens known in the production, distribution, inspection and seizure of resident identity cards.

References:

Baidu Encyclopedia-Resident Identity Card Law of the People's Republic of China