A wave of car bombs has hit mainly Shi’ite neighborhoods of Baghdad, killing at least 42 people and wounding dozens more.