How to calculate the number of tag, index and offset bits of 2 different caches?
Assuming that your machine is byte addressable(1 word = 1 byte), Let us solve the problem step by step.

1.

Physical address = 36 bits. Since 32 bytes/line and size of cache line = size of main memory block, this means block offset = 5 bits. Hence remaining 31 bits is block number( = tag + index).

number of cache lines = 128KB/32B, therefore, 12 bits for index and hence remaining 19 bits for tag.

2.

Physical address = 36 bits. Since 64 bytes/line and size of cache line = size of main memory block, this means block offset = 6 bits. 2-way associative cache means that two lines in one set.

number of sets = total cache lines/2 = (512KB/64)/2 = 2^12 , therefore 12 bits for set, and hence remaining 18 bits for the tag.