China’s economy grew an annual 7 percent in the second quarter, beating analysts’ forecasts, though its volatile stock markets took a sharp dive in a reminder of the threats to Beijing’s efforts to direct the economy out of a slowdown. Policymakers had already unleashed a series of measures to pull stocks out of a 30 percent nosedive and appeared to have succeeded last week, but Wednesday’s tumble could reawaken concerns over the government’s ability to manage the economy.