It is not usual to ask out of game
Asking out of game is known as 'meta-gaming', and this is not the usual way to do things. @pwi posted a link in a comment, which is highly relevant here.
Of course, every game is different and if you're playing D&D as a mere strategy game like chess or as a "battle game", where everyone clearly knows the capability of every game piece, then that is entirely possible. I don't believe this is generally how role-playing games go; players are expected to take the role of their characters to some extent, like actors in a play. The extent to which this is done varies by group (my group is more 'roll-play' than 'role-play'!), but keeping player knowledge separate from character knowledge is still expected to maintain the RPG experience.
@pwi's answer mentioned many other ways your group can do this, but I just wanted to add some of my own DM/player experience.
Describing Resistances/Immunity
As a DM, if a character hits a creature with a damage type it is resistant or immune to I will often say "your fireball singes it, but it the burns don't look as bad as you expected", or "your fireball explodes around it, but the creature - unharmed - merely grins and turns towards you...".
Character Knowledge
On encountering a new creature, players will often ask if their characters know anything about it. This is where I may call for an ability check of some kind, generally Wisdom(Nature) or Intelligence(Arcana) for more obscure magical creatures.
Success will reveal 'common known' information, but that should still be worded in an 'in-game' way. Don't just say "yes, these creatures have around 66 hit points and resistant to non-magical weapons". Better to say "you've heard these creatures are pretty tough and mundane weapons barely scratch them".
The DC for this check is a bit of a judgement call, based around how common the creature is. The rarer the creature, the higher the DC. Then again, certain legendary creatures may be incredibly rare but knowledge of them is known through tales and stories. Many people will have heard of beholders - but not all the stories about them may be true.
If your players made backstories for their characters, it is also possible that a creature may be part of their backstory or the character came from an area where such creatures are known, so that is also a way their characters could know something about them (including their culture, society etc).