Which of the following sentences is correct?
Sentence A : Why are you shouting so suddenly like that ?
Sentence B : Why are you shouting all of a sudden like that ?
Which one is correct? If both are correct, which one is more idiomatic?
Which of the following sentences is correct?
Sentence A : Why are you shouting so suddenly like that ?
Sentence B : Why are you shouting all of a sudden like that ?
Which one is correct? If both are correct, which one is more idiomatic?
The comments on the question have been quite enlightening. I would've thought this a simpler question, so I'll risk posting the simple answer, but I owe credit to the commentators, so I'll make this a community wiki and encourage them to edit if they disagree with this answer as a summary.
Simple answer: Both are correct; Sentence B is more idiomatic.
Complex answer: see comments!
There is something worth remarking about here first which is tangential, and that is this: we have a progressive action ("to be shouting") which is being combined with "suddenly".
Now, you cannot suddenly do something which is ongoing, or habitual.
Why are you shouting suddenly like that?
means that "You are showing a new behavior of shouting that may be ongoing or habitual from now on for some time. Why did you suddenly switch to this behavior?"
It is different from:
Why did you shout suddenly like that?
which only asks about the one time that the other person shouted, without assuming that shouting is going to be a persistent behavior.
An important point here is that the first sentence only makes sense if the speaker has a reason to believe that the shouting is a new mode of behavior that shows signs of continuing. The second sentence can be used even if an indefinite amount of time has passed since the other person last shouted.
Anyway, on to the topic:
"all of a sudden" and "suddenly" are not quite interchangeable. "suddenly" can replace "all of a sudden", but "all of a sudden" can only replace "suddenly" when "suddenly" is used as a word which introduces an entire clause. When suddenly is close to the verb, functioning as an adjective, then "all of a sudden" can be awkward. It depends on how it is positioned. If it can be introduced as a kind of parenthetical comment, then it works.
Why did you shout {suddenly | all of a sudden?} like that?
Why did you suddenly shout like that?
Why did you, all of a sudden, shout like that?
The second example is fine because "all of a sudden" isn't being forced to function as an adverb. It's a kind of comment, and in that area of language there is a lot of flexibility.
In the 1978 comedy movie High Anxiety there is a lovable character named Dr. Vicktor Lillolman (the name Lillolman being a word play on "little old man"). The elderly psychiatrist is obviously a non-native speaker of English, speaking with a German-like accent. One of the cute mistakes that he makes is to misuse "all of a sudden", when he speaks the following line in response to Dr. Thorndike:
Thorndike: Your predecessor, Dr. Ashley, hired me.
Lillolman: It's a shame he died so ... all of a sudden.
Lillolman pauses briefly trying to think of the right English word, and the obvious joke is that he is able to think of the awkwardly-fitting "all of sudden", yet it does not occur to him to use the obvious and correct adverb "suddenly" which is closely related to "all of a sudden".