Quite often, a dungeon master will reveal to the players the classes of the NPCs whom the PCs are fighting for ease of tactical decision making, on assumptions such as that the guy in heavy armour and carrying a two-handed weapon may be a fighter, while the small guy without armour who is carrying pouches of spell components may be a wizard.
However, the DM doesn't need to do this explicitly. The DM could just describe the NPCs and let the PCs and their players work it out.
Now, I'm getting into a situation in my campaign (a murder mystery at a civilised party) where neither the PCs nor the NPCs will be equipped for battle, and many of the guests will be people that the PCs haven't met before that night... and many of those that the PCs have met are known to them by name and occupation (such as cargo broker, or their nation's Chancellor), not their character class. Many aristocrats will be Aristocrat-class, but some will be other classes. There will be a few Assassins in attendance who may - or may not - have had anything to do with the murder(s).
My question is, Is there any mechanism in D&D (by use of skills, magic or otherwise) by which the character class(es) and/or level(s) of another character (NPC or PC) can be determined to the in-game knowledge of the characters, or will the PCs (and therefore the players) and NPCs just have to 'work it out' from the way the characters act and what they say?
EDIT
This question has been closed as a duplicate of Is there a way to ask in game (i.e. in a non-meta way) what a character's class is?. This question is not a duplicate since that question is tagged dnd-5e and this is a dnd-3.5e question. Different editions, different rules.