Vous êtes sur la page 1sur 51

Aptitude

1. S&P 500 index closed at 2000 on Friday last week, and it went up by 20
points on Monday. The index lost 30 points the next day and closed at
2040 on Wednesday. Then it went up by 40 points on Thursday and
closed the week gaining another 40 points on Friday, hitting a record
high. What was the change in the index on Wednesday? (1 - Mark)
a. -10
b. 40
c. 50
d. 80
Solution:
The index on each day is as follows:

Monday: 2000+20 = 2020


Tuesday: 2020-30 = 1990
Wednesday: 1990+50=2040
Thursday: 2040+40=2080
Friday: 2080+40 = 2120

Thus, the change in the index on Wednesday is 2040-1990 = 50

2. Mohit biked around a square field at the speeds of 20 m/hr, 30 m/hr, 40


m/hr, and 60 m/hr along the four sides. What was his average speed for
the entire ride?
a. 28 m/hr
b. 32 m/hr
c. 37.5 m/hr
d. 42 m/hr
Solution:
Average Speed = Total Distance/Time
Let the distance be D.
Since it is a square, the total distance is 4D
Average Speed = 4D / {D/20+D/30+D/40+D/60} = 4D/(15D/120) = 8*4 =
32 m/hr

3. If I were rich, __________ a lot.


a. I would travel
b. I will travel
c. I can travel
d. I travelled
Solution:
If I were rich...<-- I am not rich, but I imagining what I would do if I
were. “I were” is used when you're are talking about something that
isn't true or when you wish something was true. "I was" is for things that
could have happened in the past or now.
4. The tired traveller _________ on in the hope of finding some resting
place.
a. Scurried
b. Strolled
c. Paraded
d. Plodded
Solution:
The word tired best matches with Plodded which means walk
doggedly and slowly with heavy steps.

5. There are 100 people in a room, exactly 99% are physicist. How many
physicist must leave the room to bring down the percentage of physicist
to exactly 98%?
a. 49
b. 50
c. 99
d. None
Solution:
let x represent the number of physicist that need to leave

so we get:
99- x / 100-x = .98
99-x = 98 - .98x
1 = .02x
x = 50
so it is 50 physicist

6. A company uses 2 machines to fill an order for 3,360 bottle caps.


Machine A can produce 72 bottle caps every 24 minutes, and it can run
for 4 hours before it must undergo a 3-hour recalibration procedure.
Machine B can produce 48 bottle caps every 12 minutes, and it can run
for 4 hours before it must undergo a 2-hour recalibration procedure. If
both machines begin working at the same time, and are working
whenever they are not being calibrated, then how many of the 3,360
bottle caps are made by machine A?
a. 1440
b. 1620
c. 1680
d. 1920
Solution:
24 min – 72 bottle caps
Machine A in 1 hr: 180 caps
12 min – 48 bottle caps
Machine B in 1 hr: 240 caps
A works 4 hours followed by 3 hr of downtime and so on
B works 4 hours followed by 2 hr downtime and so on
Hr 1-4 - A and B work and produce (180+240)*4 = 1680 caps
Hr 5-6 – A and B neither works
Hr 7 - B alone works and produces 240 caps
Hr 8-10 - A and B work and produce (180+240)*3 =1260 caps
By now Total 1680 + 240 + 1260 = 3180 caps have been produced
Hr 11 ‘A’ alone works and produces the remaining 180 caps
(Note: Total Requirement = 3360 caps)
It can be seen that Machine A works for a total of 8 hours
It produces 180*8 = 1440 caps

7. The passage given below is followed by a question. Choose the most


appropriate answer to the question. The cost of housing in many urban
parts of India has become so excessive that many young couples, with
above-average salaries, can only afford small apartments. EMI and rent
commitments are so huge that they cannot consider the possibility of
starting a family since a new baby would probably mean either the
mother or father giving up a well-paid position, something they can ill
afford. The lack of or great cost of child care facilities further necessitate
the return of both parents to work. Which of the following adjustments
could practically be made to the situation described above which would
allow young couples to improve their housing prospects?
a. Encourage couples to have only one child
b. Encourage couples to remain childless
c. Encourage young couples to move to cheaper areas for living
d. None of these is likely to have an impact on the current
situation
8. Germany is rightly proud of its ability to control costs and keep on
exporting. But it also needs to recognize that its success has been won in
part at the expense of its European neighbors. Germans like to believe
that they made a huge sacrifice in giving up their beloved D-mark ten
years ago, but they have in truth benefited more than anyone else from
the euro. Almost half of Germany’s exports go to other euro-area
countries that can no longer resort to devaluation to counter German
competitiveness.Which of the statements below can be inferred from the
above passage?
a. Germany has favored helping the deficit euro-area countries.
b. All the Germany’s exports go to other euro-area countries
c. Germans have benefited more than anyone else from the
euro.
d. Germany has recognized that its success has been won in part at
the expense of its European neighbors.
Solution:
Option (a):
This statement is incorrect and cannot be inferred as nothing is mentioned
about Germany favoring other euro-area countries in the passage.
Option (b):
In the passage, it is mentioned that “almost half of Germany’s exports go to
other euro-area countries”, but not all. So, the given statement cannot be
inferred from the passage.
Option (c):
The given statement can be inferred from the given passage as it is clearly
mentioned that “They (Germans) have in truth benefited more than anyone
else from the euro.”
Option (d):
This statement cannot be inferred as it contradicts to what is given in the
passage that “Germany needs to recognize that its success has been won in
part at the expense of its European neighbors”.
9. How many 4 digit numbers can be formed using the digits 1, 2, 5, 6, 8
and 9 without repetition, so that 2 and 5 never come together?
a. 144
b. 180
c. 288
d. 360
​Solution:
Total ways = 6p4 =6*5*4*3 = 360 (any 6 numbers can take the first slot, any
5 in the second slot ...)
Restriction - 2 and 5 can't be placed right next to each other.
X= 2
Y= 5
First scenario: XY43 = 1*1*4*3 = 12. Multiply it by 2 since X and Y can
switch positions too. = 24
Second scenario: 4XY3 = 4*1*1*3 = 12. Multiply it by 2 since X and Y can
switch positions too. = 24
Third scenario: 43XY = 4*3*1*1 = 12. Multiply it by 2 since X and Y can
switch positions too. = 24
Total - unwanted = 360 -24 -24 - 24 = 288

