(1) When order of the summands matters, you are asking for the (weak) compositions of $k$ in $n$ parts with restricted parts at most $r$, i.e from $\{0,\ldots,r\}$.
The binomial formula (stars-and-bars) is correct when $r$ (the bound on largest part) is omitted or sufficiently large as not to matter.
When $r$ is small enough to restrict the solutions, the resulting problem has been referred to in the literature as "compositions inside a rectangle". See for example:
B. E. Sagan, "Compositions inside a rectangle and unimodality", J. Algebraic Combin. 29 (2009), 405–411.
A discussion of these is given by the online paper (end of Section 6.2)
S. Eger, "Restricted Weighted Integer Compositions and Extended Binomial Coefficients", Journal of Integer Sequences, Vol. 16 (2013)
There was an earlier Question here that also addressed these "restricted compositions". The OP there accepted a self-posted Answer pointing to this paper by M. Abramson, which appears to have been published as:
M. Abramson, "Restricted combinations and compositions", Fibonacci Q. (1976), 439–452
(2) You are asking, when order does not matter, for the integer partitions of $k$ with at most $n$ parts and largest part at most $r$. A related problem asks also that the summands all be distinct, and there is a simple way to convert a problem of that form into the one described here (and conversely). Notation for such countings vary among authors.
Counting the number of such solutions is not especially simple, although it yields readily to recursive solution/dynamic programming methods for modest values of $k$.
I've often turned to an online calculator (written in Java, by Henry Bottomley) for such modest computations, but running Java programs in modern browsers is no longer an easy task (due to security concerns about NPAPI, the interface Java uses in browsers).
Many software packages address the problem of counting integer partitions through (brute force) listing of all possible solutions. In a sense the latter is easier algorithmically, because we cannot expect to improve much in the output of a long list of solutions. A recently updated broad survey of capabilities ("Software for enumerative and analytic combinatorics") by Andrew MacFie (2013/2016) describes "the capabilities that the packages offer as well as some of the algorithms used, and provide[s] links to original documentation."
(if order is important, then it is stars and bars problem)
– Jaideep Khare Apr 16 '17 at 06:37