  The main objective of this paper is to provide a theory for computing the
Hochschild cohomology of algebras arising from a linear category with finitely
many objects and zero compositions. For this purpose, we consider such a
category using an ad hoc quiver $Q$, with an algebra associated to each vertex
and a bimodule to each arrow. The computation relies on cohomological functors
that we introduce, and on the combinatorics of the quiver. One point extensions
are occurrences of this situation, and Happel's long exact sequence is a
particular case of the long exact sequence of cohomology that we obtain via the
study of trajectories of the quiver. We introduce cohomology along paths, and
we compute it under suitable Tor vanishing hypotheses. The cup product on
Hochschild cohomology enables us to describe the connecting homomorphism of the
long exact sequence.
  Algebras arising from a linear category where the quiver is the round trip
one, provide square matrix algebras which have two algebras on the diagonal and
two bimodules on the corners. If the bimodules are projective, we show that
five-terms exact sequences arise. If the bimodules are free of rank one, we
provide a complete computation of the Hochschild cohomology. On the other hand,
if the corner bimodules are projective without producing new cycles, Hochschild
cohomology in large enough degrees is that of the product of the algebras on
the diagonal.
  As a by-product, we obtain some families of bound quiver algebras which are
of infinite global dimension, and have Hochschild cohomology zero in large
enough degrees.
