Siemens interview question

Why do we use gates and Flip Flops?