Programmers rarely use state machines, but they are useful in certain circumstances. In the places they work well, they can make code cleaner, far easier to debug, and much easier to reason about and maintain.
A primitive data type can either be a basic type that provides the basic building blocks for a language or a built-in type that the language treats and supports as a basic type. Composite types are ones that are a combination of primitive types or other composite types. These may or may not be built into the language you are using. The difference being that a primitive type, like a prime number, cannot be decomposed into simpler types.