GATE 2003
107 questions
MCQ 1071-mark 107
Questions 46–50 of 107
Consider the set {a, b, c} with binary operators + and x defined as follows :
For example, a + c = c, c + a = a, c x b = c and b x c = a. Given the following set of equations :
For example, a + c = c, c + a = a, c x b = c and b x c = a. Given the following set of equations :
(a x x) + (a x y) = c
(b x x) + (c x y) = c The number of solution(s) (i.e., pair(s) (x, y)) that satisfy the equations is :Answer: (C)
Check each pair (x, y) one by one.
1. So cannot be a solution.
2. So cannot be a solution.
3.
So cannot be a solution.
4. So cannot be a solution.
5. So cannot be a solution.
6.
So is a solution.
7. So cannot be a solution.
8.
So is a solution.
9. So cannot be a solution.
So the number of solutions is .
Answer: (C)
1. So cannot be a solution.
2. So cannot be a solution.
3.
So cannot be a solution.
4. So cannot be a solution.
5. So cannot be a solution.
6.
So is a solution.
7. So cannot be a solution.
8.
So is a solution.
9. So cannot be a solution.
So the number of solutions is .
Answer: (C)
Assuming all numbers are in 2's complement representation, which of the following number is divisible by 11111011?
Answer: (A)
All numbers are 8-bit 2's complement. To read one, if the sign bit is 1, invert the bits, add 1, and put a minus sign in front.
Divisor: , so it is .
(A) , so
(B) , so
(C) , so
(D) , so
Only is a multiple of (). The numbers 28, 41 and 37 leave remainders 3, 1 and 2 when divided by 5.
Answer: (A)
Divisor: , so it is .
(A) , so
(B) , so
(C) , so
(D) , so
Only is a multiple of (). The numbers 28, 41 and 37 leave remainders 3, 1 and 2 when divided by 5.
Answer: (A)
Consider the following assembly language program for a hypothetical processor. A, B, and C are 8 bit registers. The meanings of various instructions are shown as comments.
Which of the following instructions when inserted at location X will ensure that the value of register A after program execution is the same as its initial value?
MOV B, # 0 ; B ← 0
MOV C, # 8 ; C ← 8
Z : CMP C, # 0 ; compare C with 0
JZX ; jump to X if zero flag is set
SUB C, # 1 ; C ← C - 1
RRC A, # 1 ; right rotate A through carry by one bit. Thus:
; if the initial values of A and the carry flag are a7...a0 and
; c0 respectively, their values after the execution of this
; instruction will be c0a7...a1 and a0 respectively.
JC Y ; jump to Y if carry flag is set
JMP Z ; jump to Z
Y : ADD B, # 1 ; B ← B + 1
JMP Z ; jump to Z
X : Which of the following instructions when inserted at location X will ensure that the value of register A after program execution is the same as its initial value?
Answer: (A)
C starts at 8 and falls by 1 in each pass, so the loop does exactly 8 instructions before the jump to X. Treat A and the carry as one 9-bit ring that rotates right by one bit per . Take the carry flag as changed only by .
- Start: , carry .
- After 1 rotation: , carry .
- After 2 rotations: , carry .
- After 8 rotations: , carry .
A ring of 9 bits returns to its start after 9 rotations, so one more at X gives back , the original value.
(B) NOP leaves A as , which is not the original in general.
(C) A left rotate through carry gives , which is a 2-place shift of the ring from the original, so it is not the original in general.
(D) adds 1 to the rotated value, which cannot restore the original bits.
Answer: (A)
- Start: , carry .
- After 1 rotation: , carry .
- After 2 rotations: , carry .
- After 8 rotations: , carry .
A ring of 9 bits returns to its start after 9 rotations, so one more at X gives back , the original value.
(B) NOP leaves A as , which is not the original in general.
(C) A left rotate through carry gives , which is a 2-place shift of the ring from the original, so it is not the original in general.
(D) adds 1 to the rotated value, which cannot restore the original bits.
Answer: (A)
Consider the following assembly language program for a hypothetical processor. A, B, and C are 8 bit registers. The meanings of various instructions are shown as comments.
If the initial value of register A is A0 the value of register B after the program execution will be
MOV B, # 0 ; B ← 0
MOV C, # 8 ; C ← 8
Z : CMP C, # 0 ; compare C with 0
JZX ; jump to X if zero flag is set
SUB C, # 1 ; C ← C - 1
RRC A, # 1 ; right rotate A through carry by one bit. Thus:
; if the initial values of A and the carry flag are a7...a0 and
; c0 respectively, their values after the execution of this
; instruction will be c0a7...a1 and a0 respectively.
JC Y ; jump to Y if carry flag is set
JMP Z ; jump to Z
Y : ADD B, # 1 ; B ← B + 1
JMP Z ; jump to Z
X : If the initial value of register A is A0 the value of register B after the program execution will be
Answer: (B)
starts at 0 and starts at 8. In each pass, checks whether is 0; if so the program jumps to X and ends. Otherwise goes down by 1 and rotates A right through the carry. The bit that leaves A, on the first pass, then , and so on, goes into the carry.
- If that bit is 1, the carry is set, is taken and goes up by 1.
- If that bit is 0, the program jumps back to Z and stays the same.
C takes the values 8, 7, ..., 1, so the loop runs exactly 8 times. In these 8 passes each of the 8 bits of goes through the carry exactly once. So counts the 1 bits of .
(A) is wrong because 0 bits do not increase . (D) would hold only when every bit is 1. (C) is wrong because is a count from 0 to 8, not the value of .
Answer: (B)
- If that bit is 1, the carry is set, is taken and goes up by 1.
- If that bit is 0, the program jumps back to Z and stays the same.
C takes the values 8, 7, ..., 1, so the loop runs exactly 8 times. In these 8 passes each of the 8 bits of goes through the carry exactly once. So counts the 1 bits of .
(A) is wrong because 0 bits do not increase . (D) would hold only when every bit is 1. (C) is wrong because is a count from 0 to 8, not the value of .
Answer: (B)
Using a larger block size in a fixed block size file system leads to
Answer: (A)
A larger block means each disk access moves more data, so fewer blocks need to be fetched and fewer seeks are made. This gives better disk throughput.
But a file rarely fills its last block, and a small file uses a whole large block. The unused part of the block is wasted (internal fragmentation), so disk space utilization gets poorer.
Answer: (A)
But a file rarely fills its last block, and a small file uses a whole large block. The unused part of the block is wasted (internal fragmentation), so disk space utilization gets poorer.
Answer: (A)