What is the value of beta after the following code executes
What is the value of beta after the following code executes if the input is 5
a)16
b)11
c)7
d)20
Solution
Answer will be 16.
because input is 5, first it will flow in case 5 and now the value of beta is 10.
because there is no break statement after case 5 it will flow to case 1 and now the vlue of beta is 11 and after that it will flow to case 5 andnow the value of beta is 16. after that there is \"break;\" condition so it will exit the switch case.
so value of beta is 16.