10. Varma, Naveen, and Subbarao race each other in a 100 meters race.
All of them run at a constant speed throughout the race.
Varma beats Naveen by 20 meters.
Naveen beats Subbarao by 20 meters.
How many meters does Varma beat Subbarao by?_____ (meters)
Solution:
Answer is 36
Varma beats Naveen by 20m and Naveen beats Subbarao by 20 m in a
100m race
When Varma runs 100m Naveen runs 80m
When Naveen runs 100m Subbarao runs 80m
So when Naveen will run 80m Subbarao will run 80*80/100 = 64m
Hence when Varma runs 100m Subbarao runs 64m
Varma beats Subbarao by 100 - 64 = 36m

Computer Science

1. A commuter bus has 10 seats. The probability that any passenger will not
show up for the bus is 0.6 independent of other passengers. If the bus
company sells 12 tickets for the bus operation, what is the probability that at
least one passenger will have to stand? ​(Discrete Maths - 2 Marks)
10
38×2
a. 11
5
12
38×2
b. 12
5
11
2
c. 12
5
11
38×2
d. 12
5
Solution:
Let X be the random variable that represents the number of passengers
showing up for the bus, and p be the probability that any passenger will
show up for the bus. Then, the probability that the number of passengers
exceeds the number of seats is
P(X>10) = P(X=11) + P(X=12)
Since anybody's absence is independent of others', X follows the binomial
distribution X ~ B (12, p) Therefore for all k, P(X=k) is

Hence we have
2. A tower is built with cards. Only 2 cards are needed for 1 floor, and 7 cards
are needed for 2 floors, and so on. What is the number of cards needed for a
10-floor tower?_________ ​(Discrete Maths 2 Marks)
Solution:
To build an n-floor tower, what we need at the bottom below the (n-1)-floor
tower already built is the following:
a. n 1 -floor towers which need 2 cards each
b. (n-1) cards to be laid on top of these n 1 -floor towers.
Let x​.​n be the number of cards needed for an n-floor tower, then x​1 =2 and
for n>=2
3. Consider the following statements ​(Maths - 2 marks)
I. Suppose A is a 3×3 matrix whose third row elements are the sum of
first two row elements. Then A is invertible.
II. Let A​n denote n×n matrix whose diagonal entries are equal to 3 and all
other entries are equal to 1. Then A​n​ is invertible for each n≥1.
Which of the following is true?
a. I only
b. II only
c. Both I and II
d. None of these
Solution:

Let A =
By doing the row operation R​3​ -> R​3​ - (R​1​ + R​2​) we get

The reduced echelon form of A has a row of zeros. So, A is not invertible
(therefore |A| = 0)

Statement II:

A​n​ =
Apply row operation R​1​ -> R​1​ + R​2​ + R​3​ + ….. + R​n​ on A​n​, we get
R1
R​1​ -> n+2 , we get

=
R​2​ -> R​2​ - R​1​, R​3​ -> R​3​ - R​1​, ….., ….. R​n ​ -> R​n​ -R​1​, we get

=
R2 R3 Rn
R​2​ -> 2 , R​3​ -> 2 ,... R​n​ -> 2 , we get

R​1​ -> R​1​ - (R​2​ + R​3​ + …… + R​n​) we get

=
Then the reduced echelon form of A​n​ is identity matrix
Therefore |A​n​| =/ 0
So, A​n​ is invertible
4. Suppose f(x) is a differentiable function on the interval [6,9] such that
f(6)=18 and f(9)=27 Which of the following values must be contained in
f’([6,9])._____ ​(Maths - 2 Marks)
Solution:
Answer is 3
Let g(x) = f(x)-18-(x-6) 27−18
9−6 =f(x)-18-3(x-6) = f(x)-3x on [6, 9].
Then g(6)=0=g(9) and g(x) is differentiable on [6, 9]
By rolle’s theorem, there is c ∈ (6, 9) such that g’(c) = 0
Since g’(x) = f’(x) -3, thus 0 = g’(c) = f’(c)-3 which implies f’(c) = 3 Hence
3 must be contained in f’([6,9]).
Now, suppose that f(x)=3x then f(x) satisfies the conditions in the problem
and f’(x)=3 on [6,9]. So, 2,0,4 may not contained in f’([6,9])
5. Suppose 3 married couples are randomly seated around a circular table. (It is
not required that the members of any couple must be seated together.) The
probability that no spouses are seated next to one another is ab , where a and
b are positive coprime integers. Find b-a._____ ​(Discrete Maths 2 Marks)

Solution:
Answer is 11
no. of ways when all three spouses sit together=16
no. of ways when two of the three spouses sit together=24
no. of ways when only one pair of spouses sit together=48
therefore 16+24+48=88
there are total (6-1)! ways... =120
Thus there are 32 ways in which spouses don't sit together...
therefore after simplifying we get 4/15 = then b-a = 15-4 = 11

6. A theater is inviting 2670 total students from various schools to see a movie.
Each individual school invited is only allowed to bring at most 38 students.
If the theater has 193 seats in each row, how many rows do they need to set
aside for schools in order to guarantee that all students from the same school
can be seated in the same row?___________ ​(Discrete Maths - 2 Marks)
Solution:
Answer is 17
The following table shows the number of extra (unoccupied) seats in each
row based on the assumption that exactly n students show up from each
school:

the second row of which is the quotient of 193 upon division by n, and the
third row of which is the remainder of 193 upon division by n. The reason
for this table is to find the worst case scenario where the most number of
seats are unoccupied in each row. As we can see in the table, n=33 is the
worst case where as many as 28 seats are unoccupied in each row. (For
n<=28 the number of extra seats is less then, 28 because the remainder must
be smaller than the divisor.)
Thus in the worst case scenario, the number of students sitting in each row
is33*5 =165(<193).
165*16 = 2640, which is 30 short. Again in the worst case, those 30 remain
as a single class. Since there are 28 empty spaces per row, that means the
extra 30 must go on a new row, so 17 rows are needed.

