Superradiance and subradiance concerning enhanced and inhibited collective radiation of an ensemble of atoms have been a central topic in quantum optics. However, precise generation and control of these states remain challenging. Here we deterministically generate up to 10-qubit superradiant and 8-qubit subradiant states, each containing a single excitation, in a superconducting quantum circuit with multiple qubits interconnected by a cavity resonator. The $sqrt{N}$-scaling enhancement of the coupling strength between the superradiant states and the cavity is validated. By applying appropriate phase gate on each qubit, we are able to switch the single collective excitation between superradiant and subradiant states. While the subradiant states containing a single excitation are forbidden from emitting photons, we demonstrate that they can still absorb photons from the resonator. However, for even number of qubits, a singlet state with half of the qubits being excited can neither emit nor absorb photons, which is verified with 4 qubits. This study is a step forward in coherent control of collective radiation and has promising applications in quantum information processing.