Functions can be declared as view if it is not modifying blockchains state. In our context, blockchain state is the value of the number variable.
setNumber method changes the value of the variable so it cannot be declared as view. But GetNumber only reads blockchain’s state so it should be declared as view.
Pure methods are the ones that don’t read or modify the blockchain’s state.addTwoNumbers
answers the description of pure methods.