In the time of Jesus many people tried to trip him up by asking him questions and hoping to catch him saying something against the Jewish Law, something that was wrong, or something that was blasphemous or impious. You must remember, though, that in those days, and until this very generation, people were open in their identity. It would never occur to them to hide their identity and challenge Jesus in his knowledge and piety. People did not hide their identities at all. Until recently (and still today in Arabic society) people's names consisted of their father's name! People of all classes were proud of their identity because it earmarked their family and their skills. So when people challenged Jesus they were either personally known to him, or they made themselves known as to their true identity, because to do otherwise would not even occur to them.
Compare it with how odd things are today where people are sneaky and creepy. Back in the 1970's I worked with a woman in a laboratory, D. Thirty years later I went to graduate school and a classmate "introduced" herself to me, whose first name was D. She looked familiar but it took me a while to place her because people sure age over a period of thirty years. But what is odd is that she presented herself as just meeting me for the first time.
Lest you think this is just failing memory on her part, let me tell you about S. who was a secretary of mine for a short time in the early 1980's. Years later a "friend" steered me toward a web site and lo and behold, who is there but S. Again it took me a while to match the aged face to my memory of her. And in emails she never revealed her prior knowledge of me or our relationship.
I've identified a steady parade of pathetic people who I have known, both casually and intimately, who have popped up twenty or more years later in contrived circumstances without identifying themselves to "test" me to see if I identify them. Honestly, I just don't bother most of the time thinking about them. If people cannot think of something more intelligent to do with their time than to "test me" than I hope they aren't going to mind God being extremely unforgiving about what they did with their one and only God given life.
So when reading the Bible passages about Jesus' confrontations with and testing by people, remember that people were totally honest about their identities back then and there was no hypocrisy (other than theological disagreement, like the Pharisees, of course).