Understanding the Interplay between Parametric and Contextual Knowledge for Large Language Models