Before we answer the question, we need to first understand exactly what the black codes were. These were laws made by the southern states to restrict the liberties of freedman (former slaves). These were enacted in 1865 and 1866, just after the American Civil War. The states felt the need to enact their own restrictive laws because during the course of the civil war, Abraham Lincoln created the Emancipation Proclamation and the thirteenth amendment, both of which gave much more freedom to black men.
Now that we know this, we can take a look at the answer choices.
A is wrong because the freedmen did not create the laws, the white men did in order to restrict the freedmen.
B is wrong because these were not federal laws, they were state laws. Also, they did not limit white violence but actually increased it.
C is incorrect because they were not designed to promote civil rights, but rather squash civil rights.
Finally, D is the correct answer because 1. it says they were southern laws, 2. it correctly says that they were designed to take away liberties from black laborers (previous slaves).