You need to drop "the" in both sentences. Then both are correct and have the same meaning.
Student or Learner
Have you ever had the cashew nuts?
Have you ever eaten the cashew nuts?
Do both these sentences convey the same meaning?
Although we use "have" to mean "eat" in some contexts, there is a (slim) chance that your first sentence might simply be asking if the person had ever owned cashew nuts.
Remember - if you don't use correct capitalisation, punctuation and spacing, anything you write will be incorrect.