direct mapping cache question
Your cache has 4 blocks of 4 bytes per block each ==> cache size is 16 bytes. Each cache block (4 bytes) stores one word (4 bytes). Thus, there are no byte select bits. (In this machine the smallest addressable unit is a word of 4 bytes.)

Two bits of the word address are directly taken to address these 4 blocks, that's it, why this is called a direct mapped cache. It is not clearly stated in the question which two bits out of the four address bits to use, but usually the lowest significant bits (above the non-existing byte select bits) of the word address are used. These bits are also called the index bits. This leaves the upper two bits for the tag.

The memory has \$2^4=16\$ words and is thus divided into 16 blocks. The cache block 0 could store the memory blocks 0, 4, 8 and 12 because the two least significant bits (= index) is binary "00" in all these memory block addresses. The cache block 1 could store the memory blocks 1, 5, 9 and 13 because the index is binary "01" here. And so on.

The tag memory (table) is addressed with the same index. If the tag stored at the particular index matches that of the word address, then we have a hit. Otherwise, we have a miss and the block is loaded from memory into the cache at the indexed block and the tag line is updated. There is no further search because we have direct-mapped cache. Each memory block is mapped only to one cache block as selected by the index bits.

Analyzing the address trace gets: EDIT bugfix

Address   Index   Tag_Table[Index] Before / After
0111      11      empty / 01  -&gt; Miss
1010      10      empty / 10  -&gt; Miss
0010      10      10    / 00  -&gt; Miss, because another tag
1010      10      00    / 10  -&gt; Miss, because another tag
0111      11      01    / 01  -&gt; Hit
0100      00      empty / 01  -&gt; Miss
0100      00      01    / 01  -&gt; Hit
1010      10      10    / 10  -&gt; Hit
0100      00      01    / 01  -&gt; Hit  (fixed!)
0010      10      10    / 00  -&gt; Miss, because another tag


Thus, the hit rate is 4/10 = 40% in this example.