Classically, for each parameter $\lambda$ (real or complex), there is a unique solution $\phi_{\lambda}$ of
$$
-(py')'+qy=\lambda y
$$
$$
y(0)=0,\;\; y'(0)=1,
$$
and a unique solution $\psi_{\lambda}$ of
$$
-(py')'+qy=\lambda y
$$
$$
y(0)=1,\;\; y'(0)=0.
$$
Every solution of $-(py')'+qy=\lambda y$ can be written as unique linear combination $A\phi_{\lambda}+B\psi_{\lambda}$ of these two solutions. Standard uniqueness and existence theorems of ordinary differential equations guarantee this for the coefficients specified in your problem (this is because $p$ stays strictly positive on $[0,1]$.) So the classical solution space of $-(py')'+qy=\lambda y$ is two-dimensional with linearly-independent solutions $\phi_{\lambda}$ and $\psi_{\lambda}$ serving as a basis of solutions in $C^{2}[0,1]$.
However, you're talking about an operator $L$ given by $Lf=-(pf')'+qf$ on a domain $\mathcal{D}(L)$ consisting of twice continuously differentiable functions $f$ on $[0,1]$ for which $f(0)=f(1)=0$. The domain of $L$ is designed so that, with respect to the inner-product $(f,g)=\int_{0}^{1}f\overline{g}\,dx$, one has
$$
(Lf,g) = (f,Lg),\;\;\; f,g \in \mathcal{D}(L).
$$
While there are always two linearly-independent classical solutions $\phi_{\lambda}$, $\psi_{\lambda}$ of $-(py')'+qy=\lambda y$ for all complex $\lambda$, the null space of $L-\lambda I$ is non-trivial only when there exists some non-trivial linear combination of $\phi_{\lambda}$, $\psi_{\lambda}$ which vanishes at both endpoints of $[0,1]$. That doesn't happen except for isolated real values of $\lambda$, and it can never happen that both linearly-independent solutions of $(L-\lambda I)f=0$ vanish at $0$ and $1$, because that would require both $\phi_{\lambda}$ and $\psi_{\lambda}$ to vanish at $0$, which is a contradiction.