In Act 3, Scene 1, other than Viola's obvious continuation of her role pretending to be a male servant of Orsino's, Viola also transgresses stereotypical gender roles by, for a moment, taking on Feste's role as a fool. During this scene, Viola and Feste have an interesting conversation in which Viola makes as many plays on words as Feste, which means she is also taking on the role of Feste, at least for a moment. Taking on Feste's role is also breach in stereotypical gender roles because the position of court jester was never held by women.
We especially see Viola twisting words as much as Feste in their opening conversation. Here, she compliments his abilities to play the tabor and asks, "[D]ost thou live by thy tabour," meaning, do you earn your living through playing the tabor? (III.i.1-2). Feste's witty reply is that he lives "by the church," which typically means that he is a religious man who follows the church and may even make his living as a curate; however, Feste is making a pun out of the phrase "live by" to literally say he lives near a church (3). Viola continues the play on words in her own clever and witty reply:
So thou must say, the king lies by a beggar, if a beggar dwell near him; or the church stands by thy tabour, if thy tabor stand by the church. (7-9)
In other words, she is saying here that if one can use a phrase usually meant to say that he lives according to the church's ways and decrees in order to say that he simply lives near the church, then one can just as easily say that a king sleeps with a beggar if a beggar lives near the king. Plus one can also just as easily say that the church supports Feste's tabor and all of its ways and decrees if Feste's tabor stands by, meaning is positioned near, the church. Just like Feste made a pun out of the phrase "live by," in these lines, she is making a pun out of the phrase "lie by," which usually means rest by, to say instead sleeps with, and she is also making a pun out of the phrase "stands by," which typically means supports, to simply use it to say stand near. Hence, her very clever play on words, which parallels Feste's own play on words, presents Viola as momentarily taking on Feste's role as fool, or court jester, even though the role of court jester is usually a man's role. This breech of stereotypical gender roles also has a comic effect because the plays on words creates humor, just as the ironic switch in roles also creates humor.