can I configure ospf and eigrp on single switch
YES! we can configure OSPF and EIGRP on single layer-3 switch.
The router selects the best path on the basis of the “route-preference criteria” which includes longest prefix-match, least AD and least metric.
Hope this helps!
Thanks!