- The number of strings of length 4 that are generated by the regular expression (0+1+|2+3+)*, where | is an alternation character and {+, *} are quantification characters, is:
(A) 08 (B) 09
(C) 10 (D) 12
Answer: C
- The content of the accumulator after the execution of the following 8085 assembly language program, is
MVI A, 35H
MOV B, A
STC
CMC
RAR
XRA B
(A) 00H (B) 35H
(C) EFH (D) 2FH
Answer: D
Explanation:
MVI A, 35H // content of accumulator = 35H = 0011 0101
MOV B, A // content of register B = 35H
STC // set carry flag = 1.
CMC // complement carry flag = not( 1) = 0.
RAR // Each binary bit of the accumulator is rotated right by one position through the Carry flag. And modify carry = D0.
and D7 = previous carry.
// Now content of accumulator = 0001 1010 , carry = 1.
XRA B // The content of accumulator are exclusive OR with register B.
(0011 0101 )XOR ( 0001 1010 )
= 0010 1111
= 2F H
- In compiler optimization, operator strength reduction uses mathematical identities to replace slow math operations with faster operations. Which of the following code replacements is an illustration of operator strength reduction?
(A) Replace P + P by 2 * P or Replace 3 + 4 by 7.
(B) Replace P * 32 by P<<5
(C) Replace P * 0 by 0
(D) Replace (P<<4) – P by P * 15
Answer: B
- Which of the following are the principles tasks of the linker? I. Resolve external references among separately compiled program units. II. Translate assembly language to machine code. III. Relocate code and data relative to the beginning of the program. IV. Enforce access-control restrictions on system libraries.
(A) I and II (B) I and III
(C) II and III (D) I and IV
Answer: B
Explanation:
LINKER TASKS: I and III
Assembler task: II
Access control task: IV
- Which of the following is FALSE?
(A) The grammar S→aS|aSbS|Î, where S is the only non-terminal symbol, and Î is the null string, is ambiguous.
(B) An unambiguous grammar has same left most and right most derivation.
(C) An ambiguous grammar can never be LR(k) for any k.
(D) Recursive descent parser is a top-down parser.
Answer: B
Explanation:
An unambiguous grammar has not same left most and right most derivation.
- Consider a system with seven processes A through G and six resources R through W.
Resource ownership is as follows:
process A holds R and wants T
process B holds nothing but wants T
process C holds nothing but wants S
process D holds U and wants S & T
process E holds T and wants V
process F holds W and wants S
process G holds V and wants U
Is the system deadlocked ? If yes, …………. processes are deadlocked.
(A) No (B) Yes, A, B, C
(C) Yes, D, E, G (D) Yes, A, B, F
Answer: C
Explanation:
- Suppose that the virtual Address space has eight pages and physical memory with four page frames. If LRU page replacement algorithm is used, ………….. number of page faults occur with the reference string.
0 2 1 3 5 4 6 3 7 4 7 3 3 5 5 3 1 1 1 7 2 3 4 1
(A) 11 (B) 12
(C) 10 (D) 9
Answer: Marks to all
Explanation:
- Consider a system having ‘m’ resources of the same type. These resources are shared by three processes P1, P2 and P3 which have peak demands of 2, 5 and 7 resources respectively. For what value of ‘m’ deadlock will not occur?
(A) 70 (B) 14
(C) 13 (D) 7
Answer: C
Explanation:
Peak demands of p1,p2,p3 are 2,5 and 7.
allocate 1 less than peak demand i.e,, p1 –> 1 ,p2–>4 ,p3–>6
the number of resources for which deadlock occurs is 1+4+6 = 11
Add one to the number of resources we get 12 ,the value for which deadlock will not occur . ( 13 is nearest possible answer )
- Five jobs A, B, C, D and E are waiting in Ready Queue. Their expected runtimes are 9, 6, 3, 5 and x respectively. All jobs entered in Ready queue at time zero. They must run in …………. order to minimize average response time if 3 < x < 5.
(A) B, A, D, E, C (B) C, E, D, B, A
(C) E, D, C, B, A (D) C, B, A, E, D
Answer: B
Explanation:
sequence should be C -> E -> D -> B -> A
- Consider three CPU intensive processes P1, P2, P3 which require 20, 10 and 30 units of time, arrive at times 1, 3 and 7 respectively. Suppose operating system is implementing Shortest Remaining Time first (pre-emptive scheduling) algorithm, then ………….. context switches are required (suppose context switch at the beginning of Ready queue and at the end of Ready queue are not counted).
(A) 3 (B) 2
(C) 4 (D) 5
Answer: C
Explanation: