How Unicast/multicast/Broadcast Traffic is forwarded by Switch, Router and Hub

To Answer this first we should know what is unicast /multicast and Broadcast traffic is.

Unicast Traffic : The traffic destined to a single host in network is unicast traffic . Like ARP Request is Broadcast traffic but the ARP reply is unicast traffic.

Broadcast traffic : Broadcast traffic is the traffic which is destined for all the host in the same subnet.

Multicast Traffic : Multicast traffic is destined to a group of hosts who wishes to join the group. How the hosts join the multicast stream ? They open the desired port/ ip address pair which receives the traffic.

How  Hub forwards the Unicast/ Multicast and Broadcast Traffic ?

Hub is a single Collision domain and a single broadcast domain, which means that every packet whether it is unicast/multicast or broadcast will be forwarded to every other port.

How  Switch forwards the Unicast/ Multicast and Broadcast Traffic ?

Switch breaks collision domain and is single boradcast domain. It has its own Learning table or bridge table or MAC table. It updated the entry in this table based on source mac address and the port no. So when a packet is received on lets say PORT A with Source mac as AA:AA:AA:AA:AA:AA it will update its entry and all packets destined to this host will be sent to this port only.