In such questions we should start calculation from higher order address formats meaning the address formats which allows more no of address fields in an instruction.
In fixed instruction format :
Instruction size will remain the same but to accomodate different types of address formats like 1 address instruction format, 2 address instruction format etc . we need to vary the opcode size accordingly which is known as expand opcode technique..
So let us see how to use it here..
Answer to 1) part : It is obvious that for 1 address instruction we will have one address field hence no of bits required for address = 4 bits as we have 16 memory locations ..So log216 = 4 bits required for address field..
Answer to 2) part : As mentioned there are 4 bits required for address..So in a 3 address instruction as we have 3 address fields , so we will have 12 bits for address in an instruction.
.And there are 58 3 address instructions so no of bits required for opcode = ceil (log2(58))
= 6
So instruction size = 6 + 12 = 18.
But using 6 bits of opcode we can have 64 3 address instructions..So we have 6 unused combinations of opcodes which we can utilise for 2 address instructions using expanded opcode technique..
Answer to 3) :
So for each of the 6 unused combinations mentioned one address field will be appended to opcode field so we have 2 address fields in an instruction instead of 3..
So for each one of 6 unused opcodes, no of 2 address instructions = No of addresses
= 16
So total no of 2 address instructions possible = 6 * 16 = 96
But anyways no of bits required for opcode of 2 address instruction = Opcode in 3 address + 1 address field
= 6 + 4 = 10
Answer to 4) :
Length of machine code is nothing but size of an instruction and hence it is 6 + 12 = 18 bits for all be it 3 address or 2 address instruction..