  Let $\R$ be a real closed field, $ {\mathcal Q} \subset
\R[Y_1,...,Y_\ell,X_1,...,X_k], $ with $ \deg_{Y}(Q) \leq 2, \deg_{X}(Q) \leq
d, Q \in {\mathcal Q}, #({\mathcal Q})=m,$ and $ {\mathcal P} \subset
\R[X_1,...,X_k] $ with $\deg_{X}(P) \leq d, P \in {\mathcal P}, #({\mathcal
P})=s$, and $S \subset \R^{\ell+k}$ a semi-algebraic set defined by a Boolean
formula without negations, with atoms $P=0, P \geq 0, P \leq 0, P \in {\mathcal
P} \cup {\mathcal Q}$. We prove that the sum of the Betti numbers of $S$ is
bounded by \[ \ell^2 (O(s+\ell+m)\ell d)^{k+2m}. \] This is a common
generalization of previous results on bounding the Betti numbers of closed
semi-algebraic sets defined by polynomials of degree $d$ and 2, respectively.
  We also describe an algorithm for computing the Euler-Poincar\'e
characteristic of such sets, generalizing similar algorithms known before. The
complexity of the algorithm is bounded by $(\ell s m d)^{O(m(m+k))}$.