7. Consider the following statements.


I. If a cut-vertex is removed from a graph along with its incident edges, it
partitions the graph into exactly two non-empty components.
II. A biconnected component has at least one cut vertex.
Which of the above statements is/are correct? ​( Discrete Maths - 1 Mark)
a. I only
b. II only
c. Both I and II
d. None of these
Solution:
I. False:
Example
Deleting cut vertex v results in 3 - non empty components

By definition a biconnected component can’t have any cut vertex


Statement 2 is false
Option D is correct

8. Satish has 4 black shirts and 6 white shirts in his closet. He also has 5 black
ties and 3 white ties in his drawer. If Satish reaches into the closet and takes
out a shirt at random, then reaches into the drawer and takes out a tie at
random, then the probability that the shirt and the tie are the same color is ab
, where a and b are coprime positive integers. What is the value of
a+b?_________ ​(Discrete Maths 1 Mark)
Solution:
4
The probability of picking out a black shirt and a black tie is 10 × 58 = 14
6 3 9
The probability of picking out a white shirt and a white tie is 10 × 8 = 40
Hence, the probability of picking out a shirt and tie of the same color is
1 9 19
4 + 40 = 40
Hence a+b = 59

9. Consider an operation x*y=xy​3​ be defined on x,y∈R. Now (R,*) is


(Discrete Maths - 1 Mark)
a. a semi group
b. a monoid
c. a group
d. None of these
Solution:
Given x,y∈R
Closure Property:
x*y=xy​3​⟸R
So (R,*) is algebraic structure.
Associative Property:
x*(y*z)=(x*yz​3​ )
=x(yz​3​ )​3
=xy​3​ z​9
(x*y)*z=(xy​3​*z)
=xy​3​ z​3
Clearly, x*(y*z)≠(x*y)*z
*is not associative and therefore (R,*) is not a semigroup.
Consequently, it is not a monoid and it is not a group.

10. ​(1) Given: ¬ (p ⋀ q )


(2) Suppose: ¬(¬p ⋁ ¬q)
(3) Suppose ¬ p
(4) By disjunction using (3), ¬p ⋁ ¬q
(5) Since (2) and (4) are a contradiction, that implies p
(6) Suppose: ​?
(7) By disjunction using (6), ¬p ⋁ ¬q
(8) Since (2) and (7) are a contradiction …
What goes at the question mark of line 6? (You can assume we aren't just
supposing again.) ​(Discrete Maths - 1 Mark)
a. ¬p ⋀ q
b. ¬p ⋀ ¬q
c. q
d. ¬q
Solution:
(1) Given: ¬ (p ⋀ q )
(2) Suppose: ¬(¬p ⋁ ¬q)
(3) Suppose ¬ p
(4) By disjunction using (3), ¬p ⋁ ¬q
(5) Since (2) and (4) are a contradiction, that implies p
(6) Suppose: ¬q
(7) By disjunction using (6), ¬p ⋁ ¬q
(8) Since (2) and (7) are a contradiction, q …
The other answer choices would require q or ¬p to work; neither formula
is available

11.Consider the two sets


X = {1, 2, 3, 4}
Y = {-8,0, 20}
Let f be a surjective function from X to Y such that for any two elements x​1
and x​2 of X if x​1 < x​2 , then f (x1 ) ≤ f (x2 ) What is the minimum possible
value of f(4)?____________ ​(Discrete Maths 1 -Mark)
Solution:
Since f is a surjective function, every element y in Y has a corresponding
element x in X given by f(x) = y

Observe that if f(4) = -8,0 then, by the condition given in the problem, it
follows that f(1), f(2), f(3), f (3) ≤ f (4) = -8, 0
This implies that there does not exist an element x of X such that f(x) = 20
since 4 is the largest element in X. This contradicts the condition that f is a
surjective function.
Therefore, the only possible value of f(4) is 20 implying that the minimum
possible value of f(4) is 20
12.Given an 8-bit message 11010011. Assuming that even parity is used in the
Hamming code, suppose the bit pattern transmitted for this message as
follows

Bit 1 2 3 4 5 6 7 8 9 10 11 12
positi
on
Check C1 C2 M1 C3 M2 M3 M4 C4 M5 M6 M7 M8
and
msg
bits
? ? 1 ? 1 0 1 ? 0 0 1 1

What are the values of C1, C2, C3 and C4 respectively? ​(Computer


Networks - 2Marks)
a. 0, 1, 0, 1
b. 1, 0, 1, 0
c. 0, 1, 1, 0
d. 1, 1, 0, 0
Solution:
the numbers used below indicate the bit position
3 = 1+2
5 = 1+4
6=2+4
7=1+2+4
9=1+8
10=2+8
11=1+2+8
12=4+8
These relationships tell us that:
bits 3, 5, 7, 9, and 11 determine bit 1, which is check bit C1
bits 3, 6, 7, 10, and 11 determine bit 2, which is check bit C2
bits 5, 6, 7, and 12 determine bit 4, which is check bit C3, and
bits 9, 10, 11, and 12 determine bit 8, which is check bit C4
Therefore, C1 = M1 + M2 + M4 + M5 + M7
C2 = M1 + M3 + M4 + M6 + M7
C3 = M2+M3+M4+M8
C4 = M5+M6+M7+M8
Using even parity,
C1 = 1+1+1+0+1 = 0
C2 = 1+0+1+0+1 = 1
C3 = 1+0+1+1=1
C4 = 0+0+1+1=0
So the actual data stream sent out is as follows:
check and C1 C2 M1 C3 M2 M3 M4 C4 M5 M6 M7 M8
msg bits

0 1 1 1 1 0 1 0 0 0 1 1

