Download as pdf or txt
Download as pdf or txt
You are on page 1of 68

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.

Follow on Unacademy : https://unacademy.com/@ravula​​

Section: General Aptitude

1. Consider the following sentences:

(i) Everybody in the class is prepared for the exam.


(ii) Babu invited Danish to his home because he enjoys playing chess.

Which of the following is the CORRECT observation about the above two sentences?

1. (i) is grammatically incorrect and (ii) is ambiguous


2. (i) is grammatically correct and (ii) is ambiguous
3. (i) is grammatically correct and (ii) is unambiguous
4. (i) is grammatically incorrect and (ii) is unambiguous

Ans: Option 2

Explanation:

i) Everybody in the class is prepared for the exam

This is grammatically correct statement

ii). Babu invited Danish to his home because he enjoys playing chess.

This statement is ambiguous as there is no guarantee that Danish knows playing chess.

2.

Items Cost Profit % Marked Price


(₹) (₹)

P 5,400 --- 5,860

Q --- 25 10,000

Details of prices of two items P and Q are presented in the above table. The ratio of cost of item
P to cost of item Q is 3:4. Discount is calculated as the difference between the marked price and

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

1
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
the selling price. The profit percentage is calculated as the ratio of the difference between selling
(
price and cost, to the cost 𝑃𝑟𝑜𝑓𝑖𝑡 % =
𝑆𝑒𝑙𝑙𝑖𝑛𝑔 𝑝𝑟𝑖𝑐𝑒−𝐶𝑜𝑠𝑡
𝐶𝑜𝑠𝑡 )
× 100 .

The discount on item Q, as a percentage of its marked price, is ______.

1. 25
2. 5
3. 10
4. 12.5

Answer : 3

Explanation:

Given that

Items Cost Profit M.P

P 5400 -- 5860

Q 7200 25 10,000

𝐶𝑜𝑠𝑡 𝑜𝑓 𝑖𝑡𝑒𝑚 𝑃 3 5400 3


𝐶𝑜𝑠𝑡 𝑜𝑓 𝑖𝑡𝑒𝑚 𝑄
= 4
⇒ 𝐶𝑜𝑠𝑡 𝑜𝑓 𝑖𝑡𝑒𝑚 𝑄
= 4

⇒ 𝐶𝑜𝑠𝑡 𝑜𝑓 𝑖𝑡𝑒𝑚 𝑄 = 7200


𝑆.𝑃−𝐶.𝑃
⇒ 𝑄(𝑃𝑟𝑜𝑓𝑖𝑡%) = 7200
× 100

𝑆𝑃−7200
⇒ 25 = 7200
× 100

𝑆𝑃 = 9000

⇒Marked price is 10000 and the selling price is 9000. Then percentage of discount given
10000−9000
= 10000
× 100

1000
= 10000
× 100

= 10%

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

2
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

3. The ratio of boys to girls in a class is 7 to 3.

Among the options below, an acceptable value for the total number of students in the class is:

1. 37
2. 73
3. 21
4. 50

Answer : 4

Explanation :

The Ratio of boys to girls is 7:3

Number of boys = 7x

Number of girls = 3x

Total number of students = 10x

So the possible value should multiple by 10.

Answer is 50.

4. A polygon is convex if, for every pair of points, P and Q belonging to the polygon, the line
segment PQ lies completely inside or on the polygon.

Which one of the following is NOT a convex polygon?

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

3
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

Answer : 1

Explanation :


The angle Ө is more than 180 , so it is not a convex polygon.

5.

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

4
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

A circular sheet of paper is folded along the lines in the directions shown. The paper, after being
punched in the final folded state as shown and unfolded in the reverse order of folding, will look
like _______.

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

5
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
Answer : 2

Explanation :

6. We have 2 rectangular sheets of paper, M and N, of dimensions 6 cm × 1 cm each. Sheet M is


rolled to form an open cylinder by bringing the short edges of the sheet together. Sheet N is cut
into equal square patches and assembled to form the largest possible closed cube. Assuming the
ends of the cylinder are closed, the ratio of the volume of the cylinder to that of the cube is
______.

1. 3π
π
2. 2
3
3. π
9
4. π

Answer : 4

Explanation :

Rectangle N cut into 6 pieces each of size = 1𝑐𝑚 × 1𝑐𝑚

Size of cube = 1 cm
3
Volume of cube = 1 = 1

⇒ Rectangle M will be

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

6
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

Length of rectangle = circumference of cylinder


6 3
6 = 2π𝑟 ⇒ 𝑟 = 2π
= π

3 2
2
Volume of cylinder = π𝑟 ℎ = π ( ) (1) =
π
9
π

Ratio of volume of cylinder to volume of cube = ( 9


π )
/1 =
9
π

7. ______ is to surgery as writer is to ______

Which one of the following options maintains a similar logical relation in the above sentence?

1. Hospital, library
2. Medicine, grammar
3. Plan, outline
4. Doctor, book

Ans: Option 4

Explanation:

The given statement is to fill the relationship of the subject and the action done by the subject.

Doctor is to surgery as writer is to book.

8. There are five bags each containing identical sets of ten distinct chocolates. One chocolate is
picked from each bag.

The probability that at least two chocolates are identical is _____

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

7
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
1. 0.81225
2. 0.4235
3. 0.6976
4. 0.3024

Answer : 3

Explanation :

There are 5 bags having identical sets of 10 distinct chocolates. one chocolate is drawn from
each bag, probability to find at least 2 chocolate is identical

The total number of such selections possible = 10*10*10*10*10 = 10^5.


We need to select such that at least two of them are identical.
We can count the number of ways with no chocolate being repeated and subtract it from total
possible ways to get the required probability.

The number of ways to select all different/distinct = 10*9*8*7*6


Required number of selections= 10^5-10*9*8*7*6 = 69760
Required probability = 69760/10^5 = 0.69760

9. Some people suggest anti-obesity measures (AOM) such as displaying calorie information in
restaurant menus. Such measures sidestep addressing the core problems that cause obesity:
poverty and income inequality.

Which one of the following statements summarizes the passage?

1. AOM are addressing the problem superficially.


2. The proposed AOM addresses the core problems that cause obesity.
3. AOM are addressing the core problems and are likely to succeed.
4. If obesity reduces, poverty will naturally reduce, since obesity causes poverty.

Ans: Option 1

Explanation:

The problems mentioned are poverty and income inequality. But AOMs are not addressing the
main problems directly. But it is a kind of generic step taken to address obesity. So AOMs are
only addressing the obesity problem superficially but not addressing the real problems.

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

8
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
10. Given below are two statements 1 and 2, and two conclusions I and II.

Statement I: All bacteria are microorganisms.

Statement II: All pathogens are microorganisms.

Conclusion I: Some pathogens are bacteria.

Conclusion II: All pathogens are not bacteria.

Based on the above statements and conclusions, which one of the following options is logically
CORRECT?

1. Only conclusion I is correct


2. Only conclusion II is correct
3. Neither conclusion I nor II is correct
4. Either conclusion I or II is correct

Answer : 4

Explanation :

Either Conclusion I (or) II is correct.

Section : CS Computer Science & Information Technology

11. Consider the following ANSI C function:

int SimpleFunction (int Y[], int n, int x)


{
int total = Y[0], loopIndex;
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

9
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
for (loopIndex = 1; loopIndex <= n - 1; loopIndex++)
total = x * total + Y[loopIndex]
return total;
}

Let Z be an array of 10 elements with Z[i]=1, for all i such that 0 ≤ i ≤ 9. The value returned by
SimpleFunction(Z, 10, 2) is _______

Answer: 1023

Explanation:

Array Z consists of 10 elements and that element's values are 1.

n=10,x=2

Initial total value is 1 => total=1.

For loop will execute 9 times.

loopindex=1, 1<=9 condition is true then

total = x * total + Y[loopIndex]= 2*1+Y[1]=2+1=3


loopindex=2, 2<=9 condition is true then

total=2*3+Y[2]=6+1=7

loopindex=3, 3<=9 condition is true then

total=2*7+Y[3]=14+1 =15

loopindex=4, 4<=9 condition is true then

total= 2*15+Y[4]=30+1=31

loopindex=5, 5<=9 condition is true then

total=2*31+Y[5]=62+1=63

loopindex=6, 6<=9 condition is true then

total=2*63+Y[6]=126+1=127

loopindex=7, 7<=9 condition is true then

Total =2*127+Y[7]=254+1=255

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

10
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
loopindex=8, 8<=9 condition is true then

total=2*255+Y[8]=510+1=511

loopindex=9, 9<=9 condition is true then

total=2*511+Y[9]=1022+1=1023

loopindex=10, 10<=9 condition is false then

Total value is returned which is 1023.

You can also write generalized formulae 210-1=1023

12. The following relation records the age of 500 employees of a company, where empNo
(indicating the employee number) is the key:

empAge (empNo, age)

Consider the following relational algebra expression:

∏𝑒𝑚𝑝𝑁𝑜(𝑒𝑚𝑝𝐴𝑔𝑒 ⋈ ρ𝑒𝑚𝑝𝑁𝑜1,𝑎𝑔𝑒1(𝑒𝑚𝑝𝐴𝑔𝑒))
(𝑎𝑔𝑒>𝑎𝑔𝑒1)

What does the above expression generate?

1. Employee numbers of all employees whose age is not the minimum.


2. Employee numbers of only those employees whose age is the maximum.
3. Employee numbers of all employees whose age is the minimum.
4. Employee numbers of only those employees whose age is more than the age of exactly
one other employee.

Answer : 3

Explanation :

The given relational algebra expression will result in employees whose age is not minimum. The
given conditional join, joins the relations if the age is greater than any of the ages mentioned in
the database.

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

11
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
13. A TCP server application is programmed to listen on port number P on host S. A TCP client
is connected to the TCP server over the network.

Consider that while the TCP connection was active, the server machine S crashed and rebooted.
Assume that the client does not use the TCP keepalive timer.

Which of the following behaviours is/are possible?

1. If the client was waiting to receive a packet, it may wait indefinitely.


2. If the client sends a packet after the server reboot, it will receive a RST segment.
3. The TCP server application on S can listen on P after reboot.
4. If the client sends a packet after the server reboot, it will receive a FIN segment.

Answer : 1,2,3

Explanation:

1) True
Since broken connections can only be detected by sending data, the receiving side will
wait forever. This scenario is called a “half-open connection” because one side realizes
the connection was lost but the other side believes it is still active.
2) True
The situation resolves itself when client tries to send data to server over the dead
connection, and server replies with an RST packet (not FIN).
3) True
Yes, a TCP Server can listen to the same port number even after reboot.  For example, the
SMTP service application usually listens on TCP port 25 for incoming requests. So, even
after reboot the port 25 is assigned to SMTP.
4) False
The situation resolves itself when client tries to send data to server over the dead
connection, and server replies with an RST packet (not FIN), causing client to finally to
close the connection forcibly.
FIN is used to close TCP connections gracefully in each direction (normal close of
connection), while TCP RST is used in a scenario where TCP connections cannot recover
from errors and the connection needs to reset forcibly.

14. Consider the following C code segment:

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

12
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
a = b + c;
e = a + 1;
d = b + c;
f = d + 1;
g = e + f;

In a compiler, this code segment is represented internally as a directed acyclic graph (DAG). The
number of nodes in the DAG is _______

Answer : 6

15. Consider the following expression.

2𝑥+22−4
lim 𝑥+3
𝑥 → −3

The value of the above expression (rounded to 2 decimal places) is _______

Answer : 0.25
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

13
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
Explanation:

2𝑥+22−4
lim 𝑥+3
𝑥 → −3

0
It’s in 0
form, apply L-hospital rule i.e., differentiate numerator, denominator

1 −1/2
2
(2𝑥+22) ×2
lim 1
𝑥 → −3

Substitute -3
1 −1/2
2
(− 6 + 22) ×2

1 1 1 1
2
× × 2 = 8
×2 = 4
16

16. Consider a dynamic hashing approach for 4-bit integer keys:

1. There is a main hash table of size 4.


2. The 2 least significant bits of a key is used to index into the main hash table.
3. Initially, the main hash table entries are empty.
4. Thereafter, when more keys are hashed into it, to resolve collisions, the set of all keys
corresponding to a main hash table entry is organized as a binary tree that grows on
demand.
5. First, the 3rd least significant bit is used to divide the keys into left and right subtrees.
6. To resolve more collisions, each node of the binary tree is further sub-divided into left
and right subtrees based on the 4th least significant bit.
7. A split is done only if it is needed, i.e., only when there is a collison.

Consider the following state of the hash table.

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

14
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
Which of the following sequences of key insertions can cause the above state of the hash
table (assume the keys are in decimal notation)?

1. 10, 9, 6, 7, 5, 13
2. 9, 5, 13, 6, 10, 14
3. 9, 5, 10, 6, 7, 1
4. 5, 9, 4, 13, 10, 7

Answer : 1

Explanation :

The key insertions 10, 9, 6, 7, 5, 13 would result in the state of the given hash table.

Number 10 9 6 7 5 13

Binary code 1010 1001 110 111 0101 1101

The keys are inserted into the main hash table based on their 2 least significant bits.

→ The keys 5, 9, 13 will be inserted in the table with entry “01”.

→ The keys 6 and 10 will be inserted in the table with entry “10”

→ The keys 7 will be inserted in the table with entry “11”

Empty 9 5 13 10 6 7

10 01 01 01 11 01 10 10 01 10 01 11

00 01 10 11

→ Now the entry index 01 has collisions. Check the 3rd least significant bit of the keys 9,5,13. The 3rd
least significant bit of the key is 0. Hence, key “9” placed as the left child of “01”. There will be collisions
again in between the keys 5 and 13 which need to splitted.

Now check the 4th least significant bit of keys 5 and 13. The key 5 is placed as a left child because the 4th
least significant is “0” and the key “13” is placed as right child because its 4th least significant is 1.

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

15
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
→ Now the entry index 10 has a collision. Check the 3rd least significant bit of the keys 10 and 6. The 3rd
last significant bit of the key is 0. Hence, “10” is placed as the left child of index “10”.

The 3rd least significant value of “6” is 1. So, we are placed as the right child of index ”10”.

17. Let p and q be two propositions. Consider the following two formulae in propositional logic.

𝑆1: (¬𝑝 ∧ (𝑝 ∨ 𝑞) → 𝑞)
𝑆2: 𝑞 → (¬𝑝 ∧ (𝑝 ∨ 𝑞))

Which one of the following choices is correct?

1. Both 𝑆1and 𝑆2 are tautologies.


2. Neither 𝑆1and 𝑆2 are tautology.
3. 𝑆1is not a tautology but 𝑆2is a tautology.
4. 𝑆1is a tautology but 𝑆2is not a tautology.

Answer : 4

Explanation :

A tautology is a formula which is "always true" . That is, it is true for every assignment
of truth values to its simple components.

Method 1:
S1: (~p ^ (p Vq)) →q
The implication is false only for T->F condition.
Let's consider q as false, then
(~p ^ (p Vq)) will be (~p ^ (p VF)) = (~p ^ (p)) =F.
It is always F->F which is true for implication. So there are no cases that return
false, thus its always True i.e. its Tautology.

S2:
q->(~p ∧ (p Vq))

The false case for implication occurs at T->F case.


Let q=T then (~p ∧ (p Vq)) = (~p ∧ (p VT))= ~p. (It can be false for p=T).
So there is a case which yields T->F = F. Thus its not Valid or Not a Tautology.

Method 2:
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

16
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
𝑆1: (¬𝑝 ∧ (𝑝 ∨ 𝑞) → 𝑞)
𝑆2: 𝑞 → (¬𝑝 ∧ (𝑝 ∨ 𝑞))

𝑝 𝑞 ¬𝑝 𝑝∨𝑞 ¬𝑝 ∧ (𝑝 ∨ 𝑞) ¬𝑝 ∧ (𝑝 ∨ 𝑞) → 𝑞

T T F T F T
T F F T F T
F T T T T T
F F T F F T
𝑆1: Valid ✓

𝑝 𝑞 ¬𝑝 𝑝∨𝑞 ¬𝑝 ∧ (𝑝 ∨ 𝑞) 𝑞 →(¬𝑝 ∧ (𝑝 ∨ 𝑞))

T T F T F F
T F F T F T
F T T T T T
F F T F F T
𝑆2:Not Valid since there is one False

18. Consider the following sequence of operations on an empty stack.

push(54); push(52); pop(); push(55); push(62); s=pop();

Consider the following sequence of operations on an empty queue.

enqueue(21); enqueue(24); dequeue(); enqueue(28); enqueue(32); q = dequeue();

The value of s + q is ________

Answer : 86

Explanation :

push(54) ⇒ 54
push(52)=> 54, 52(top)
pop() ⇒ 54 (top)
push(55)==> 54, 55(top)
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

17
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
push(62) ⇒ 54,55,62(top)
s=pop() ⇒ 62 will store into the variable s then s=62

enqueue(21) ⇒ (front) 21(rear)


enqueue(24) ⇒ (Front)21, 24(rear)
dequeue()==> (front) 24(rear)
enqueue(28) ===> (front) 24,28 (rear)
enqueue(32)====>(front) 24,28,32 (rear)
q=dequeue() ⇒ value 24 will store into the variable “q”
q=24

S+q =62+24 =86

19. Consider the following representation of a number in IEEE 754 single-precision floating
point format with a bias of 127.

S:1 E : 10000001 F : 11110000000000000000000

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

18
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
Here S, E and F denote the sign, exponent and fraction components of the floating point
representation.

The decimal value corresponding to the above representation (rounded to 2 decimal places) is
_______

Solution: -7.75

Explanation:

Sign bit S= 1. The given number is a negative number.

Biased Exponent E = 27 + 1= 129

Actual Exponent e = E-127

= 129- 127

=2

The decimal value= (-1)s x 1.M x 2e

= (-1) 1 x 1.1111 x 22

= - (111.11)

= - (7 + 0.75)

= -7.7

___________________________________________________

20. Let the representation of a number in base 3 be 210. What is the hexadecimal representation
of the number?

1. 21
2. 528
3. D2
4. 15

Solution: D

Explanation:

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

19
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
On converting (210)3 in decimal, we will get:=>

2*32+1*3=2*9+3=2110

=>(15)16

____________________________________________________________________

21. Let 𝑟𝑖(𝑧) and 𝑤𝑖(𝑧) denote read and write operations respectively on a data item z by a
transaction 𝑇𝑖. Consider the following two schedules.

𝑆1: 𝑟1(𝑥) 𝑟1(𝑦) 𝑟2(𝑥) 𝑟2(𝑦) 𝑤2(𝑦) 𝑤1(𝑥)

𝑆2: 𝑟1(𝑥) 𝑟2(𝑥) 𝑟2(𝑦) 𝑤2(𝑦) 𝑟1(𝑦) 𝑤1(𝑥)

Which one of the following options is correct?

1. 𝑆1is not conflict serializable, and 𝑆2 is conflict serializable.


2. Neither 𝑆1nor 𝑆2is conflict serializable.
3. Both 𝑆1and 𝑆2are conflict serializable.
4. 𝑆1is conflict serializable, and 𝑆2is not conflict serializable.

Answer: 1

Explanation:

S1:

The precedence graph is forming a cycle. Hence, S1 is not conflict serializable.


Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

20
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
S2:

There is no cycle in the precedence graph. Hence, S2 is conflict serializable.

22. A sender (S) transmits a signal, which can be one of the two kinds: H and L with
probabilities 0.1 and 0.9 respectively, to a receiver (R).

In the graph below, the weight of edge (u, v) is the probability of receiving v when u is
transmitted, where u, v ∈ {H, L}. For example, the probability that the received signal is L
given the transmitted signal was H, is 0.7.

If the received signal is H, the probability that the transmitted signal was H (rounded to 2
decimal places) is _______

Answer: 0.04
Solution:

Bayes theorem:
Probability of event A happening given that event B has already happened is
P(A/B) = P(B/A)*P(A) / P(B)

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

21
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
Here, it is asked that P( H transmitted / H received).

S can send signal to H with 0.1 probability, S can send signal to L with 0.9 probability.
The complete diagram can be

Probability that H Transmitted (H_t) given that H received (H_r)is

P( H_t / H_r) = P( H_r/ H_t) * P(H_t) / P(H_r)

P(H-r) = probability that H received = P( H received from H)+ P(H received from L)
It can be observed from the graph that H can receive in two ways (S to H to H) and (S to L to H)
The P(H_r) = 0.1*0.3 + 0.9*0.8= 0.03+0.72 = 0.75

P(H_received given that H_transmitted) =0.3


P(H transmitted ) = 0.1 i.e.

P( H_t / H_r) = P( H_r/ H_t) * P(H_t) / P(H_r)


= 0.3*0.1 / 0.75 = 0.04

23. In an undirected connected planar graph G, there are eight vertices and five faces. The
number of edges in G is ______

Answer : 11

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

22
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
Explanation :

v-e+f=2
v is number of vertices
e is number of edges
f is number of faces including bounded and unbounded
8-e+5=2
=> 13-2 =e
The number of edges are =11

24. Consider the following three functions.

𝑛 𝑙𝑜𝑔 𝑛 𝑛
𝑓1 = 10 𝑓2 = 𝑛 𝑓3 = 𝑛

Which one of the following options arranges the functions in the increasing order of asymptotic
growth rate?

1. 𝑓2, 𝑓3, 𝑓1
2. 𝑓3, 𝑓2, 𝑓1
3. 𝑓2, 𝑓1, 𝑓3
4. 𝑓1, 𝑓2, 𝑓3

Answer : 1

Explanation :

The asymptotic notation order should be

Constant < logarithmic < linear < polynomial < exponential < factorial

F2 and F3 → Polynomial

F1 → Exponential

By the order of asymptotic notations F1 is definitely larger.


Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

23
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

Method-1:

Consider n=100

F1 : 100 ^100 ⇒ 1.e+200

F2 : N^log(100) base 2 ⇒ 100 ^ log(100) base 2 ⇒ 100^6.6438561897747 =


1,93,96,00,91,15,564.181300016469223466

F3 : N^Sqrt(n) ====> 100^Sqrt(100) ⇒ 100^10 ⇒ 10,00,00,00,00,00,00,00,00,000

Method-2:

We can apply "log" on both sides.

log(F1)=nlog10 (base 2)

log(F2)=(logn)^2 = logn * logn (base 2)

log(F3)=sqrt(n)logn (base 2)

Answer: F2< F3< F1

( )
25. In a pushdown automaton 𝑃 = 𝑄, Σ, Γ, δ, 𝑞0, 𝐹 ,a transition of the form,

where 𝑝, 𝑞 ∈ 𝑄, 𝑎 ∈ Σ ∪ {ϵ}, and 𝑋, 𝑌 ∈ Γ ∪ {ϵ}, represents

(𝑞, 𝑌) ∈ δ(𝑝, 𝑎, 𝑋).

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

24
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
Consider the following pushdown automaton over the input alphabet Σ = {𝑎, 𝑏} and stack
alphabet Γ = {#, 𝐴}.

The number of strings of length 100 accepted by the above pushdown automaton is ______

Answer: 50

Explanation:
In PDA, first understand the meaning of the transitions
initially stack is empty
(𝛜,𝛜 | #) means without seeing (first 𝛜) any input and without seeing top of stack (second 𝛜) then
push # in stack.
(a,𝛜 | A) means push A in the stack for each “a” in the beginning. In this transition “𝛜” means
without seeing top of stack i.e, for any top of stack we must push A.

From q1 to q2
(𝛜,𝛜 | 𝛜) means without seeing (first 𝛜) any input and without seeing top of stack (second 𝛜) then
do nothing (third 𝛜) i.e., just switch state q1 to q2.
The (b, A | 𝛜) means for each “b” in input and A is top of stack pop A.

So the PDA accepts


L={an | n >0} U { an bm | n >m }

For 100 length strings we have 100 positions.


Let's assume a smaller example and we suppose 10 length strings.

String 1: a a a a a a a a a a (zero b)
String 2: a a a a a a a a a b (one b)
String 3: a a a a a a a a b b (two b’s)
String 4: a a a a a a a b b b (three b’s)
String 5: a a a a a a b b b b (four b’s)

So for 10 length strings we get 5 strings.


Hence for 100 length strings we will get 50 strings (Zero b, one b, two bs, three b’s,
…………………………………, 49 b’s) .

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

25
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

26. Consider the following statements.

𝑆1:Every SLR(1) grammar is unambiguous but there are certain unambiguous grammars that are
not SLR(1).

( 3)
𝑆2: For any context-free grammar, there is a parser that takes at most 𝑂 𝑛

Which one of the following options is correct?

1. 𝑆1is true and 𝑆2is true


2. 𝑆1is true and 𝑆2is false
3. 𝑆1is false and 𝑆2is true
4. 𝑆1is false and 𝑆2is false

Answer: A

Explanation:
Every unambiguous grammar need not be SLR(1). As we know some unambiguous grammar
which is CLR(1) but not SLR(1). So S1 is true.

Any CFG (which is in CNF form) can be parsed by CYK algorithm in O(n3) where n is length of
string. Although it is not given that CFG is in CNF form but since we can convert any CFG in
CNF form so S2 is true.

27. Consider the relation R(P, Q, S, T, X, Y, Z, W) with the following functional dependencies.

𝑃𝑄 → 𝑋; 𝑃 → 𝑌𝑋; 𝑄 → 𝑌; 𝑌 → 𝑍𝑊

Consider the decomposition of the relation R into the consistent relations according to the
following two decomposition schemes.

𝐷1: 𝑅 = [(𝑃, 𝑄, 𝑆, 𝑇); (𝑃, 𝑇, 𝑋); (𝑄, 𝑌); (𝑌, 𝑍, 𝑊)]

𝐷2: 𝑅 = [(𝑃, 𝑄, 𝑆); (𝑇, 𝑋); (𝑄, 𝑌); (𝑌, 𝑍, 𝑊)]

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

26
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
Which one of the following options is correct?

1. 𝐷1is a lossy decomposition, but 𝐷2is a lossless decomposition.


2. Both 𝐷1and 𝐷2are lossy decompositions.
3. Both 𝐷1and 𝐷2are lossless decompositions.
4. 𝐷1is a lossless decomposition, but 𝐷2is a lossy decomposition.

Answer : 4

Explanation :

Given functional dependencies set:


PQ->X
P->YX
Q->Y
Y->ZW
● While merging the tables there should be some common attribute(s) and it should be a
candidate key of one of the tables.

D1:

● R1 should be merged with R2 because PT is a key of R2.


● R3 should be merged with PQSTX because Q is a key of R3.
● R4 should be merged with PQSTXY because Y is a key of R4.

D2:

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

27
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

● R1 should be merged with R3 because Q is a key of R3.


● R4 should be merged with PQSY because Y is a key of R4.
● Now, there is no common attribute in between R2(TX) and PQSYZW.
● Hence, D2 is lossy decomposition.

28. Consider the two statements.

𝑆1: There exist random variables X and Y such that


2
(𝐸[(𝑋 − 𝐸(𝑋))(𝑌 − 𝐸(𝑌))]) > 𝑉𝑎𝑟[𝑋] 𝑉𝑎𝑟[𝑌]

𝑆2: For all random variables X and Y,


𝐶𝑜𝑣[𝑋, 𝑌] = 𝐸[|𝑋 − 𝐸[𝑋]| |𝑌 − 𝐸[𝑌]|]

Which one of the following choices is correct?

1. 𝑆1is false, but 𝑆2is true.


2. Both 𝑆1and 𝑆2are true.
3. 𝑆1is true, but 𝑆2is false.
4. Both 𝑆1and 𝑆2 are false.

Answer: D

Solution:
Variance(X) = Var[X]= E((X-E(X))^2)

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

28
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
For a dataset with single values, we have variance 0.
2
(𝐸[(𝑋 − 𝐸(𝑋))(𝑌 − 𝐸(𝑌))]) > 𝑉𝑎𝑟[𝑋] 𝑉𝑎𝑟[𝑌]
This leads to inequance of 0>0 which is incorrect.

Its not |x-E(x)|. Thus S2 is also incorrect.

29. Define 𝑅𝑛to be the maximum amount earned by cutting a rod of length n metres into one or
more pieces of integer length and selling them. For i > 0, let p[i] denote the selling price of a rod
whose length is i meters. Consider the array of prices:

p[1] = 1, p[2] = 5, p[3] = 8, p[4] = 9, p[5] = 10, p[6] = 17, p[7] = 18

Which of the following statements is/are correct about 𝑅7?

1. 𝑅7is achieved by three different solutions.


2. 𝑅7 = 18
3. 𝑅7 = 19
4. 𝑅7cannot be achieved by a solution consisting of three pieces.

Solution: Option 1 and 2

Explanation:

The rod length of R7 is 18.

There are 3 different possible ways to get the maximum amount.

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

29
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
P[6] + P[1] → 17+1 = 18

P[2] + P[2] + P[3] → 5+5+8 = 18

P[7] → 18 = 18

___________________________________________________________________________

30. An articulation point in a connected graph is a vertex such that removing the vertex and its
incident edges disconnects the graph into two or more connected components.

Let T be a DFS tree obtained by doing DFS in a connected undirected graph G.

Which of the following options is/are correct?

1. Root of T can never be an articulation point in G.


2. If u is an articulation point in G such that x is an ancestor of u in T and y is a descendent
of u in T, then all paths from x to y in G must pass through u.
3. A leaf of T can be an articulation point in G.
4. Root of T is an articulation point in G if and only if it has 2 or more children.

Solution: 2 and 4

Explanation:

Statement-1: FALSE: Root of T can never be an articulation point in G.

Statement-2: TRUE: If u is an articulation point in G such that x is an ancestor of u in T and y is


a descendent of u in T, then all paths from x to y in G must pass through u.

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

30
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

Statement-3: FALSE: Leafs of a DFS-tree are never articulation points.

Statement-4: TRUE: The root of a DFS-tree is an articulation point if and only if it has at least
two children.

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

31
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

Node 2 is an AP because any node from the first subtree (1, 2) is connected to any node from the
second subtree (4, 5, 6, 7, 8) by a path that includes node 2. If node 2 is removed, the 2 subtrees
are disconnected.

_________________________________________________________________

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

32
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
31. In the context of operating systems, which of the following statements is/are correct with
respect to paging?

1. Page size has no impact on internal fragmentation.


2. Multilevel paging is necessary to support pages of different sizes.
3. Paging incurs memory overheads.
4. Paging helps solve the issue of external fragmentation.

Answer : 3,4

Explanation :

(1) False, Large page size may lead to higher internal fragmentation.
(2) False, To support pages of different sizes, the Instruction set architecture should support
it. Multi-level paging is not necessary.
(3) True, The page table has to be stored in main memory, which is an overhead.
(4) True, Paging avoids the external fragmentation.

32. Three processes arrive at time zero with CPU bursts of 16, 20 and 10 milliseconds. If the
scheduler has prior knowledge about the length of the CPU bursts, the minimum achievable
average waiting time for these three processes in a non-preemptive scheduler (rounded to nearest
integer) is _________ milliseconds.

Answer : 12

Explanation :

Minimum average waiting time amongst non-preemptive scheduling is given by SJF.


So, avg waiting time = (0+10+26)/3 = 12 ms.

33. Consider the following instruction sequence where registers R1, R2 and R3 are general
purpose and MEMORY[X] denotes the content at the memory location X.

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

33
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

Assume that the content of the memory location 5000 is 10, and the content of the register R3 is
3000. The content of each of the memory locations from 3000 to 3010 is 50. The instruction
sequence starts from the memory location 1000. All the numbers are in decimal format. Assume
that the memory is byte addressable.

After the execution of the program, the content of memory location 3010 is _______

Ans: 50

Explanation:

Register R1 will get value 10 from location 5000. So the loop in the given program will run for 10
times as the loop condition is based on ‘Dec R1’. When R1 is 0 then the loop terminates.

In these 10 iterations of the loop contents of memory locations 3000 to 3009 are changed as
initial value of R3 is 3000 and in each iteration we update M[R3] ← R2 and the value of R3 is
incremented to the next location 3001, 3002 etc.

But the value in location 3010 is unchanged and it will be the same as the initial value which is
50.

34. Consider the sliding window flow-control protocol operating between a sender and a receiver
over a full-duplex error-free link. Assume the following:

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

34
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
● The time taken for processing the data frame by the receiver is negligible.
● The time taken for processing the acknowledgement frame by the sender is negligible.
● The sender has an infinite number of frames available for transmission.
● The size of the data frame is 2,000 bits and the size of the acknowledgment frame is 10
bits.
6
● The link data rate in each direction is 1 Mbps (=10 bits per second).
● One way propagation delay of the link is 100 milliseconds.

The minimum value of the sender’s window size in terms of the number of frames, (rounded to
the nearest integer) needed to achieve a link utilization of 50% is ______.

Answer : 51

Explanation :

Tt(packet) = L / B.W => 2000 bits / 10^6 bps = 2  x 10^-3 sec = 2 millisec

Tt(Ack) = L / B.W. => 10 bits / 10^6 bps = 10^-5 sec = 10^-2 millisec = 0.01 millisec

Tp = 100 millisec

Total time = Tt(packet) + 2 x Tp + Tt(Ack)


=> 2 + 2 x 100 + 0.01 = 202.01 millisec

Efficiency = 50 % = ½

Efficiency = Useful Time /  Total time

½ = n x Tt / Total time 

=> 2 x n x Tt = Total time


=>2 x n x 2 = 202.01
=> n = 202.01 / 4 => 50.50

For minimum, we have to take ceil, Hence size of window = 51

35. For a Turing machine M, <M> denotes an encoding of M. Consider the following two
languages.

𝐿1 = {〈𝑀〉|𝑀 𝑡𝑎𝑘𝑒𝑠 𝑚𝑜𝑟𝑒 𝑡ℎ𝑎𝑛 2021 𝑠𝑡𝑒𝑝𝑠 𝑜𝑛 𝑎𝑙𝑙 𝑖𝑛𝑝𝑢𝑡𝑠}


𝐿2 = {〈𝑀〉|𝑀 𝑡𝑎𝑘𝑒𝑠 𝑚𝑜𝑟𝑒 𝑡ℎ𝑎𝑛 2021 𝑠𝑡𝑒𝑝𝑠 𝑜𝑛 𝑠𝑜𝑚𝑒 𝑖𝑛𝑝𝑢𝑡}
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

35
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
Which one of the following options is correct?

1. Both 𝐿1and 𝐿2 are undecidable.


2. 𝐿1is undecidable and 𝐿2is decidable.
3. 𝐿1is decidable and 𝐿2is undecidable.
4. Both 𝐿1and 𝐿2 are decidable.

Answer: 4

Explanation:
L1 is decidable.
We can take all strings of length zero to length 2021.
If TM takes more than 2021 steps on above inputs then definitely it will take more than 2021
steps on all input greater than length 2021.
If TM takes less than 2021 steps:
In such a case suppose TM takes less than 2021 steps (let's say 2020 steps ) for string length
2021, 2022, 2023, then definitely TM will take 2020 steps for all input greater than 2023. Hence
in both cases it is decidable.

Similarly L2 is also decidable. If we can decide for all inputs then we can decide for some inputs
also.

36. Consider the following statements.

𝑆1:The sequence of procedure calls corresponds to a preorder traversal of the activation tree.

𝑆2:The sequence of procedure returns corresponds to a postorder traversal of the activation tree.

Which one of the following options is correct?

1. 𝑆1is false and 𝑆2is false


2. 𝑆1is true and 𝑆2is true
3. 𝑆1is true and 𝑆2is false
4. 𝑆1is false and 𝑆2is true

Answer: 2
Explanation: The given statements are true, they are well known facts.
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

36
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
1. The sequence of procedure calls corresponds to a preorder traversal of the
activation tree.
2. The sequence of returns corresponds to a postorder traversal of the
activation tree.

37. Let G be a group of order 6, and H be a subgroup of G such that 1 < |H| < 6.

Which one of the following options is correct?

1. G is always cyclic, but H may not be cyclic.


2. Both G and H are always cyclic.
3. G may not be cyclic, but H is always cyclic.
4. Both G and H may not be cyclic.

Answer : 4

Explanation :

If ‘G’ is a group with sides 6, its subgroups can have orders 1, 2, 3, 6.

(The subgroup order must divide the order of the group)

Given ‘H’ can be 1 to 6, but 4, 5 cannot divide ‘6’.

Then ‘H’ is not a subgroup.

G can be cyclic only if it is abelian. Thus G may or may not be cyclic.


The H can be cyclic only for the divisors of 6 and H cannot be cyclic for any non divisors
of 6.

38. A relation R is said to be circular of aRb and bRc together imply cRa. Which of the
following options is/are correct?

1. If a relation S is reflexive and circular, then S is an equivalence relation.


2. If a relation S is transitive and circular, then S is an equivalence relation.

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

37
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
3. If a relation S is circular and symmetric, then S is an equivalence relation.
4. If a relation S is reflexive and symmetric, then S is an equivalence relation.

Answer : 1

Explanation :

Theorem: A relation R on a set A is an equivalence relation if and only if it is reflexive and


circular.

For symmetry, assume that x, y ∈ A so that xRy, lets check for yRx.
Since R is reflexive and y ∈ A, we know that yRy. Since R is circular and xRy and yRy, we
know that yRx. Thus R is symmetric.

For transitivity, assume that x, y, z ∈ A so that xRy and yRz. Check for xRz. Since R is circular
and xRy and yRz, we know that zRx. Since we already proved that R is symmetric, zRx implies
that xRz. Thus R is transitive.

39. Consider the following Boolean expression.

𝐹 = (𝑋 + 𝑌 + 𝑍)(𝑋 + 𝑌)(𝑌 + 𝑍)

Which of the following Boolean expressions is/are equivalent to 𝐹(complement of F)?

1. (𝑋 + 𝑍)(𝑌 + 𝑍)
2. 𝑋𝑌 + 𝑌𝑍 + 𝑋 𝑌 𝑍
3. 𝑋𝑌 + 𝑍
4. (𝑋 + 𝑌 + 𝑍)(𝑋 + 𝑌)(𝑌 + 𝑍)

Solution: 1,2,3

Explanation:

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

38
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

XY’+Z’ is a minimal SoP expression which represents the function (X,Y,Z).

The expression XY’ + YZ’ + X’Y’Z’ can be reduced to XY’+Z’

XY’ + YZ’ + X’Y’Z

= Y’(X+X’Z’) + YZ

= Y’(X+Z’) + Y

= XY’ + Y’Z’ + YZ’

= XY’ + (Y’+Y)Z’

= XY’ + Z’.

The expression (X+Z’)(Y’+Z’) is a PoS expression which also represents the same function
(X,Y,Z).

_____________________________________________________________________

40. Consider two hosts P and Q connected through a router R. The maximum transfer unit
(MTU) value of the link between P and R is 1500 bytes, and between R and Q is 820 bytes.

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

39
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
A TCP segment of size 1400 bytes was transferred from P to Q through R, with IP identification
value as 0x1234. Assume that the IP header size is 20 bytes. Further, the packet is allowed to be
fragmented, i.e., Don’t Fragment (DF) flag in the IP header is not set by P.

Which of the following statements is/are correct?

1. If the second fragment is lost, R will resend the fragment with the IP identification value
0x1234.
2. If the second fragment is lost, P is required to resend the whole TCP segment.
3. Two fragments are created at R and the IP datagram size carrying the second fragment is
620 bytes.
4. TCP destination port can be determined by analysing only the second fragment.

Answer : 2,3

Explanation :

Given, Segment size = 1400B

For First Link – PR – There will be no Fragment


For Second Link – RQ
First Fragment = 800(Data) + 20(Header) = 820 B
Second Fragment = 1400-800 = 600+20(H) = 620 B

41. Consider the following matrix.

The largest eigenvalue of the above matrix is _______

Answer : 3

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

40
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
Explanation :

Given

The characteristic equation

|𝐴 − λ𝐼| = 0

4 2
⇒ λ − 6λ − 8λ − 3 = 0

Eigen values, λ = 3, − 1, − 1, − 1

Largest = 3

42. The lifetime of a component of a certain type is a random variable whose probability density
function is exponentially distributed with parameter 2. For a randomly picked component of this
type, the probability that its lifetime exceeds the expected lifetime (rounded to 2 decimal places)
is _______.

Answer : 0.37

Explanation :

Parameter λ = 2
1 1
Mean = λ
= 2

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

41
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
−λ𝑥
Probability Density Function, PDF = 𝑓(𝑥) = λ · 𝑒

Asked: 𝑃(𝑥 > µ)


−λ𝑥
𝑃(𝑋 > 𝑥) = 𝑒
−λ·µ −1
𝑃(𝑋 > µ) = 𝑒 =𝑒 = 0. 3678 = 0. 37

43. Consider the following grammar (that admits a series of declarations, followed by
expressions) and the associated syntax directed translation (SDT) actions, given as pseudo-code:

P ⟶ D* E*
D ⟶ int ID {record that ID.lexeme is of type int}
D ⟶ bool ID {record that ID.lexeme is of type bool}
E ⟶ E1 + E2 {check that E1.type = E2.type = int; set E.type := int}
E ⟶ !E1 {check that E1.type = bool; set E.type := bool}
E ⟶ ID {set E.type := int}

With respect to the above grammar, which one of the following choices is correct?

1. The actions can be used to type-check syntactically correct integer variable declarations
and integer expressions.
2. The actions will lead to an infinite loop.
3. The actions can be used to type-check syntactically correct boolean variable declarations
and boolean expressions.
4. The actions can be used to correctly type-check any syntactically correct program.

Answer: option 4
Explanation: This SDT will never lead to infinite loop so option 2 is false. This SDT is type
checking for bool as well as integer variables, hence this SDT can be used to correctly
type-check any syntactically correct program involving boolean and integer variables.

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

42
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

44. Suppose a database system crashes again while recovering from a previous crash. Assume
checkpointing is not done by the database either during the transactions or during recovery.

Which of the following statements is/are correct?

1. The same undo and redo list will be used while recovering again.
2. The database will become inconsistent.
3. The system cannot recover any further.
4. All the transactions that are already undone and redone will not be recovered again.

Answer: 1

Explanation: Suppose a database system crashes again while recovering it from the previous
crash then also we need to make use of the redo and undo list to recover the system.

45. Which of the following standard C library functions will always invoke a system call when
executed from a single-threaded process in a UNIX/linux operating system?

1. sleep
2. strlen
3. malloc
4. exit

Answer : 1,3,4

Explanation :

● A sleep system call takes a time value as a parameter, specifying the minimum amount of
time that the process is to sleep before resuming execution. The parameter typically
specifies seconds, although some operating systems provide finer resolution, such as
milliseconds or microseconds.

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

43
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
● strlen() is not system call.
● The function call malloc() is a library function call that further uses the brk() or sbrk()
system call for memory allocation
● Exit also system call

46. Consider the following two statements.

𝑆1: Destination MAC address of an ARP reply is a broadcast address.


𝑆2: Destination MAC address of an ARP request is a broadcast address.

Which of the following choices is correct?

1. Both 𝑆1and 𝑆2are true.


2. 𝑆1is true and 𝑆2is false.
3. 𝑆1is false and 𝑆2is true.
4. Both 𝑆1and 𝑆2are false.

Answer : 3

Explanation :

ARP request is Broadcasting.


ARP reply is unicasting.

47. Consider the following pseudocode, where S is a semaphore initialized to 5 in line#2 and
counter is a shared variable initialized to 0 in line#1. Assume that the increment operation in
line#7 is not atomic.

1. int counter = 0
2. Semaphore S = init(5);
3. void parop(void)
4. {

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

44
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
5. wait(S);
6. wait(S);
7. counter++;
8. signal(S);
9. signal(S);
10. }

If five threads execute the function parop concurrently, which of the following program
behaviour(s) is/are possible?

1. The value of counter is 1 after all the threads successfully complete the execution of
parop.
2. The value of counter is 5 after all the threads successfully complete the execution of
parop.
3. The value of counter is 0 after all the threads successfully complete the execution of
parop.
4. There is a deadlock involving all the threads.

Answer : 1,2,4

Explanation :

count =0
S=5

func()
{
wait();
wait();
count++;
signal();
signal();
}

Answer:

(1) Deadlock is possible.

For a deadlock free operation


No. of resources >= No. of process (Req-1) + 1

Here, no. of resources = 5 (semaphore value)


Each thread requires = 2 resources (wait call)
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

45
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
No. of threads = 5

5 ≥ 5* (2-1)+1
≱ 6. So deadlock is possible.

This occurs when all 5 threads get blocked on first wait().

(2) count =5 is possible


When all threads enter CS and execute count++ sequentially.

(3) Count=1 is possible.

Assembly level:
read R0, count
inc R0, 1
write count, R0

Thread - 1 reads Count=0 in R0, preempted

Thread-2 reads count=0, is r1, completes, count=1

Thread-3, 4 & 5 completes.

Thread-1 is given CPU


MC R0, 1, so R0=1
Write R0 to count.
So, Count=1.

48. Consider the following context-free grammar where the set of terminals is {a, b, c, d, f}.

𝑆 → 𝑑𝑎𝑇 | 𝑅𝑓
𝑇 → 𝑎𝑆 | 𝑏𝑎𝑇 | ϵ
𝑅 → 𝑐𝑎𝑇𝑅 | ϵ

The following is a partially-filled LL(1) parsing table.

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

46
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

Which one of the following choices represents the correct combination for the numbered cells in
the parsing table (“blank” denotes that the corresponding cell is empty)?

1. ① S ⟶ Rf ② S ⟶ Rf ③T⟶∊ ④T⟶∊
2. ① blank ② S ⟶ Rf ③T⟶∊ ④T⟶∊
3. ① S ⟶ Rf ② blank ③ blank ④T⟶∊
4. ① blank ② S ⟶ Rf ③ blank ④ blank

Answer: Option 1
Explanation:
(1) S-> Rf
(2) S->Rf
(3) T-> 𝛆
(4) T-> 𝛆

S->Rf will go in first(Rf) = {c, f}


As first(R)= {c, 𝛆 }
When R is “𝛆” then first(Rf)= {f}
So, first(Rf) = {c, f}
Hence (1) S-> Rf
(2) S->Rf

T->𝛆 will go in follow(T)


Follow(T)= First(R)
Since R-> caTR and when R is 𝛆 then it will be equal to R->caT
So follow(T)= follow(R)
Also Since
T->aS hence follow(T)=follow(S) = $
Hence follow(T)= First(R) U Follow(R) U {$}
First(R) ={c, 𝛆}
Follow(R)= {f}
So follow(T)= {c,f,$}
Hence (4) T-> 𝛆

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

47
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

49. Consider the following language.


*
{
𝐿 = 𝑤 ∈ {0, 1} | 𝑤 𝑒𝑛𝑑𝑠 𝑤𝑖𝑡ℎ 𝑡ℎ𝑒 𝑠𝑢𝑏𝑠𝑡𝑟𝑖𝑛𝑔 011 }
Which one of the following deterministic finite automata accepts L?

Answer: 2
Explanation:
Option A accepts string “01111” which does not end with 011 hence wrong.
Option C accepts string “0111” which does not end with 011 hence wrong.
Option D accepts string “0110” which does not end with 011 hence wrong.
Option B is correct.

The NFA for language in which all strings ends with “011”

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

48
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

The DFA will be

50. A five-stage pipeline has stage delays of 150, 120, 150, 160 and 140 nanoseconds. The
registers that are used between the pipeline stages have a delay of 5 nanoseconds each.

The total time to execute 100 independent instructions on this pipeline, assuming there are no
pipeline stalls, is ______ nanoseconds.

Ans:17160

In a pipeline with k-stages, number of cycles to execute n instructions = (k+n-1) cycles


Here k = 5, n = 100
So we need a total of 5+100-1 = 104 cycles.
Clock cycle time = maximum of all stage delays + register delay
= max(150, 120, 150, 160, 140) + 5 = 160+5 = 165 ns

Time in ns = 104*165 = 17160ns

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

49
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
32
51. Consider a computer system with a byte-addressable primary memory of size 2 bytes.
10
Assume the computer system has a direct-mapped cache of size 32 KB (1 KB = 2 bytes), and
each cache block is of size 64 bytes.

The size of the tag field is ______ bits.

Ans: 17

Explanation:

Given that the main memory is 2^32 bytes. So the physical address is 32 bits long.

Since it is a direct mapped cache the physical address is divided into fields as (TAG, LINE,
OFFSET).

Cache size is 32KB = 2^15 Bytes.


Block size is 64 bytes = 2^6 bytes, so OFFSET needs 6 bits.

Number of blocks in the cache = 2^15//2^6 = 2^9, So LINE number needs 9 bits.

TAG bits = 32 - 9 - 6 = 17 bits.

52. Let G = (V, E) be an undirected unweighted connected graph. The diameter of G is defined
as:

Let M be the adjacency matrix of G.

Define graph 𝐺2on the same set of vertices with adjacency matrix N, where

Which one of the following statements is true?

1. ⎡diam(G)/2⎤ < diam(G2) < diam(G)


2. diam(G2) ≤ ⎡diam(G)/2⎤
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

50
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
3. diam(G) < diam(G2) ≤ 2 diam(G)
4. diam(G2) = diam(G)

Answer : 2

53. Consider the following undirected graph with edge weights as shown:

The number of minimum-weight spanning trees of the graph is _______

Answer : 3

Explanation :

To find the number of spanning trees using 2 methods:

1. If graph is complete, use n^n-2 formula

2. If graph is not complete, then use kirchhoff theorem.

Steps in Kirchoff’s Approach:

(i) Make an Adjacency matrix.

(ii) Replace all non-diagonal is by – 1.

(iii) Replace all diagonal zero’s by the degree of the corresponding vertex.

(iv) Co-factors of any element will give the number of spanning trees.

Using the Kirchhoff theorem will take lot of time because the number of vertices are 9.

So, we use brute force technique to solve the problem with the help of Kruskal's algorithm.

Fixed format of MST:

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

51
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

MST-1:

MST-2:

MST-3:

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

52
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

54. Let <M> denote an encoding of an automaton M. Suppose that Σ = {0,1}. Which of the
following languages is/are NOT recursive?

1. L = {<M> | M is a DFA such that L(M) = Σ*}


2. L = {<M> | M is a DFA such that L(M) = ∅}
3. L = {<M> | M is a PDA such that L(M) = Σ*}
4. L = {<M> | M is a PDA such that L(M) = ∅}

Answer: 3
Explanation:
L={ <M> | M is a DFA such that L(M)=𝛟 }. M is a DFA so L(M) will be a regular and the
emptiness problem for regular language is decidable.

L={ <M> | M is a DFA such that L(M)=𝚺* }. M is a DFA so L(M) will be a regular and the
completeness problem for regular language is decidable.

L={ <M> | M is a PDA such that L(M)=𝚺* }. M is a PDA so L(M) will be context free language
and the completeness problem for context free language is undecidable.

L={ <M> | M is a PDA such that L(M)=𝛟 }. M is a PDA so L(M) will be context free language and
the emptiness problem for context free language is decidable.

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

53
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
55. Consider a linear list based directory implementation in a file system. Each directory is a list
of nodes, where each node contains the file name along with the file metadata, such as the list of
pointers to the data blocks.Consider a given directory foo.

Which of the following operations will necessarily require a full scan of foo for successful
completion?

1. Deletion of an existing file from foo


2. Opening of an existing file in foo
3. Creation of a new file in foo
4. Renaming of an existing file in foo

Answer : 3,4

Explanation :

Renaming and creating a new file requires us to search the complete inode for duplicate names
(to check if the same name already exists). There is no such problem in deleting and opening a
file, as duplicate names are not possible while they are created.

56. Consider the following recurrence relation.

Which one of the following options is correct?

1. 𝑇(𝑛) = Θ(𝑛 𝑙𝑜𝑔 𝑛)


2. 𝑇(𝑛) = Θ(𝑛)
5/2
(
3. 𝑇(𝑛) = Θ (𝑙𝑜𝑔 𝑛) )
5/2
4. 𝑇(𝑛) = Θ(𝑛 )

Answer : 2

Explanation :

𝑇(𝑛) = 𝑇(𝑛/2) + 𝑇(2𝑛/5) + 7𝑛

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

54
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

9 2
Consider the further equation ⇾ 7𝑛 + 7𝑛 ( ) + 7𝑛( )
9
10 10
⎰ 9 2 ⎱ 9 𝑘
+ ( ) +... + ( )
9
= 7𝑛 1 +
⎱ 10 10 ⎰ 10

= 7𝑛( )1
(1−(9/10))
= Θ(𝑛)

Note: The left of the side of the depth is 𝑙𝑜𝑔2𝑛 and right side of the depth is 𝑙𝑜𝑔5/2𝑛.

57. There are 6 jobs with distinct difficulty levels, and 3 computers with distinct processing
speeds. Each job is assigned to a computer such that:

- The fastest computer gets the toughest job and the slowest computer gets the easiest job.
- Every computer gets at least one job.

The number of ways in which this can be done is ______

Answer: 65

Let the levels be 1,2,3,4,5,6. (1 is the least difficult, 6 is the most difficult level)
Let the computers be F,M,S( fast, medium, slow).

As per the given constraint, 1 must be given to F and 6 must be given to S.


Now we are left with 2,3,4,5 and F being assigned 1, S being assigned 6 and M being assigned

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

55
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
none.
Another constraint is that, every computer must be assigned atleast one.
So compute with assigning one job to M, two jobs to M, three jobs to M and four jobs to M.
Assigning one job to M: we can assign 1 out of 4 jobs in (4C1 ways) and remaining 3 jobs to F,S
in 2*2*2 = 8 ways. (each job has two options, either F or S),

Assigning two jobs to M: we can select two jobs from 4 in 4C2 ways and remaining 2 can be
distributed to F and S in 2*2 ways ( each job has two options either F or S)

Assigning three jobs to M: we can select 3 out of 4 in 4C3 ways remaining can be distributed to
F,M in 2 ways.

Assigning 4 jobs to M: it can be done in only one way.

Total : 4c1*8 + 4C2* 4 + 4C3*2 + 1

= 32+24+8+1

=65

58. Consider the following array.

Which algorithm out of the following options uses the least number of comparisons (among the
array elements) to sort the above array in ascending order?

1. Quicksort using the last element as pivot


2. Insertion sort
3. Selection sort
4. Mergesort

Answer : 2
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

56
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
Explanation :

Quick sort(with last element as pivot) → will give the worst case time complexity as O(n^2).

Merge Sort → The merge sort will not depend upon the input order and will give O(nlogn) time
complexity.

Insertion Sort → Insertion sort will perform best case time complexity when the input array is in
sorted order. If the array is already sorted then the inversion count is 0 and If the array is sorted
in reverse order that inversion count is the maximum.

Note: Inversion formal definition is two elements A[i] and A[j] form an inversion if A[i] > A[j] and i
< j.

The number of comparisons will not take more than “n” for the given input array.

Selection Sort → Selection sort will not depend upon the input order and will give O(n^2) time
complexity.

_____________________________________________________________________

59. Consider the following ANSI C program.

# include <stdio.h>
int main()
{
int i, j, count;
count = 0;
i = 0;
for (j = -3; j <= 3; j++)
{
if ((j >= 0) && (i++))
count = count + j;
}
count = count + i;
printf(“%d”, count);
return 0;
}

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

57
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
Which one of the following options is correct?

1. The program will compile successfully and output 13 when executed.


2. The program will compile successfully and output 10 when executed.
3. The program will compile successfully and output 8 when executed.
4. The program will not compile successfully.

Solution: B

Explanation:

Input: count=0 , i=0 and j=-3

For(j = -3; j <= 3; j++) → Condition TRUE then enters into the loop.

if((j >= 0) && (i++)) → Condition fails because they are given logical AND.

So, we are not entering the “if” condition and come out of the loop. The count and “i” values
remain “0”.

For(j = -2; j <= 3; j++) → Condition TRUE then enters into the loop.

if((j >= 0) && (i++)) → Condition fails because they are given logical AND.

So, we are not entering the “if” condition and come out of the loop. The count and “i” values
remain “0”.

For(j = -1; j <= 3; j++) → Condition TRUE then enters into the loop.

if((j >= 0) && (i++)) → Condition fails because they are given logical AND.

So, we are not entering the “if” condition and come out of the loop. The count and “i” values
remain “0”.

For(j = 0; j <= 3; j++) → Condition TRUE then enters into the loop.

if((j >= 0) && (i++)) → Condition TRUE then enters into the loop.

count=0+0 → Count=0

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

58
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

For(j = 1; j <= 3; j++) → Condition TRUE then enters into the loop.

if((j >= 0) && (i++)) → Condition TRUE then enters into the loop.

count=0+1 → Count=1

For(j = 2; j <= 3; j++) → Condition TRUE then enters into the loop.

if((j >= 0) && (i++)) → Condition TRUE then enters into the loop.

count=1+2 → Count=3

For(j = 3; j <= 3; j++) → Condition TRUE then enters into the loop.

if((j >= 0) && (i++)) → Condition TRUE then enters into the loop.

count=3+3 → Count=6

For(j = 4; j <= 3; j++) → Condition FALSE we are not entering the loop.

count=6+4 → We are given a condition as a post increment. So, “i”


updates the next instruction.

The above code segment executes successfully and will print value=10.

_______________________________________________________________________

60. A relation r(A, B) in a relational database has 1200 tuples. The attribute A has integer values
ranging from 6 to 20, and the attribute B has integer values ranging from 1 to 20. Assume that
the attributes A and B are independently distributed.

The estimated number of tuples in the output of σ(𝐴>10)∨(𝐵=18)(𝑟) is ________

Answer : 820

Explanation :

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

59
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
Probability of 1st condition being satisfied(say P(A)) = 10/15 = 2/3
Probability of 2nd condition being satisfied(say P(B)) = 1/20
Probability of both conditions being satisfied(say P(A intersection B)) = 2/3*1/20 = 1/30
Probability of any one condition being satisfied = P(A union B) = P(A)+P(B)-P(A intersection
B) = 2/3 + 1/20 - 1/30 = 41/60
therefore, expected number of tuples = (41/60)*1200 = 820

61. Suppose that 𝐿1is a regular language and 𝐿2is a context free language. Which one of the
following languages is NOT necessarily context free?

A. L1. L2
B. L1 ∪ L2
C. L1 ∩ L2
D. L1 − L2
Answer: D

Explanation:
L1. L2 => regular . CFL == CFL. CFL (as every regular is CFL so we can assume regular as
CFL)
Since CFL is closed under concatenation so
CFL. CFL= CFL
Hence
Regular . CFL = CFL is true

L1 ∪ L2 => Regular ∪ CFL = CFL


Regular ∪ CFL = CFL ∪ CFL (as every regular is CFL so we can assume regular as CFL)

Since CFL is closed under union


Hence Regular ∪ CFL = CFL is true

L1 ∩ L2 => Regular ∩ CFL = CFL


Regular languages are closed under intersection with any language
I.e,
Regular ∩ L = L (where L is any language such as CFL, CSL etc)

Hence Regular ∩ CFL = CFL is true

Please note this is a special property of regular languages so we will not upgrade regular
into CFL (as we did in S1 and S2). We can directly use these closure properties.

L1 − L2 => Regular − CFL = CFL


=> Regular − CFL = regular ∩ CFL (complement)
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

60
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
Since CFL is not closed under complement so complement of CFL may or may not be CFL

Hence Regular − CFL need not be CFL

For ex:
R= (a+b+c)* and L= {am bn ck | m ≠ n or n ≠ k} which is CFL.

The complement of L = {an bn cn | n>0} which is CSL but not CFL.

So
R − L = (a+b+c)* − {am bn ck | m ≠ n or n ≠ k}

=> (a+b+c)* ∩ L (complement)


=> (a+b+c)* ∩ {an bn cn | n>0}
=> {an bn cn | n>0}

Which is CSL. Hence Regular − CFL need not be CFL.

62. Assume that a 12-bit Hamming code word consisting of 8-bit data and 4 check bits is
𝑑8𝑑7𝑑6𝑑5𝑐8𝑑4𝑑4𝑑3𝑑2𝑐4𝑑1𝑐2𝑐1, where the data bits and the check bits are given in the following
tables:

Which one of the following choices gives the correct values of x and y?

1. x is 1 and y is 1
2. x is 0 and y is 1
3. x is 1 and y is 0
4. x is 0 and y is 0

Solution: 4

Explanation:

C2 checks the bits d1, d3, d4, d6, d7.


Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

61
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
C2=1, d1= 1, d3= 1, d4= 0, d6= 0, d7= 1.

The number of 1s is even. So, even parity is used in this problem.

C1 checks the bits d1, d2, d4, d5, d7.

C1=0, d1= 1, d2= 0, d4= 0, d5= x, d7= 1.

As the parity used is even parity, the value of d5 should be 0.

x=d5=0

C8 checks the bitsa d5, d6, d7, d8.

C8=y, d5= x=0, d6= 0, d7= 1, d8= 1.

As the parity used is even parity, the value of C8 should be 0.

C8=y=0.

x=y=0.

63. Consider a 3-bit counter, designed using T flip-flops, as shown below:

Assuming the initial state of the counter given by PQR as 000, what are the next three states?

1. 011, 101, 000


2. 001, 010, 111
3. 001, 010, 000
4. 011, 101, 111

Solution: 3

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

62
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
Explanation:

The truth table will be

RQP Rn Qn Pn

000 011

011 101

101 000

Therefore, the next three states are : 101, 000 and 011

________________________________________________________________________

64. Let P be an array containing n integers. Let t be the lowest upper bound on the number of
comparisons of the array elements, required to find the minimum and maximum values in an
arbitrary array of n elements. Which one of the following choices is correct?
𝑛
1. 𝑡 > 𝑛 𝑎𝑛𝑑 𝑡 ≤ 3⎡ 2

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

63
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
𝑛
2. 𝑡 > 3⎡ 2
⎤ 𝑎𝑛𝑑 𝑡 ≤ 2𝑛 − 2
3. 𝑡 > 2𝑛 − 2
4. 𝑡 > ⎡𝑙𝑜𝑔2(𝑛)⎤ 𝑎𝑛𝑑 𝑡 ≤ 𝑛

Answer : 1

Explanation:

Let assume n=512

Method-1:

Using standard recursive algorithm:

MaxMin is a recursive algorithm that finds the maximum and minimum of the set of elements
{a(i), a(i+1), ..., a(j)}. The situation of set sizes one (i=j) and two (i=j-1) are handled separately.
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

64
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
For sets containing more than two elements, the midpoint is determined ( just as in binary
search) and two new subproblems are generated. When the maxima and minima of these
subproblems are determined, the two maxima are compared and the two minima are compared
to achieve the solution for the entire set.

To find the number of element comparisons needed for Maxmin, T(n) represents this number,
then the resulting recurrence relation is

k
When n is a power of two, n = 2 for some positive integer k, then

T(n)=2T(n/2)+2
=2(2T(n/4)+2)+2
=4T(n/4)+4+2

=2k-1T(2)+1ik-12i
=2k-1+2k-2
=3n/2-2

→ The given example n=512

Apply into 3n/2 -2

= (3*512)/2 -2

= 768-2

= 766

Method-2:

Find the minimum and maximum independently, using n-1 comparisons for each, for a total of
2n-2 comparisons. In fact, at most 3⌊n/2⌋ comparisons are sufficient to find both the minimum
and the maximum. The strategy is to maintain the minimum and maximum elements seen thus
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

65
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
far. Rather than processing each element of the input by comparing it against the current
minimum and maximum, at a cost of 2 comparisons per element, we process elements in pairs.
We compare pairs of elements from the input first with each other, and then we compare the
smaller to the current minimum and the larger to the current maximum, at a cost of 3
comparisons for every 2 elements.

Setting up initial values for the current minimum and maximum depends on whether n is odd or
even. If n is odd, we set both the minimum and maximum to the value of the first element,and
then we process the rest of the elements in pairs. If n is even, we perform 1 comparison on the
first 2 elements to determine the initial values of the minimum and maximum, and then process
the rest of the elements in pairs as in the case for odd n.

Let us analyze the total number of comparisons. If n is odd, then we perform 3⌊n/2⌋
comparisons. If n is even, we perform 1 initial comparison followed by 3(n-2)/2 comparisons, for
a total of (3n/2)-2. Thus, in either case, the total number of comparisons is at most 3⌊n/2⌋.

Given an even number of elements. So, 3n/2 -2 comparisons.

= (3*512)/2 -2

= 768-2

= 766

Method-3:

By using Tournament Method:

Step-1: To find the minimum element in the array will take n-1 comparisons.

We are given 512 elements. So, to find the minimum element in the array will take
512-1= 511

Step-2: To find the largest element in the array using the tournament method.

1. After the first round of Tournament , there will be exactly n/2 numbers =256 that will

lose the round.

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

66
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​
2. The biggest loser (the largest number) should be among these 256 loosers.To find the

largest number will take (n/2)−1 comparisons =256-1 = 255

Total 511+255= 766

65. A binary search tree T contains n distinct elements. What is the time complexity of picking
an element in T that is smaller than the maximum element in T?

1. Θ(𝑙𝑜𝑔 𝑛)
2. Θ(𝑛 𝑙𝑜𝑔 𝑛)
3. Θ(𝑛)
4. Θ(1)

Answer : 4

Explanation :

The time complexity of searching an element in T that is smaller than the maximum element in T
is O(1) time.

Example:

Comparing that 5<10 will take only a constant amount of time.

_____________________________________________________________

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

67
Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.
Follow on Unacademy : https://unacademy.com/@ravula​​

Use “RRCS” code to get 10% Discount on Unacademy Plus Subscription.


Follow on Unacademy : https://unacademy.com/@ravula​​

68

You might also like