Number of sentences and sentential forms generated by a grammar
If the context-free grammar is unambiguous, you can count the number of sentences it generates in a linear scan with a carefully chosen order.
I'll assume we have removed all useless symbols and cycles from the grammar.  If it is finite and free of useless symbols and cycles, then it should not contain any recursion.
Let $N(A)$ denote the number of sentences that can be constructed starting from nonterminal $A$, i.e., $N(A) = |L(A)|$.  If the grammar is unambiguous and has no recursion, you can compute $N(A)$ for each nonterminal as follows.  Construct a dependency graph with one vertex per nonterminal, and an edge $A \to B$ whenever the grammar contains a rule $B ::= \cdots A \cdots$, i.e., a rule with $B$ on the left-hand side and $A$ on the right-hand side.  If the grammar has no recursion, then this is a dag.  Visit the vertices of this graph in topologically sorted order.  Then it is easy to compute the number of sentences: for example, if we have the rule $A ::= BaC | DE$, then we have
$$N(A) = N(BaC) + N(DE) = N(B) N(a) N(C) + N(D) N(E).$$
That's an example, but you can do the same for any number of alternatives on the right-hand side and any string of symbols in each alternative.  Note that we have the base case $N(a) = 1$, for any terminal $a$.
I expect this can be adjusted to count the number of sentential forms as well, but I haven't tried to work out the details.
This relies crucially on the grammar to be unambiguous.  If the grammar is ambiguous, I'm not sure whether there is any efficient algorithm -- I just don't know.
For unambiguous grammars, see also https://en.wikipedia.org/wiki/Chomsky%E2%80%93Sch%C3%BCtzenberger_enumeration_theorem, which shows how to count the number of sentences of a particular length, even if the grammar is not finite.