13. Calculate the total time to transmit a 1500 KB file over a link. Assuming the
one way delay in either direction is 40ms, and an initial RTT of
“handshaking” before any data is sent.(Note: 1 KB = 2​10 bytes, 1 Mbps = 10​6
bits/s). The bandwidth is 1 Mbps, the packet size including the header is 1
KB of which the header is 40 bytes, and the data packets are sent
continuously and never lost ​(Computer Networks - 2 Marks)
a. 12.28 sec
b. 12.78 sec
c. 12.91 sec
d. None of these
Solution:
Given that the maximum size of the packet is 2​10​ bytes, we can only fit
10
1500*2
2​10​ − 40 bytes in the payload. Therefore we need to send 10 packets,
2 −40
which is 1,561 packets. (Note, the last packet is less than 1 KB in size.)
We then have the following: Total Full Packets + Last packet
(1560 ∗ 2​10​) + (40+960) = 1,598,440 bytes to send = 12,787,520 bits
With the bandwidth set at 10​6​ bits/sec, the transmission time of the data is:
12,787,520
106
= 12.78752 sec.
But we’re not done: we have to add the RTT of handshaking and the
one-way delay, so the total time is 12.78752 + 0.08 + 0.04 sec = 12.90752
sec (for which it’s reasonable to round up to 12.91 sec)

14.Let A and B be two stations attempting to transmit on an Ethernet. Each has


a steady queue of frames ready to send; A’s frames will be numbered A1,
A2, and so on, and B’s similarly. Let T= 51.2µs be the exponential backoff
base unit. Suppose A and B simultaneously attempt to send frame 1, collide,
and happen to choose backoff times of 0 x T and 1 x T, respectively,
meaning A wins the race and transmits A1 while B waits. At the end of this
transmission, B will attempt to retransmit B1 while A will attempt to
transmit A2. These first attempts will collide, but now A backsoff for either
0 x T or 1 x T, while B backs off for time equal to one of 0 x T, . . ., 3 x T.

Suppose A wins this second backoff race. A transmits A3, and when it is
finished, A and B collide again as A tries to transmit A4 and B tries once
more to transmit B1. Give the probability that A wins this third backoff race
immediately after the first collision. ​(Computer networks 2 Marks)
a. 58
11
b. 16
13
c. 16
d. None of these
Solution:
(Option c is correct)
Suppose A picks k​A​(3) to be either 0 or 1 with probability 1/2
each, while B picks k​B​(3) from (0, 1, 2, 3, 4, 5, 6, 7), each with probability
1/8:
P[A wins] = P[k​A​(3) < k​B​(3)] = P[k​A​(3) = 0] × P[k​B​(3) > 0] + P[k​A​(3) = 1] ×
P[k​B​(3) > 1] = 1/ 2 × 7 /8 + 1 /2 × 6/ 8 = 13 /16
15.Consider the effect of using slow start on a line with a 10-msec round-trip
time and no congestion. The receive window is 28 KB and the maximum
segment size is 2KB. How long does it take before the first full window can
be sent? ______(milli seconds) ​(Computer Networks 1 Mark)
Solution:
As there is no congestion(given) with slow start, the first RTT sends out 1
segment (or 2KB), the 2nd RTT sends out 2 segments (or 4KB), the 3rd 4
segments (or 8KB), the 4th 8 segments (or 16KB). The 5th RTT would have
sent out 16 segments (or 32KB), however, it'll exceed the receiver's window.
Therefore, the amount of time it takes BEFORE the 5th RTT (or full
window, that is, 24KB) is 4*10=40 msec.
16. In a public key system using RSA, what is the private key of the user if the
following values are given p=17, q=31 and e=7? ​(Computer Networks 1 -
Mark)___________
a. 481
b. 343
c. 1441
d. None of these
Solution:
Explanation:
⇒ P = 17, q = 31, n = p*q = 527
⇒ e = 7.
⇒ φ(n) = (p −1) × (q −1) = 16 * 30 = 480
⇒ We know that, e × d = 1 mod φ(n)
⇒ We substitute the values of d in the above equation to find d.
⇒ d = 343

17. Consider two different implementations, M1 and M2, of the same


instruction set. There are three classes of instructions (A, B, and C) in the
instruction set. M1 has a clock rate of 80 MHz and M2 has a clock rate of
100 MHz. The average number of cycles for each instruction class and their
frequencies (for a typical program) are as follows:
Instruction class Machine M1 – Machine M2 – Frequency
Cycles/Instructio Cycles/Instructio
n Class n Class
A 1 2 60%
B 2 3 30%
C 4 4 10%

Calculate the average MIPS ratings for each machine, M1 and M2. (MIPS:
Million Instruction per second) ​(Computer Organization 2 Marks)
a. 40, 50
b. 50, 40
c. 40, 40
d. 50, 50
Solution:
For Machine M1:
Clocks per Instruction = (60/100)* 1 + (30/100)*2 + (10/100)*4
= 1.6
For Machine M2:
Clocks per Instruction = (60/100)*2 + (30/100)*3 + (10/100)*4
= 2.5

For Machine M1: Average MIPS rating = Clock Rate/(CPI * 10​6​ ) =


(80 * 10​6​ ) / (1.6*10​6​ ) = 50.0
For Machine M2: Average MIPS rating = Clock Rate/(CPI * 10​6 ) = (100 *
10​6​ ) / (2.5*10​6​ ) = 40.0

18. Assume a fully associative write-back cache with many cache entries that
starts empty. Below is a sequence of five memory operations (the address is
in square brackets):
Write Mem[300];
Write Mem[300];
Read Mem[400];
Write Mem[400];
WriteMem[300];
What is the number of hits and misses when using no-write allocate versus
write allocate? ​(Computer Organization - 2 Marks)
(Note: Write Allocate - the block is loaded on a write miss, followed by the
write-hit action.
No Write Allocate - the block is modified in the main memory and not
loaded into the cache.)
a. No-write allocate: hits-1, misses-4
Write allocate: hits-2, misses-3
b. No-write allocate: hits-4, misses-1
Write allocate: hits-3, misses-2
c. No-write allocate: hits-1, misses-4
Write allocate: hits-3, misses-2
d. No-write allocate: hits-4, misses-1
Write allocate: hits-2, misses-3
Solution:
For no-write allocate, the address 300 is not in the cache, and there is no
allocation on write, so the first two writes will result in misses. Address 400
is also not in the cache, so the read is also a miss. The subsequent write to
address 400 is a hit. The last write to 300 is still a miss. The result for
no-write allocate is four misses and one hit.
For write allocate, the first accesses to 300 and 400 are misses, and the rest
are hits since 300 and 400 are both found in the cache. Thus, the result for
write allocate is two misses and three hits.

