The concept of subnetting is there to divide a particular network into smaller subnetworks for separate use of different users.We can visualise this scenario as we have a common router interface for all these smaller subnetworks.
Thus the network id of each of the subnets will remain the same .So we can not modify it.So the only way to divide into subnetworks is take the bits for the purpose of subnetting from host bits.
Keeping in mind the above point ,
Given IP address : 118.35.42.0 so if we assume classful addressing as '/' notation(or CIDR notation) is not used here , so the address belongs to class A address.
So we know that ,
Default network mask of class A network : 255.0.0.0 [ 8 bits for netid and 24 bits from host id]
But the given subnet mask : 255.255.32.0 meaning that 9 bits of host id are borrowed for subnetting purpose and hence subnet number.
Also here binary representation of 32 = 00100000 , so the bit which is masked here is 3rd bit from the left instead of 1st bit (MSB).Hence it is a type of discontinuous mask.
So now we have no of subnet bits = 8 (from second octet of subnet mask) + 1(3rd bit from 3rd octet of subnet mask)
= 9
Hence no of bits remaining for host bits = 24 - 9
= 15
Now if all these 15 bits are set to 0's it becomes part of network id and if all 15 bits set to 1's it becomes the part of direct broadcast address of the entire network..So these cases are excluded and hence not part of valid host addresses of the subnet.
Hence no of valid host addresses allowed = 215 - 2
= 32766