6. There are $p+q$ parts, among which $p$ are good and $q$ are defective. Now, they are checked one by one at random. The probability that all defective parts are found exactly when checking the $r$-th part ($q<p<r<p+q$) is ( ).
(A) $\frac{\mathrm{C}_{q}^{1} \mathrm{~A}_{r-1}^{q-1} \mathrm{~A}_{p}^{r-q}}{\mathrm{~A}_{p+q}^{r}}$
(B) $\frac{\mathrm{C}_{p}^{1} \mathrm{~A}_{r-1}^{p-1} \mathrm{~A}_{q}^{r-p}}{\mathrm{~A}_{p+q}^{r}}$
(C) $\frac{\mathrm{A}_{q}^{r-p} \mathrm{~A}_{p}^{r-q}}{\mathrm{~A}_{p+q}^{r}}$
(D) $\frac{\mathrm{C}_{q}^{1} \mathrm{~A}_{r-1}^{q-1} \mathrm{~A}_{p}^{r-q}+\mathrm{C}_{p}^{1} \mathrm{~A}_{r-1}^{p-1} \mathrm{~A}_{q}^{r-p}}{\mathrm{~A}_{p+q}^{r}}$
6. D.

The problem is equivalent to:
Randomly selecting $r$ numbers from $1,2, \cdots, p$ and $-1,-2, \cdots,-q$ and arranging them in a row, find the probability that the resulting permutation satisfies the following conditions: either the permutation contains $q$ negative numbers, and the last number is negative (in this case, it contains at most $p-1$ positive numbers); or the permutation contains $p$ positive numbers, and the last number is positive (in this case, it contains at most $q-1$ negative numbers).

If the $r$-th position is a negative number, then there are $\mathrm{C}_{q}^{1}$ ways to arrange this position, and the remaining $q-1$ negative numbers are arranged in the first $r-1$ positions, with $A_{r-1}^{q-1}$ ways. The remaining $r-q$ positions are arranged by selecting $r-q$ numbers from $p$ positive numbers, with $\mathrm{A}_{p}^{r-q}$ ways; if the $r$-th position is a positive number, then there are $\mathrm{C}_{p}^{1}$ ways to arrange this position, and the remaining $p-1$ positive numbers are arranged in the first $r-1$ positions, with $A_{r-1}^{p-1}$ ways. The remaining $r-p$ positions are arranged by selecting $r-p$ numbers from $q$ negative numbers, with $\mathrm{A}_{q}^{r-p}$ ways. The number of permutations of selecting $r$ numbers from $p+q$ numbers is $\mathrm{A}_{p+q}^{r}$.
Thus, the required probability is
$$
\frac{\mathrm{C}_{q}^{1} \mathrm{~A}_{r-1}^{q-1} \mathrm{~A}_{p}^{r-q}+\mathrm{C}_{p}^{1} A_{r-1}^{p-1} \mathrm{~A}_{q}^{r-p}}{\mathrm{~A}_{p+q}^{r}} .
$$