19. 30% of a benchmark program’s execution time is from multiply operations.


Uber cool hardware speeds up these operations 12 times! Suppose the
program took 20 seconds to execute without the enhanced hardware, During
its enhanced operation, what is the new execution time ? ​(Computer
Organization - 2 Marks)
a. 12.5 sec
b. 13.5 sec
c. 14.5 sec
d. 15.5 sec
Solution:
1
Speed up = F raction
(1−F ractionenhanced )* Speedup enhanced
enhanced

=​ 1
(1−0.3)* 0.3
12

= 1.38
New execution time = Old execution time / Speedup = 20/1.38 = 14.49 ≡
14.5 sec

20. How many 128k*8 Ram chips are needed to construct 2MB RAM?
___________​(Computer Organization - 1 Mark)
Solution:
Given capacity is 128*8 RAM chips
Target capacity is 2 MB RAM
Number of chips required = 2MB/128*8 = 2​4​ = 16

21. Consider the following statements where O and θ denote Big-Oh and
Big-Theta notations respectively. (c is a constant > 1)
I. c + 1n = O(1)
n
1
II. 1- ∑ 2
i = Θ(log(n))
i=1
Which of the above statements is/are NOT correct? ​(Algorithms 1 Mark)
a. I only
b. II only
c. Both I and II
d. None of these
Solution:
I. True: lim [c + 1n ] = c
n→∞
Therefore [c + 1/n] = O(1)
Statement 1 is true
n 1− 1
1 2n+1 1
II. False: ∑ 2
i = 1− 12
=2 − 2n
i=0
n
1 1
⇒ ∑ 2
i = 1- 2n
i=1
n
1 1
⇒1− ∑ 2
i = 2n =/ Θ(log n)
i=1
Therefore statement 2 is false
22. Suppose an alphabet consists of the symbols {A,B,C,D,E} with the
probabilities for their access being 0.33, 0.22, 0.2, 0.15 and 0.1 respectively.
If we use Huffman coding for encoding the symbols, then what is the
average encoding length of the symbols? ​(Algorithms 1 Mark)
a. 2.34
b. 2.25
c. 2.17
d. None of these
Solution:

A B C D E
0.33 0.22 0.2 0.15 0.1
Arrange increasing order their probabilities
Average encoding length = 2(0.33) + 2(0.22) + 2(0.2) + 3(0.1) + 3(0.15) =
= 2.25

23.Consider the following multistage graph has 9 vertices and k=5 stages.

Calculate the minimum cost from path S to D using Dynamic


Programing?__________
(Algorithm 2 Marks)
Solution:

Answer is 10
Cost(S, D) = min { 4 + cost(v2, D), 1 + cost(v3, D)}
Cost (v2, D) = min{3+cost(v4, D), 3+ cost(V6, D)}
Cost(v4, D) = min{1+cost(v7, D), 4 + cost(v8, D)}
Cost(v7, D) = 6
Cost(v8, D) = 2
Cost(v4, D) = min{1+6, 4+2} = 6
Cost(v6, D) = min{6+cost(v7, D), 2+cost(v8, D)} = 4
Cost(v2, D) = min{3+6, 3+4} = 7
Cost(v3, D) = min{6+cost(v4, D) 5+cost(v5, D), 8+cost(v6, D)}
Cost(v5, D) = min{6+cost(v7, D), 2+cost(v8, D)} = 4
Cost(v3, D) = min{6+6, 5+4, 8+4} = 9
Cost(S, D) = min{4+7, 1+9} = 10

24.Consider an array containing ‘n’ elements. The elements present in an array


are in arithmetic progression, but one element is missing in that order. What
is the time complexity to find the position of the missing element using
divide and conquer? ​(Algorithms 2 Marks)
a. O(n​2​)
b. O(n)
c. O(log n)
d. O(nlogn)
Solution:
The time complexity is O (log n) using binary search.
The idea is to go to the middle element. Check if the difference between
middle and next to middle is equal to diff ((A[n-1] – A[0])/n) or not, if not
then the missing element lies between mid and mid+1. If the middle element
is equal to n/2th term in Arithmetic series (let n be the number of elements in
input array), then missing element lies in right half. Else element lies in left
half.

25.Consider the following digraph.(Assume that the adjacency lists are in sorted
order: e.g., when iterating through the edges emanating from vertex 5,
consider the edge 5 → 3 before the others.)
Which of the following is the correct reverse postorder listing of the above
digraph?
​(Algorithms - 2 Mark)
a. 5 7 8 6 1 0 4 2 3
b. 8 5 7 6 1 0 4 2 3
c. 0 4 2 3 8 5 7 6 1
d. None of these
Solution:

Reverse Postorder :
Optio 8 5 7 6 1 0 4 2 3
nB
Finish 18 16 15 13 10 8 7 6 5
ing
time

26. Which of the following statements is/are True. The activation record or
stack frame consists of the following data. ​ (Data structures - 2 Marks)
I. Parameters and local variables
II. Pointer to previous activation record
III. Return address i.e the instruction in the caller function which is
immediately after the function call
IV. Return value if function is not void
a. I, II, III
b. I, II, IV
c. I, III, IV
d. I, II, III and IV

27. Consider a min heap represented by an array, The elements present in an


array are
4, 6, 10, 7, 9, 21, 11, 13, 19, 10

Array index 0 1 2 3 4 5 6 7 8 9
value 4 6 10 7 9 21 11 13 19 10

