Here, value of `f(x)` is changing at `2` and `4`.
So, `f(x)` to be continuous,
`f(2^-) = f(2^+)`
`=>2^2+2a+b = 3(2)+2`
`=>4+2a+b = 8`
`=>2a+b = 4->(1)`
Also, `f(x)` to be continuous,
`f(4^-) = f(4^+)`
`=>3(4) + 2 = 2a(4) +5b`
`=>14 = 8a+5b`
`=> 8a+5b = 14->(2)`
Multiplying (1) with `4` and then subtracting (1) from (2),
`8a+4b-8a-5b = 16 - 14`
`=> b = -2`
Putting `b = -2` in (1),
`2a-2 = 4 => a = 3`
So, for `a = 3` and `b = -2`, `f(x)` will be continuous.