Part 1 Title 7 Chapter 5 Section 125 of the California Penal Code states:
An unqualified statement of that which one does not know to be true is equivalent to a statement of that which one knows to be false.
When one makes an unqualified statement of X, one is implicitly stating that one knows that X is true. Thus, if you don't know that X is true, such a statement is perjury. Ultimately, a witness' testimony is not of what is true, but what they have personal knowledge of (or, in the case of an expert witness, what opinion they have, informed by their personal knowledge of the events of the case and their professional expertise). If you don't have personal knowledge of a fact, then it is inappropriate to give unqualified testimony to that fact. If not misleading the trier of fact as to one's level of knowledge causes the trier of fact to give less credence to one's testimony, so be it. Intentionally giving misleading testimony to make oneself seems more credible is perjury.
If a party doesn't have a reasonable expectation that the witness would have personal knowledge of the matter, then it's inappropriate for them to ask the question in the first place, and the other party can object to the question (e.g. "Objection: calls for speculation"). For instance, if a cop comes in after the robber was subdued by a security guard, and after the security guard has taken the robber's gun away, and a lawyer asks the cop "What hand was the robber using to hold the gun?", that would be improper, as there would be no way for them to answer that without engaging in speculation or hearsay.