46. An instruction set of a processor has 125 signals which can be divided into
5 groups of mutually exclusive signals as follows:
Group 1: 20 signals, Group 2: 70 signals, Group 3: 2 signals,
Group 4: 10 signals, Group 5: 23 signals.
How many bits of the control words can be saved by using vertical microprogramming
over horizontal microprogramming?
(A) 0
(B) 103
(C) 22
(D) 55
47. In a binary tree, for every node the difference between the number of nodes
in the left and right subtrees is at most 2. If the height of the tree is h > 0,
then the minimum number of nodes in the tree is:
(A) 2h1
(B) 2h11
(C) 2h_1
(D)2h
48. Let G be a weighted undirected graph and e be an edge with maximum weight in G.
Suppose there is a minimum weight spanning tree in G containing the edge e.
Which of the following statements is always TRUE?
(A) There exists a cutest in G having all edges of maximum weight
(B) There exits a cycle in G having all edges of maximum weight
(C) Edge e cannot be contained in a cycle
(D) All edges in G have the same weight
49. The following C function takes two ASCII strings and determines whether
one is an anagram of the other. An anagram of a string s is a string obtained
by permuting the letters in s.
mt anagram (char *a, char *b){
mt count [1281,1;
for (j = 0; j < 128; j++) count[j]=0;
j = 0;
while (a[j] && b[j]){
A;
B;
}
for (j = 0; 1 < 128; j++) if (count[j]) return 0;
return 1;
}
Choose the correct alternative for statements A and B.
(A) A: count [a[j]]++ and B: count[b[j]]
(B) A: count [a[j]]++ and B: count[b[j]]++
(C) A: count[a[j++]]++ and B: count[b[j]]
(D) A: count[a[j]]++ and B: count[b[j++]]
50. The following C function takes a singly-linked list of integers as a
parameter and rearranges the elements of the list. The list is represented
as pointer to a structure. The function is called with the list containing
the integers 1, 2, 3, 4, 5, 6, 7 in the given order. What will be the
contents of the list after the function completes execution?
struct node (mt value; struct node * next;};
void rearrange (struct node *list) {
struct node *p, *q;
mt temp;
if (!list list - next) return;
p = list; q = list - next;
while (q) {
temp = p - value;
p - value = q - value;
q - value = temp;
p = q - next;
q = p? p - next; 0;
}
}
(A) 1, 2, 3, 4, 5, 6, 7
(B) 2, 1, 4, 3, 6, 5, 7
(C) 1, 3, 2, 5, 4, 7, 6
(D) 2, 3, 4, 5, 6, 7, 1
51. A binary search tree contains the numbers 1, 2, 3, 4, 5, 6, 7, 8.
When the tree is traversed in pre-order and the values in each node printed out,
the sequence of values obtained is 5, 3, 1, 2, 4, 6, 8, 7. If the tree is
traversed in post-order, the sequence obtained would be
(A) 8, 7, 6, 5, 4, 3, 2, 1
(B) 1, 2, 3, 4, 8, 7, 6, 5
(C) 2, 1, 4, 3, 6, 7, 8, 5
(D) 2, 1, 4, 3, 7, 8, 6, 5
52. Let G be a directed graph whose vertex set is the set of numbers from 1 to 100.
There is an edge from a vertex i to a vertex j iff either j = i + 1 or j = 3i.
The minimum number of edges in a path in G from vertex 1 to vertex 100 is:
(A) 4
(B) 7
(C) 23
(D) 99
53. What is the output printed by the following program?
# include <stdio.h>
mt f(int n, mt k) {
if (n = = 0) return 0;
else if (n�1o2) return f(n/2, 2*k) + k;
else return f(n/2, 2*k) � k;
mt main () {
printf(��Iod�,f(20,1));
return 0;
}
(A) 5
(B) 8
(C) 9
(D) 20
54. Let a be an array containing n integers in increasing order.
The following algorithm determines whether there are two distinct
numbers in the array whose difference is a specified number
S > 0. = 0; j =1;
while (j < n) {
if (E) j++;
else if (a[j] � a[i] ==S) break;
else i++;
}
if (j < n) printf(�yes�) else printf (�no�);
Choose the correct expression for E.
(A) a[j] � a[i] > S
(B) a[j] � a[i] < S
(C) a[i] � a[J] < S
(D) a[i] � a[J] > S
55. Let a and b be two sorted arrays containing n integers each,
in non-decreasing order. Let c be a sorted array containing 2n integers
obtained by merging the two arrays a and b. assuming the arrays are
indexed starting from 0, consider the following four statements.
I. a[i] b[i] c[2i] a[i]
II. a[i] b[i] c[2i] b[i]
III. a[i] b[i] c[2i] a[i]
IV. a[i] b[i] c[2i] b[i]
Which of the following is TRUE?
(A) only I and II
(B) only I and IV
(C) only II and III
(D) only III and IV
56. We wish to schedule three processes P1, P2 and P3 on a uniprocessor system.
The priorities, CPU time requirements and arrival times of the processes are
as shown below.
Process |
Priority |
Cpu Time Required |
Arrival Time(HH:MM:SS) |
P1 |
10(Highest |
20sec |
00:00:05 |
P2 |
9 |
10sec |
00:00:03 |
P3 |
8(Lower) |
15sec |
00:00:00 |
We have a choice of preemptive or non-preemptive scheduling. In preemptive scheduling,
a late-arriving higher priority process can preempt a currently running process with
lower priority. In non-preemptive scheduling, a late arriving higher priority process
must wait for the currently executing process to complete before it can be scheduled
on the processor. What are the turnaround times (time from arrival till completion)
of P2 using preemptive and non-preemptive scheduling respectively?
(A) 30 sec, 30 sec
(B) 30 sec, 10 sec
(C) 42 sec, 42 sec
(D) 30 sec, 42 sec
57. Consider a 2-way set associative cache memory with 4 sets and total 8 cache
blocks (0-7) and a main memory with 128 blocks (0-127). What memory blocks will
be present in the cache after the following sequence of memory block references
if LRU policy is used for cache block replacement? Assuming that initially the
cache did not have any memory block from the current job?
(A)03571655
(B)035791655
(C)05791655
(D)35791655
58. In a computer system, four files of size 11050 bytes, 4990 bytes,
5170 bytes and 12640 bytes need to be stored. For storing these files on disk,
we can use either 100 byte disk blocks or 200 byte disk blocks (but can�t mix
block sizes). For each block used to store a file, 4 bytes of bookkeeping
information also needs to be stored on the disk. Thus, the total space used
to store a file is the sum of the space taken to store the file and the space
taken to store the bookkeeping information for the blocks allocated for storing
the file. A disk block can store either bookkeeping information for a file or
data from a file, but not both. What is the total space required for storing
the files using 100 byte disk blocks and 200 byte disk blocks respectively?
(A) 35400 and 35800 bytes
(B) 35800 and 35400 bytes
(C) 35600 and 35400 bytes
(D) 35400 and 35600 bytes
59. The availability of a complex software is 90�h. Its Mean Time
Between Failure (MTBF) is 200 days. Because of the critical nature of
the usage, the organization deploying the software further enhanced
it to obtain an availability of 95%. In the process, the Mean Time To
Repair (MTTR) increased by 5 days. What is the MTBF of the enhanced software?
(A) 205 days
(B) 300 days
(C) 500 days
(D) 700 days
60. A company maintains records of sales made by its salespersons and pays
them commission based on each individual�s total sales made in a year.
This data is maintained in a table with following schema:
salesinfo = (salespersonid, totalsales, commission)
In a certain year, due to better business results, the company decides
to further reward its salespersons by enhancing the commission paid to them
as per the following formula.
If commission < = 50000, enhance it by 2�h
If 50000 < commission < = 100000, enhance it by 4�h
If commission > 100000, enhance it by 6�h
The IT staff has written three different SQL scripts to calculate enhancement for
each slab, each of these scripts is to run as a separate transaction as follows:
Ti Update salesinfo
Set commission = commission * 1.02
Where commission < = 50000;
T2 Update salesinfo
Set commission = commission * 1.04
Where commission > 50000 and commission is <= 100000;
T3 Update salesinfo
Set commission = commission * 1.06
Where commission > 100000;
Which of the following options of running these transactions will update the
commission of all salespersons correctly?
(A) Execute Ti followed by T2 followed by T3
(B) Execute T2, followed by T3; Ti running concurrently throughout
(C) Execute T3 followed by T2; Ti running concurrently throughout
(D) Execute T3 followed by T2 followed by Ti
|