Investigate the characteristics and functionalities of stack and queue data structures in programming.