Now, delete one by one element from min heap (delete root element from
min heap) and inserted into binary search tree. Print the preorder traversal of
the binary search tree. (Note: suppose If two of the elements have same
value then insert new element on left side in the tree)
(Data structures- 2 Marks)
a. 4, 6, 10, 7, 9, 21, 11, 13, 19, 10
b. 4, 6, 7, 9, 10, 10, 11, 13, 19, 21
c. 4, 10, 19, 13, 11, 21, 9, 7, 10, 6
d. 4, 10, 9, 7, 6, 10, 19, 13, 11, 21
Solution:
Deletion of elements from min heap in the following order.
4, 6, 7,9, 10, 10, 11, 13, 19, 21
The binary search tree will be
28. What is the length of the longest chain if the following keys are inserted in a
table of size 11 using modulo division and separate chaining__________
1457, 2134, 8255, 4720, 6779, 2709, 1061, 3213
​(Data structure 1 Mark)
Solution:
Answer is 3
(i) ​1457 %11 = 5
(ii) 2134%11 = 0
(iii) 8255%11 = 5
(iv) 4720%11 = 1
(v) 6779%11 = 3
(vi) 2709%11 = 3
(vii) 1061%11 = 5
(viii) 3213%11 = 1
At location 5, maximum length of the longest chain is 3
29. Consider the following c function
void foo(struct node *head, int n)
{
int count;
struct node *p, *q;
p =head;
q = head;
if(head)
{
for(count=0; count<n; count++)
{
if(!q) return;
q = q->next;
}
while(q)
{
p = p->next;
q = q->next;
}
printf(“%d”, p->data);
}
}
What is the equivalent behaviour of foo()? (Assume head is pointer points to
start node of the linked list)
​(Data structures 1 Mark)
a. print n​th​ node element from the beginning of given linked list
b. print n​th​ node from the end in a given linked list
c. print middle element in the given linked list
d. None of these
Solution:
It doesn’t print if it is greater than the no. of nodes in list
Otherwise it will print nth node from the end in a given linked list
Given two pointers – reference pointer (q) and main pointer (p). Initialize
both reference(q) and main pointers(p) to head. First move reference
pointer(q) to n nodes from head. Now move both pointers one by one until
reference pointer(q) reaches end. Now main pointer(p) will point to nth node
from the end..

30. Assume we want to sort an array of integers. In which scenario is the use of
counting sort the most sensible? ​(Algorithms 1 Mark)
a. An array of integers that is sorted except for a certain number of
randomly located anomalies.
b. An array of integers that is completely random.
c. Integers that are sorted except for certain randomly pairs of adjacent
elements that have been swapped.
d. An array of randomly arranged integers that are each within a
specific range.
Solution:
Let us say that we are sorting n elements where each integer is between 0
and p
Employing counting sort would involve: initializing an array
(with a size of p ), iterating through the n integers while incrementing the
numbers in the array. The recovery of the sorted list would require iterating
through p buckets and outputting n numbers.This is a total of O(2n + 2p) =
O(n) time.

31.What is the output of the following C - program ​(C - Program 1 Mark)


#include <stdio.h>
void fun1(int *p)
{
p++;
}
void fun2(int **p)
{
(*p)++;
}

int main()
{
int a[5] = {1, 2, 3, 4, 5};
int *p = a;
printf("%d\t", *p);
fun1(p);
printf("%d\t", *p);
fun2(&p);
printf("%d\t", *p);
return 0;
}
a. 1 2 3
b. 1 1 2
c. 1 2 2
d. 1 1 3
32. What is the output of the following C -Program ​(C-program 2 Mark)
int main()
{
int a=4, b=8, c=3, d=9, z;
z = a++ + ++b * c-- - --d;
printf(“%d%d%d%d%d”, a, b, c, d, z);
return 0;
}
a. 4, 8, 3, 9, 19
b. 5, 9, 2, 8, 23
c. 5, 9, 3, 9, 19
d. 4, 9, 2, 9, 23
33. How many essential and non-essential prime implicants are there in the
given K-map respectively?​(Digital 1 Mark)
a. 3, 0
b. 4, 0
c. 1, 2
d. None
Solution:

4 essential prime implicants


No non-essential prime implicants
34. In a 8-bit parallel binary adder, the time taken to produce the sum and carry
outputs of full adder are 32 ns and 24 ns. What are the maximum number of
additions per second that it can perform? ​(Digital 2 Marks)
a. 1*10​6
b. 8*10​6
c. 5*10​6
d. 4*10​8
Solution:
Given t​s​ = 32 ns, t​c​ =24 ns, N = 8 bit parallel adder
Time for addition = (N-1)t​c​ + max(t​s​ , t​c​)
= (8-1)24ns + max(32, 24)
= 7*24 + 32
= 200 ns
Time taken for 1 addition is = 2*10​-7​ sec
Number of additions it can do in 1 sec =
1/(time for one addition)
= 5*10​6​ additions/sec

35. Consider the following circuit :

Which of the below state transition is not possible with the above circuit?
(Digital 2 Marks)
a. 1 → 3
b. 0 → 3
c. 1 → 2
d. 2 → 2
Solution:
Q​1n​ = Q​0​ ⊕ Q​1
Q​0n, ​ = Q​0​ ⊙ Q1

Q​1 Q​0
0 0
0 1
1 0
1 1

Q​1n Q​0n
0 1
1 0
1 0
0 1

There is no ​0 → 3 transition and 1→ 3 transition


Note: Yes option a and b are correct. Hence we are awarding marks to
all the participants.
36. Floating point numbers are represented in the way given below.

S E M
1 6 9

With explicit normalization.


What is the smallest distance between any two successive representable
numbers? ​(Computer organization 1 Mark)
a. 2​-9
b. 2​-15
c. 2​-32
d. 2​-41
Solution:
Exponent = 6 bits
Bias = 2​6-1​ = 32
=> (-1)​s​ * (0.M)​2​ * 2​e-32
=> The smallest distance exist between the 1st and 2nd smallest numbers
=> 1st smallest number = (-1)​1 ​* (0.100000000)​2​ * 2​0-32
= (0.1)​2​ *2​-32
=> 2nd smallest number = (-1)​1​ *(0.100000001)​2​ * 2​-32
=> 2nd smallest number - 1st smallest number = [0.100000001 -
0.100000000]​2
= 2​-9​ * 2​-32​ = 2​-41
37.A human resource department maintains information about employees in
the following table:
Employee(eid, name, dept, manager, gender)
-- manager is a foreign key to Employee, may be null
Consider the following sets of SQL queries Q1, Q2, and Q3. For
each set, indicate which queries are equivalent and which not.
Q1. select dept
from Employee
where gender = ’F’
group by dept
having count(*) < 5
Q2. select distinct x.dept
from Employee x
where (select count(*)
from Employee y
where x.dept = y.dept AND
y.gender=’F’) < 5
Q3. select distinct x.dept
from Employee x
where x.gender = ‘F’ AND
(select count(*)
from Employee y
where x.dept = y.dept AND y.gender=’F’) < 5
a. Q1=Q2=Q3
b. Q1=Q3 =/ Q2
c. Q1 ≠ Q2 ≠ Q3 ≠ Q1
d. Q1 = Q2 =/ Q3

Solution:
Example:
Employee table:

eid name dept gender


1 a A1 F
2 b A2 F
3 c A3 M
4 d A1 F
5 e A1 M
6 f A2 F
7 g A2 M
8 h A3 M
9 i A1 F
10 j A1 M
11 k A1 F

Query 1 Result:

dept
A1
A2
Query 2 Result:

dept
A1
A2
A3

Query 3 Result:

dept
A1
A2
Option B is correct

38. Consider the following relational schema R(A, B, C, D, E, F, G, H) and set


of functional dependencies. How many number of tables possible if we
decompose R into BCNF. ​(DBMS - 2 Marks)
A → BG,
C → D, and
EF → CH.

a. 3
b. 4
c. 5
d. None of these
Solution:
Try A+ = BG. Decompose into R1(A,B,G) and R2(A,C,D,E,F,H).
Decompose R2(A,C,D,E,F,H). Try C+ = D. Decompose into R3(C,D) and
R4(A, C, E, F, H).
Decompose R4(A, C, E, F, H). Try EF+ = CH. Decompose into
R5(E,F,C,H) and R6 (A, E, F).
End result: R1(A,B,G) (key=A), R3(C,D) (key=C), R5(E,F,C,H) (key=EF),
and R6 (A, E, F) (key = AEF).

39. Consider the following ER- Diagram

Find the primary keys for the tables A,C , S? ​(DBMS 2 Marks)
a. A: ​a
C: ​a
S: ​a
b. A: ​a, c
C: ​a
S: ​a, g
c. A: ​a, c
C: ​a, c
S: ​a, c, g
d. None of these
Solution:
Entity A is weak and dependent on B. Hence, the key of A needs to include
the key of B. C is a refinement of A and, hence, needs to include the key of
A.

40. Which of the following schedule is/are Conflict serializable? ​(DBMS - 1


Mark)
Schedule 1: R2(A) R1(C) R2(B) W2(B) R3(B) R1(A) R3(C) W3(C) W1(A)
Schedule 2: R2(A) R1(C) R2(B) R3(B) W2(B) R1(A) R3(C) W3(C) W1(A)

a. Schedule 1 Only
b. Schedule 2 Only
c. Both Schedule 1 and Schedule 2
d. Neither Schedule 1 nor Schedule 2
Solution:
Schedule 1 is conflict-serializable because the precedence graph has no
cycles. There is an arrow T2→ T1 because of the conflict R2(A) ...W1(A).
There is an arrow T2 → T3 because of the conflict W2(B) ...R3(B). There is
an arrow T1 → T3 because of the conflict R1(C) ...W3(C).
The only possible conflict-equivalent serial schedule is (T2, T1, T3)

Schedule 2 is not conflict-serializable because the precedence graph has a


cycle. There is an arrow T2 → T1 because of the conflict R2(A) ...W1(A).
There is an arrow T3 → T2 because of the conflict R3(B) ...W2(B). There is
an arrow T1 → T3 because of the conflict R1(C) ...W3(C).
41. Which of the following statements is/are True? ​(DBMS - 1 mark)
I. Secondary index is dense index
II. Secondary index is created on an attribute such that table is sorted
based on it
a. I only
b. II only
c. Both I and II
d. Neither I nor II
Solution:
I True: Secondary index is dense index since for every data record, we
maintain one index record. So, it is dense index. So, S2 is correct.
II False: Secondary index is based on key/non-key unordered field. So, S1 is
wrong.

42.Suppose ​the Operating System (OS) manages the physical memory of the
RAM, and has an area reserved for processes. The OS needs to find 64
physical pages in this area. These pages will be used for the
virtual-to-physical mapping in the page table. How would the OS find these
pages?​ ​(Operating System 1 Mark)
a. It will try to find 64 continuous unused pages
b. It will try to find 64 pages in monotonically increasing order
c. It will try to find 64 unused pages from anywhere in any order
d. None of these
Solution:
The physical pages may not be in use for other purposes but the location of
the physical pages doesn’t matter. Therefore, the OS will find unused pages
from anywhere.

43. Consider the following waits-for graph. ​(Operating System 1 - Mark)

Which of the following processes is/are possible to fall in deadlock


a. P1
b. P2
c. P1, P2
d. P1, P2, P3
Solution:
If R4 is allocated to P1, there can be the following possible case
In the above ​mentioned case P1 and P2 are in the deadlock and P3 is waiting
for the R1, which is held by P2. So, all processes are possible to fall in deadlock.

44. ​Consider the following set of processes and their burst times
Process Burst Time

P1 6

P2 8

P3 7

P4 3

What is the expected burst time of process P5 if SJF (Non-Preemptive) with


T1=12, α = 0.5 ​ (Operating system 2 Marks)
A. 6.75
B. 6.875
C. 7.437
D. None
Explanation :
Initially T1 = 12 and α = 0.5 and the run times given are 6,8,7,3as it is
shortest job first,(Non-Preemptive)
So the possible order in which these processes would serve will be
3,6,7,8(P4→ P1→ P3→ P2) So, using formula: T2 = α*t1 + (1-α)T1
so we have,
T2 = 0.5*3 + 0.5*12 = 1.5+ 6 = 7.5
T3 = 0.5*6 + 0.5*7.5 = 3+3.75 =6.75
T4 = 0.5*7 + 0.5*6.75 = 3.5+3.375= 6.875
T5 = 0.5*8 + 0.5*6.875=4+3.4375 = 7.4375
45. Consider the following 2-D array
int a [16][16];
Suppose that a system can accommodate 4 pages in main memory and each
page is 1024 bytes long and each element size is 4 bytes. Suppose an array a,
is stored in RMO (row major order). Which of the following two code
fragments will generate the less number of page faults.
Fragment 1:
for (int j=0; j<16; j++)
for (int i=0; i<16; i++)
a[i] [j]++;
Fragment 2:
for (int i=0; i<16; i++)
for (int j=0; j<16; j++)
a[i] [j]++;

a. Fragment 1
b. Fragment 2
c. Both are same
d. None
Solution:
Number of elements can accommodate in each page =1024 byte/4byte = 256
Fragment 1: Number of page faults = 1
Fragment 2: Number of page faults = 1

46. A unix file system has 2 KB blocks and 4 byte disk addresses. Each inode
contains 10-direct entries, one singly indirect entry and one doubly indirect
entry. Suppose half of all files are exactly 1.5 KB and the other half of all
files are exactly 2 KB. What fraction of disk space would be wasted?
(Consider only blocks used to store data)​(Operating systems 2 Marks)
a. 25%
b. 12.5%
c. 6.25%
d. None

Solution:
Both 1.5 KB and 2 KB file will use 2KB space. For each 2 KB file, 0KB
is wasted, for each 1.5 KB file, 0.5KB is wasted. Therefore, the fraction
wasted is (0/2)*50% + (0.5/2)*50% = 12.5%

47.Minimum number of states in a Deterministic finite automata that does not


contain a substring 11 and does not ends with 1 over the input alphabet
Σ ={0,1}
(TOC-2M)
A. 3
B. 4
C. 5
D. 6
Explanation:

DFA accepts the all the strings of 0’s and 1’s , does not contain 11 as
substring and does not ends with 1

48. Consider the following Push down automata (TOC-2M)


Here {a,b}are the input symbols and {a,b,z} are the stack symbols.
The language accepted by given PDA is
A. L={a​n​b​m​| m ≥ 0 , n ≥ 0, and n=m}
B. L={a​n​b​2m​| m ≥ 0 , n ≥ 0, and n=m}
C. L={a​n​b​2m​| ​m ≥ 1, n ≥ 1, and n=m​}
D. None of these
Explanation:
49. Which of the following is False (TOC-1M)
I. Regular languages are closed under inverse homomorphism
II. Recursive languages are closed under homomorphism
III. CSLs are closed under complementation
IV. Recursive enumerable languages are closed under set difference
A. I,II,III and IV
B. III and IV only
C. II and III only
D. II and IV only
Explanation:
Regular languages are closed under inverse homomorphism – True
Recursive languages are closed under homomorphism- False
CSLs are closed under complementation – True
Recursive enumerable languages are closed under set difference – False

50. Consider the following Epsilon( ε )-NFA(TOC-1M)

Which of the following is False?


A. ε -closure(0) ={0, 2, 3, 4}
B. ε -closure(1) = {0,1}
C. ε -closure(2) = {2,3,4}
D. ε -closure(4) = {4}
Explanation:
ε -closure (0) = {0, 2, 3, 4} True
ε -closure (1) = {0, 1, 2, 3, 4} False
ε -closure (2) = {2, 3, 4} True
ε -closure (4) = {4} True

51. Which of the following problems will comes under


Class-NP-Complete(TOC-1M)
I. Travelling salesman problem
II. Subgraph isomorphism
III. 3-SAT Problem
IV. Halting Problem
A. I,II,III and IV
B. I,II and III only
C. II and IV only
D. I and III only
Explanation:
Travelling salesman problem NP-Complete
Subgraph isomorphism NP-Complete
3-SAT Problem- NP-Complete
Halting Problem – NP-Hard

52. Consider the following translation schema(CD-2Marks)


E→ TR
R→ +TMR | *TNR | ε
T→ num {print(num.val)}
M→ ε {print(‘+’)}
N→ ε {print (‘*’)}
Here num is a token that represents an integer and num.val represents the
corresponding integer value. For an input string “1+2*3”, this translation
scheme will print
A. ​1+2*3
B. ​123+*
C. ​12+3*
D. ​1+23*
Explanation:
53.Consider the following grammar
E→ EsubR | EsupE | {E} | c
R→ EsupE | E
After eliminating the Left Recursion the resultant grammar is(CD-1 Mark)
A. E→ {E}E’ | cE’
E’ → subRE’ | supEE’
R→ EsupE | E

B. E→ {E}E’ | cE’ | ε
E’ → subRE’ | supEE’ | ε
R→ EsupE | E
C. E→ {E}E’ | cE’
E’ →subRE’ | supEE’ | ε
R→ EsupE | E
D. E→ {E}E’ | cE’
E’ → subRE’ | supEE’ | ε
R→ EsupE | ε
Explanation:
Left Recursion: If the production is of the form A→ Aα | β, then the
grammar contains left recursion.
Eliminate left recursion by using the formula
A→ βA’
A’ → αA’ | ε
Given grammar is
E→ EsubR | EsupE | {E} | c
R→ EsupE | E
Eliminating left recursion
E→ {E}E’ | cE’
E’ → subRE’ | supEE’ | ε
R→ EsupE | E

54.The number of Tokens of the following C program is________ (CD- 1


mark)

Explanation:
void, main, (, ),{ ,char, s, [, ], =, “”, ;, printf, (, “”, ‘,’ , s, ), ;, }
Total number of tokens is 20

55.The language generated by the given Grammar is (TOC-2M)


Note: n​a​(w) and n​b​(w) means Number of a’s in a string and number of b’s in
a string
A. L={w | n​a​(w) are even and n​b​(w) are odd}
B. L={w | n​a​(w) are even or n​b​(w) are even}
C. L={w | n​a​(w) and n​b​(w) are both are odd}
D. L={w | n​a​(w) and n​b​(w) are both are even}
Explanation:
The Equivalent Finite Automata for the given Grammar is

The language accepted by the given DFA is every string contains even
number of a’s and even number of b’s.

Vous aimerez peut-être aussi