GATE 2004
88 questions
MCQ 881-mark 88
Questions 51–55 of 88
A digital system is required to amplify a binary-encoded audio signal. The user should be able to control the gain of the amplifier from minimum to a maximum in 100 increments. The minimum number of bits required to encode, in straight binary, is
Answer: (D)
With bits in straight binary there are different codes. The gain must take at least 100 different settings, so
Check the powers of 2: , so 6 bits are not enough. , so 7 bits are enough (even 101 settings, if the minimum and maximum are both counted, fit in 128 codes). So , and the minimum is 7 bits.
Answer: (D)
Check the powers of 2: , so 6 bits are not enough. , so 7 bits are enough (even 101 settings, if the minimum and maximum are both counted, fit in 128 codes). So , and the minimum is 7 bits.
Answer: (D)
It is desired to multiply the numbers 0AH by 0BH and store the result in the accumulator. The numbers are available in registers B and C respectively. A part of the 8085 program for this purpose is given below :
MVI A, 00H
LOOP:
------
------
-----
HLT
END
The sequence of instructions to complete the program would be
MVI A, 00H
LOOP:
------
------
-----
HLT
END
The sequence of instructions to complete the program would be
Answer: (D)
Multiplication by repeated addition: add B (0AH = 10) to the accumulator C (0BH = 11) times.
MVI A, 00H clears the accumulator. The loop body is:
1. ADD B: A = A + B.
2. DCR C: C = C - 1. This sets the zero flag when C becomes 00H.
3. JNZ LOOP: jump back to LOOP while the zero flag is not set, that is, while C is not 00H.
The loop runs 11 times, so A = 11 x 10 = 110 = 6EH, which fits in 8 bits.
JNZ must come right after DCR C, because it tests the flag that DCR C sets.
Option (B), ADD B, JNZ LOOP, DCR C: JNZ tests the flag set by ADD B, not by DCR C, so C never controls the loop and the count of 11 is lost.
Option (C), DCR C, JNZ LOOP, ADD B: the jump goes back to DCR C, so ADD B runs only once after the loop ends, giving A = 0AH only.
Option (A) puts JNZ LOOP first, before the loop has done any work.
Answer: (D)
MVI A, 00H clears the accumulator. The loop body is:
1. ADD B: A = A + B.
2. DCR C: C = C - 1. This sets the zero flag when C becomes 00H.
3. JNZ LOOP: jump back to LOOP while the zero flag is not set, that is, while C is not 00H.
The loop runs 11 times, so A = 11 x 10 = 110 = 6EH, which fits in 8 bits.
JNZ must come right after DCR C, because it tests the flag that DCR C sets.
Option (B), ADD B, JNZ LOOP, DCR C: JNZ tests the flag set by ADD B, not by DCR C, so C never controls the loop and the count of 11 is lost.
Option (C), DCR C, JNZ LOOP, ADD B: the jump goes back to DCR C, so ADD B runs only once after the loop ends, giving A = 0AH only.
Option (A) puts JNZ LOOP first, before the loop has done any work.
Answer: (D)
Consider the sequence of 8085 instructions given below
LXI H, 9258
MOV A, M
CMA
MOV M, A
Which one of the following is performed by this sequence ?
LXI H, 9258
MOV A, M
CMA
MOV M, A
Which one of the following is performed by this sequence ?
Answer: (A)
Trace the program:
LXI H,9258H sets , so M means the memory byte at 9258H.
MOV A,M copies the byte at 9258H into the accumulator.
CMA complements every bit of A.
MOV M,A stores the complemented value back at 9258H.
So the byte at 9258H is read into A, complemented and written back to 9258H.
(A) describes a step that really happens (MOV A,M). (B) is wrong because CMA complements A and nothing is compared (that would be CMP). (C) and (D) name locations 8529H and 5892H, which are never used; the address used is 9258H.
Answer: (A)
LXI H,9258H sets , so M means the memory byte at 9258H.
MOV A,M copies the byte at 9258H into the accumulator.
CMA complements every bit of A.
MOV M,A stores the complemented value back at 9258H.
So the byte at 9258H is read into A, complemented and written back to 9258H.
(A) describes a step that really happens (MOV A,M). (B) is wrong because CMA complements A and nothing is compared (that would be CMP). (C) and (D) name locations 8529H and 5892H, which are never used; the address used is 9258H.
Answer: (A)
The number of memory cycles required to execute the following 8085 instructions
(i) LDA 3000 H
(ii) LXI D, FOF1H
would be
(i) LDA 3000 H
(ii) LXI D, FOF1H
would be
Answer: (B)
Count the machine (memory) cycles for each instruction. Both are 3-byte instructions.
(i) LDA 3000H: opcode fetch, read of the low address byte, read of the high address byte, and a read of the data from 3000H. That is cycles.
(ii) LXI D,F0F1H: opcode fetch, read of the low data byte, read of the high data byte. That is cycles.
So 4 cycles for (i) and 3 for (ii). LDA needs one more cycle than LXI because it also reads the data from memory.
Answer: (B)
(i) LDA 3000H: opcode fetch, read of the low address byte, read of the high address byte, and a read of the data from 3000H. That is cycles.
(ii) LXI D,F0F1H: opcode fetch, read of the low data byte, read of the high data byte. That is cycles.
So 4 cycles for (i) and 3 for (ii). LDA needs one more cycle than LXI because it also reads the data from memory.
Answer: (B)
Consider the signal flow graph shown in Fig. The gain is
Answer: (C)
Mason's gain formula: