Official Paper

GATE CS 2020 Official Paper (Previous Year Paper)

65 questions · 180 minutes · with answers · free

General Aptitude (10 questions)

1

Raman is confident of speaking English ______ six months as he has been practising regularly ______ the last three weeks.

  1. ((a))

    during, for

  2. ((b))

    for, since

  3. ((c))

    for, in

  4. ((d))

    within, for

Show Answer
Answer: ((d))

within, for

The correct answer is Option 4) i.e. within, for

After reading the sentence we can easily comprehend that Raman is confident that he will be able to speak English under a certain time limit, so we need a Preposition that will convey this meaning. The available options for the first blank are 'for', 'during' and 'within', we can easily negate for and during because 'for' is used to represent a duration of time and 'during' is any time between the start and finish of a set length of time. Hence, we are left with 'within' which is the most appropriate choice as it means under a certain time limit.

Now for the second blank 'for' is the most apt option because 'last three weeks' is a duration of time and we use "For" when we measure the duration – when we say how long something lasts.

Complete Sentence: Raman is confident of speaking English within six months as he has been practising regularly for the last three weeks.

2

His knowledge of the subject was excellent but his classroom performance was ______.

  1. ((a))

    extremely poor

  2. ((b))

    good

  3. ((c))

    desirable

  4. ((d))

    praiseworthy

Show Answer
Answer: ((a))

extremely poor

The correct answer is Option 1) i.e. extremely poor

In the sentence given above, we have two independent clauses which are joint by coordinating conjunction 'but'. The word 'but' is one of the seven coordinating conjunctions in English (the others are and, or, so, for, nor, and yet). It’s used to connect two statements that contrast or contradict each other in some way. Now the first part of the sentence is positive in nature so the second part must contradict this, so the only contradicting option we have is 'extremely poor'.

Let's see some examples in order to develop more clarity:

  • learning Mathematics is difficult but fun!
  • She is the smartest girl in the class but I don't like her.

Complete Sentence: His knowledge of the subject was excellent but his classroom performance was extremely poor.

3

Select the word that fits the analogy:

Cook : Cook ∷ Fly : ______

  1. ((a))

    Flyer

  2. ((b))

    Flying

  3. ((c))

    Flew

  4. ((d))

    Flighter

Show Answer
Answer: ((a))

Flyer

The correct answer is option 1) i.e. Flyer.

From the first part of the analogy, we can conclude that a noun is needed after its corresponding verb. Similarly, 'fly' is our verb and we need a corresponding noun i.e. 'flyer' ( flying and flew is a verb and flighter is not a word).

The noun form of the verb 'Fly' is 'Flyer'

Hence it is the correct fit in the second part of the given analogy.

4

The dawn of the 21st century witnessed the melting glaciers oscillating between giving too much and too little to billions of people who depend on them for fresh water. The UN climate report estimates that without deep cuts to man-made emissions, at least 30% of the northern hemisphere’s surface permafrost could melt by the end of the century. Given this situation of imminent global exodus of billions of people displaced by rising seas, nation-states need to rethink their carbon footprint for political concerns, if not for environmental ones.

Which one of the following statements can be inferred from the given passage?

  1. ((a))

    Nation-states do not have environmental concerns.

  2. ((b))

    Nation-states are responsible for providing fresh water to billions of people.

  3. ((c))

    Billions of people are responsible for man-made emissions.

  4. ((d))

    Billions of people are affected by melting glaciers.

Show Answer
Answer: ((d))

Billions of people are affected by melting glaciers.

The correct answer is option 4) i.e. Billions of people are affected by melting glaciers.​ 

  • Option 1 can be negated from the get-go as there is nothing conclusive about this statement, the statement "Nation-states do not have environmental concerns" is no-where mentioned in the passage. The passage is just suggesting that nation-states need to rethink their carbon footprint for political concerns, if not for environmental ones.
  • Option 2 can be negated in a similar fashion as the nation-states are only accountable for man-made emissions and reducing carbon footprint as per the passage.
  • Option 3 can be negated as nothing is mentioned in the passage that Billions of people are responsible for man-made emissions.

Option 4 follows directly from the first sentence of the passage. *"*The dawn of the 21st century witnessed the melting glaciers oscillating between giving too much and too little to billions of people who depend on them for freshwater." After reading this sentence we can conclude that billions of people are affected by melting glaciers as they depend on it.

5

There are multiple routes to reach from node 1 to node 2, as shown in the network.

The cost of travel on an edge between two nodes is given in rupees. Nodes ‘a’, ‘b’, ‘c’, ‘d’, ‘e’, and ‘f’ are toll booths. The toll price at toll booths marked ‘a’ and ‘e’ is Rs. 200, and is Rs. 100 for the other toll booths. Which is the cheapest route from node 1 to node 2?

  1. ((a))

    1-a-c-2

  2. ((b))

    1-f-b-2

  3. ((c))

    1-b-2

  4. ((d))

    1-f-e

Show Answer
Answer: ((b))

1-f-b-2

Option 1: 1-a-c-2

Route1 → aa → cc → 2
Cost200100100

Total cost = 200 + 100 + 100 = 400

Option 2: 1-f-b-2

Route1 → ff → bb → 2
Cost1000200

Total cost = 100 + 0 + 200 = 300

Option 3: 1-b-2

Route1 → bb → 2
Cost300200

Total cost = 300 + 200 = 500

Option 4: 1-f-e-2

Route1 → ff → ee → 2
Cost100100200

Total cost = 100 + 100 + 200 = 400

Therefore, the cheapest route from node 1 to node 2 is 1-f-b-2.

6

Goods and Services Tax (GST) is an indirect tax introduced in India in 2017 that is imposed on the supply of goods and services, and it subsumes all indirect taxes except few. It is a destination-based tax imposed on goods and services used, and it is not imposed at the point of origin from where goods come. GST also has a few components specific to state governments, central government and Union Territories (UTs).

Which one of the following statements can be inferred from the given passage?

  1. ((a))

    GST is imposed on the production of goods and services.

  2. ((b))

    GST includes all indirect taxes.

  3. ((c))

    GST does not have a component specific to UT.

  4. ((d))

    GST is imposed at the point of usage of goods and services.

Show Answer
Answer: ((d))

GST is imposed at the point of usage of goods and services.

Explanation:

The correct answer is option 4) i.e. GST is imposed at the point of usage of goods and services.​ 

  • Option 1 can be negated from the get-go as GST is not imposed on production, it is imposed on the supply of goods and services.
  • Option 2 can be negated in a similar fashion as the GST subsumes all indirect taxes except few.
  • Option 3 can be negated as it has been mentioned clearly in the passage that- "GST also has a few components specific to state governments, central government and Union Territories (UTs)."

Option 4 follows directly from the second line of the passage. "It is a destination-based tax imposed on goods and services used,".** Here the term "at the point of usage of goods and services." implies that it is a destination-based tax.

7

If P = 3, R = 27, T = 243, then Q + S = _______.

  1. ((a))

    40

  2. ((b))

    80

  3. ((c))

    90

  4. ((d))

    110

Show Answer
Answer: ((c))

90

3?27?243
PQRST
31 = 332 = 933 = 2734 = 8135 =243

 Q + S = 9 + 81 = 90

8

The figure below shows an annular ring with outer and inner radii as b and a, respectively. The annular space has been painted in the form of blue colour circles touching the outer and inner periphery of annular space. If maximum n number of circles can be painted, then the unpainted area available in annular space is ______.

  1. ((a))

    π[(b2a2)n4(ba)2]\pi[(b^2 -a^2) - \frac{n}{4}(b-a)^2]

  2. ((b))

    π[(b2a2)n(ba)2]\pi[(b^2 -a^2) - n(b-a)^2]

  3. ((c))

    π[(b2a2)+n4(ba)2]\pi[(b^2 -a^2) + \frac{n}{4}(b-a)^2]

  4. ((d))

    π[(b2a2)+n(ba)2]\pi[(b^2 -a^2) + n(b-a)^2]

Show Answer
Answer: ((a))

π[(b2a2)n4(ba)2]\pi[(b^2 -a^2) - \frac{n}{4}(b-a)^2]

Area of a circle with radius a = πa2

Area of a circle with radius b = πb2

The diameter of the shaded circle = (b - a) 

Area of shaded circle = π(ba2)2=π(ba)24\pi(\frac{b-a}{2})^2 = \pi \frac{(b-a)^2}{4}

Painted area = total area of shaded circle = nπ(ba)24n \pi \frac{(b-a)^2}{4}

Area of angular space =  πb2  – πa2 = π (b2 – a2 )

Area of angular space = Painted area  + Unpainted area

Unpainted area = Area of angular space – Painted area

Unpainted area = π(b2a2)nπ(ba)24\pi (b^2 - a^2) -n \pi \frac{(b-a)^2}{4}

Unpainted area = π[(b2a2)n4(ba)2]\pi[(b^2 -a^2) - \frac{n}{4}(b-a)^2]

9

Two straight lines are drawn perpendicular to each other in X-Y plane. If α and β are the acute angles the straight lines make with the X-axis, then α + β is _______.

  1. ((a))

    60°

  2. ((b))

    90°

  3. ((c))

    120°

  4. ((d))

    180°

Show Answer
Answer: ((b))

90°

Concept:

The sum of the interior angles of a triangle is equal to 180o

Straight lines perpendicular to each other in an X-Y plane

Calculation:

A + α + β = 180o

90o + α + β = 180o

α + β = 90o

10

The total revenue of a company during 2014-2018 is shown in the bar graph. If the total expenditure of the company in each year is 500 million rupees, then the aggregate profit or loss (in percentage) on the total expenditure of the company during 2014-2018 is _______. 

  1. ((a))

    16.67% profit

  2. ((b))

    16.67% loss

  3. ((c))

    20% profit

  4. ((d))

    20% loss

Show Answer
Answer: ((c))

20% profit

Data:

Expenditure per year = 500 × 106 Rs.

Revenue in 2014 = 500 × 106 Rs.

Revenue in 2015 = 700 × 106 Rs.

Revenue in 2016 = 800 × 106 Rs.

Revenue in 2017 = 600 × 106 Rs.

Revenue in 2018 = 400 × 106 Rs.

Formula:

% profit = Total;profitTotal;expenditure×100\frac{Total ; profit}{Total ; expenditure} \times 100

Calculation

Total expenditure = number of years × expenditure per year

∴ Total expenditure = 5 × 500 × 106 = 2500 × 106 Rs.

Total Revenue = (500 + 700 + 800 + 600 + 400) × 106 Rs.

∴ Total Revenue = 3000 × 106 Rs

Total profit = Total Revenue - Total expenditure = 500 × 106

% profit = 500×1062500×106×100=20\frac{500 \times 10^6}{2500 \times 10^6} \times 100 = 20

Computer Science and Information Technology (55 questions)

11

Consider the functions

I. e-x

II. x2 – sin x

III. x3+1\sqrt {{x^3} + 1}

Which of the above functions is/are increasing everywhere in [0, 1]?

  1. ((a))

    III only

  2. ((b))

    II only

  3. ((c))

    II and III only

  4. ((d))

    I and III only

Show Answer
Answer: ((a))

III only

Concept:

A function f(x) is said to be increasing in the given interval if it’s first order differential f(x)0f'\left( x \right) \ge 0 holds for every point in the given interval.

Calculation:

Function I:

f(x)=exf(x)=;exf\left( x \right) = {e^{ - x}}\therefore f'\left( x \right) = ; - {e^{ - x}}

f(0)=1<0\because {f'}\left( 0 \right) = - 1 < 0

Therefore, the function is non increasing.        

Function II:

f(x)=;x2sinx,;f(x)=2xcosxf\left( x \right) = ;{x^2} - \sin x,;f'\left( x \right) = 2x - \cos x

f(0)=;0cos0=1<0f'\left( 0 \right) = ;0 - \cos 0 = - 1 < 0

Therefore, this function is also non increasing.

Furthermore, since cosine function is periodic function, it cannot be strictly increasing in the given range

Function III:

f(x)=x3+1f\left( x \right) = \sqrt {{x^3} + 1}

f(x)=3x22x3+1{\rm{f'}}\left( {\rm{x}} \right) = \frac{{3{x^2}}}{{2\sqrt {{x^3} + 1} }}

f(0)=0,;f(1)>0f'\left( 0 \right) = 0,;f'\left( 1 \right) > 0

Therefore, the function is increasing in the given interval.

Therefore f(x)=x3+1f\left( x \right) = \sqrt {{x^3} + 1}  function is the only increasing everywhere in [0, 1]

Hence Option(1) is the correct answer.

12

For parameters a and b, both of which are ω(1), T(n) = T(n1/a) + 1, and T(b) = 1.

Then T(n) is

  1. ((a))

    Θ(loga logb n)

  2. ((b))

    Θ(logab n)

  3. ((c))

    Θ(logb loga n)

  4. ((d))

    Θ(log2 log2 n)

Show Answer
Answer: ((a))

Θ(loga logb n)

Recurrence relation:

T(n)=T(n1a)+1,;T(b)=1T\left( n \right) = T\left( {{n^{\frac{1}{{\rm{a}}}}}} \right) + 1,{\rm{;}}T\left( b \right) = 1

where ‘a’ and ‘b’ are parameters of order ω(1)

Using substitution method to solve recurrences,

T(n)=;T(n1a)+1{\rm{T}}\left( {\rm{n}} \right) = {\rm{;T}}\left( {{{\rm{n}}^{\frac{1}{a}}}} \right) + 1

=T((n1a2)+1)+1= {\rm{T}}\left( {\left( {{{\rm{n}}^{\frac{1}{{{{\rm{a}}^2}}}}}} \right) + 1} \right) + 1 

=T(n1a2)+2= {\rm{T}}\left( {{{\rm{n}}^{\frac{1}{{{{\rm{a}}^2}}}}}} \right) + 2 

=(T(n1a3)+1)+2= \left( {{\rm{T}}\left( {{{\rm{n}}^{\frac{1}{{{{\rm{a}}^3}}}}}} \right) + 1} \right) + 2 

=T(n1a3)+3 = {\rm{T}}\left( {{\rm{n}}\frac{1}{{{{\rm{a}}^3}}}} \right) + 3 

Continuing this for ‘m’ iterations, we get

T(n)=T(n1am)+m{\rm{T}}\left( {\rm{n}} \right) = {\rm{T}}\left( {{{\rm{n}}^{\frac{1}{{{{\rm{a}}^{\rm{m}}}}}}}} \right) + {\rm{m}} 

Put (n1am)=b\left( {{n^{\frac{1}{{{a^m}}}}}} \right) = b

Taking log on both sides

1amlogn=logb\frac{1}{{{a^m}}}\log n = \log b 

am=lognlogb{a^m} = \frac{{\log n}}{{\log b}}

m=logalogb;nm = lo{g_a}lo{g_b};n

Now,

T(n)=T(n1am)+mT\left( n \right) = T\left( {{n^{\frac{1}{{{a^m}}}}}} \right) + m 

T(n)=;b+;logalogb;nT\left( n \right) = {\rm{;}}b + ;lo{g_a}lo{g_b};n

So, the asymptotic order of T(n) is Θ(logalogb n)

13

Consider the following statements.

I. Daisy chaining is used to assign priorities in attending interrupts.

II. When a device raises a vectored interrupt, the CPU does polling to identify the source of interrupt.

III. In polling, the CPU periodically checks the status bits to know if any device needs its attention.

IV. During DMA, both the CPU and DMA controller can be bus masters at the same time.

Which of the above statements is/are TRUE?

  1. ((a))

    I and II only

  2. ((b))

    I and IV only

  3. ((c))

    I and III only

  4. ((d))

    III only

Show Answer
Answer: ((c))

I and III only

Statement I: TRUE

In daisy chaining method of interrupt handling, the devices are connected serially in such a manner that nearest device to the CPU has the highest priority, followed by the next device and so on.

Statement II: FALSE

In vectored interrupt, vector address is given to the CPU to identify the source of interrupt. For example, in 8085 µP, RST 4.5 is a vectored interrupt. Here, 4.5 is the interrupt vector which gives the vector address as 4.5 × 8 = (36)10 = (0024)16

Statement III: TRUE.

In polling method, the CPU polls each device to check status bits to find out if the device has raised any interrupt. It is a software method.

Statement IV: FALSE

In DMA mode, either the CPU or the DMA controller would gain control of the system bus a time, but not both. Accordingly, the CPU would be either in busy state or Hold state. It would be in busy state until I/O device prepares the data and would go to Hold state when I/O device starts transferring data to main memory via DMA controller.

14

Consider the following data path diagram.

 

Consider an instruction: R0 ← R1 + R2. The following steps are used to execute it over the given data path. Assume that PC is incremented appropriately. The subscripts r and w indicate read and write operations, respectively.

  1. R2r, TEMP1f, ALUadd, TEMP2w
  2. R1r, TEMP1w
  3. PCr, MARw, MEMr
  4. TEMP2r, R0w
  5. MDRr, IRw

Which one of the following is the correct order of execution of the above steps?

  1. ((a))

    2, 1, 4, 5, 3

  2. ((b))

    1, 2, 4, 3, 5

  3. ((c))

    3, 5, 2, 1, 4

  4. ((d))

    3, 5, 1, 2, 4

Show Answer
Answer: ((c))

3, 5, 2, 1, 4

Concept:

While executing a micro-instruction such as R0 ← R1 + R2, the CPU performs various micro-operations. Each of this micro-operation is performed in one time cycle.

Execution:

Step 1:

Fetch the instruction. Initially, the address of the instruction to be executed in Program Counter (PC). It is moved from PC to Memory Address Register (MAR). This is done via micro-operation PCr, MARw, MEMr

Step 2:

Once the instruction has been fetched, in next single time cycle, it is placed into Memory Data Register (MDR) and then to Instruction Register (IR). This is done via micro-operation MDRr, IRw

Step 3:

Operand Fetching and Decoding of contents from Register R1 and place it into temporary register Temp1 via micro- operation R1r, TEMP1w

Step 4:

Contents of Register R2 is decoded and ALU performs the addition of fetched content of Temp1 and R2 and place it into Temp2 via micro-operation R2r, TEMP1f, ALUadd, TEMP2w

Step 5:

Finally, the content of Temp2 is moved into the target register R0 via micro-operation TEMP2r, R0w

15

The pre-order traversal of a binary search tree is 15, 10, 12, 11, 20, 18, 16, 19.

Which one of the following is the post order traversal of the tree?

  1. ((a))

    10, 11, 12, 15, 16, 18, 19, 20

  2. ((b))

    11, 12, 10, 16, 19, 18, 20, 15

  3. ((c))

    20, 19, 18, 16, 15, 12, 11, 10

  4. ((d))

    19, 16, 18, 20, 11, 120, 10, 15

Show Answer
Answer: ((b))

11, 12, 10, 16, 19, 18, 20, 15

Concept:

A binary tree can be traversed in three ways:

  1. Preorder = (Root, Left subtree, Right Subtree)
  2. Inorder = (Left subtree, Root, Right Subtree)
  3. Postorder = (Left Subtree, Right subtree, Root)

 

Explanation:

In case of Binary Search Trees (BST), inorder traversal always sorts the tree nodes into ascending order.

Inorder traversal is 10, 11, 12, 15, 16, 18, 19, 20

Pre-order traversal is 15, 10, 12, 11, 20, 18, 16, 19.

In preorder traversal, the first node would be tree root and values less than root would be part of left

subtree and values greater than root node would form right subtree. So the resultant BST is:

Required Binary Search Tree:

Post order traversal: 11, 12, 10, 16, 19, 18, 20, 15

16

What is the worst case time complexity of inserting n2 elements into an AVL-tree with n elements initially?

  1. ((a))

    Θ(n4)

  2. ((b))

    Θ(n2)

  3. ((c))

    Θ(n2log n)

  4. ((d))

    Θ(n3)

Show Answer
Answer: ((c))

Θ(n2log n)

Concept:

AVL tree is a height balanced binary search tree.

Insertion in AVL takes Θ (log n) time and height of an AVL tree with n nodes is log n.

Calculation:

The given AVL tree already has n nodes. Now each successive insertion would involve two operations: Θ(log n) to find the appropriate place to insert and another Θ(log n) to do any rotation if required. So in worst case, each successive insertion requires 2 log n operation i.e. Θ (log n).

Therefore, n2 insertions would require Θ (n2 log n).

17

Which one of the following regular expressions represents the set of all binary strings with an odd number of 1’s?

  1. ((a))

    ((0 + 1)*1(0 + 1)*1)10

  2. ((b))

    (01010*)01

  3. ((c))

    10*(01010*)*

  4. ((d))

    0*(1010)10

Show Answer
Answer: ((d))

0*(1010)10

Concept:

The regular expression should generate all possible binary strings with odd number of 1’s and doesn’t generate the other strings.

Option 1: Incorrect

Regular Expression: ((0 + 1)*1(0 + 1)*1)10

String: 11110

It can generate strings (11110) with even number of 1’s also

Option 2: Incorrect

Regular Expression: (01010*)01

It will generate string only ending with ‘1’

String: 1110

It cannot generate ‘1110’ substring.

Option 3: Incorrect

Regular Expression: 10*(01010*)*

It will generate string only starting with ‘1’

String: 0111

It cannot generate ‘0111’ substring.

Option 4: Correct

Regular expression: 0*(1010)10

It will generate all possible binary strings with odd number of 1’s and doesn’t generate the other strings.

Note:

Option 4 has been changed, since none of the option is was correct in official GATE CS 2020 paper

Marks has been given to all.

18

Consider the following statements.

I. If L1 ∪ L2 is regular, then both L1 and L2 must be regular.

II. The class of regular languages is closed under infinite union.

Which of the above statements is/are TRUE?

  1. ((a))

    I only

  2. ((b))

    II only

  3. ((c))

    Both I and II

  4. ((d))

    Neither I nor II

Show Answer
Answer: ((d))

Neither I nor II

Statement I: FALSE

If L1 ∪ L2 is regular, then neither L1 nor L2 needs necessarily be regular.

Example:

Assume L1= {an bn, n ≥ 0} over the alphabet {a, b} and L2 be the complement of L1.

Neither L1 nor L2 is regular (both are DCFL) but L1 ∪ L2= {an bn} ∪ {an bn}c = (a + b)* is regular.

Statement II: FALSE. The infinite Union of regular languages is not regular.

Example:

Given alphabet {a, b}.

L1= {ε}

L2= {ab}

L3= {aabb}

L4= {aaabbb}

:

:

L = L1 ∪ L2 ∪ L3 ∪ L4

Each of the above are regular but their infinite Union gives L1= {an bn, n ≥ 0} which is not regular but DCFL.

Note:

DCFL → Deterministic context free language

19

Consider the following statements.

I. Symbol table is accessed only during lexical analysis and syntax analysis.

II. Compilers for programming languages that support recursion necessarily need heap storage for memory allocation in the run-time environment.

III. Errors violating the condition ‘any variable must be declared before its use’ are detected during syntax analysis.

Which of the above statements is/are TRUE?

  1. ((a))

    I only

  2. ((b))

    I and III only

  3. ((c))

    II only

  4. ((d))

    None of I, II, and III

Show Answer
Answer: ((d))

None of I, II, and III

Statement I: FALSE

Symbol table is the data structure, which is used in all phase, that is, from lexical analysis till code generation and optimization.

Statement II: FALSE

Recursion mandatorily requires stack memory during the runtime environment, not heap memory.

Statement III: FALSE.

Error such as ‘any variable must be declared before its use’ is semantic error and thus cannot be detected during syntax analysis.

20

Consider the language L = {an |n ≥ 0} ∪ {anbn| n ≥ 0} and the following statements.

I. L is deterministic context-free.

II. L is context-free but not deterministic context-free.

III. L is not LL(k) for any k.

Which of the above statements is/are TRUE?

  1. ((a))

    I only

  2. ((b))

    II only

  3. ((c))

    I and III only

  4. ((d))

    III only

Show Answer
Answer: ((c))

I and III only

Concept:

Union of a Regular language and a Deterministic Context Free Language (DCFL) is a DCFL.

Explanation:

Statement I: TRUE.

L = {an |n ≥ 0} ∪ {anbn| n ≥ 0}

{an |n ≥ 0} is a regular language and {anbn| n ≥ 0} is a DCFL and hence, there Union would be a DCFL.

Statement II: FALSE.

L is DCFL then it is CFL too.

Statement III: TRUE

L cannot be LL(k) for any number of look-ahead. LL(k) cannot conclusively distinguish that whether the string to be parsed is from an or from anbn. Both have a common prefix.

21

Consider allocation of memory to a new process. Assume that none of the existing holes in the memory will exactly fit the process’s memory requirement. Hence, a new hole of smaller size will be created if allocation is made in any of the existing holes. Which one of the following statements is TRUE?

  1. ((a))

    The hole created by first fit is always larger than the hole created by next fit.

  2. ((b))

    The hole created by worst fit is always larger than the hole created by first fit.

  3. ((c))

    The hole created by best fit is never larger than the hole created by first fit.

  4. ((d))

    The hole created by next fit is never larger than the hole created by best fit.

Show Answer
Answer: ((c))

The hole created by best fit is never larger than the hole created by first fit.

Concept:

Best fit allocation:

The best fit allocation strategy chooses the smallest available memory partition that can satisfy the memory requirement. It creates the smallest hole.

First fit allocation:

The first fit chooses the first available memory partition that can satisfy the requirement.

Worst fit allocation:

The worst fit allocation strategy chooses the largest available memory partition that can satisfy the memory requirement. It creates the largest hole.

Next fit allocation:

It works same as First Fit, the only difference it maintain a pointer to all last allocated memory space to the process and begins it search from there if new request is arrived, unlike first fit which start will initial memory space.

Explanation:

Option 1 and Option 4 : FALSE

The hole created by first fit may or may not be larger than the hole created by next fit

Option 2: FALSE

The hole created by worst fit is always larger than or equal to the hole created by first fit

Option 3: TRUE

The hole created by best fit could never be larger than the hole created by first fit.

 Although it may be equal.

22

Consider the following statements about process state transitions for a system using preemptive scheduling.

I. A running process can move to ready state.

II. A ready process can move to running state.

III. A blocked process can move to running state.

IV. A blocked process can move to ready state.

Which of the above statements are TRUE?

  1. ((a))

    I, II, and III only

  2. ((b))

    II and III only

  3. ((c))

    I, II, and IV only

  4. ((d))

    I, II, III, and IV

Show Answer
Answer: ((c))

I, II, and IV only

A process state diagram for a pre-emptive scheduling is:

Statement I: TRUE

A process can move from running state to ready state on interrupt or when priority expires, that is, when it is pre-empted.

Statement II: TRUE

A ready process moves to running process when it is dispatched.

Statement III: FALSE

A blocked process that is in waiting state can never move directly to running state. It must go to ready queue first.

Statement IV: TRUE.

A blocked or waiting process can move to ready state.

Important Point:

The transition from running to ready state is possible only in pre-emptive scheduling. It cannot happen in non pre-emptive scheduling.

23

Consider a relational database containing the following schemes.

Catalogue
snopnoCost
S1P1150
S1P250
S1P3100
S2P4200
S2P5250
S3P1250
S3P2150
S3P5300
S3P4250

 

Suppliers
snosnamelocation
S1M/s Royal furnitureDelhi
S2M/s Balaji furnitureBangalore
S3M/s Premium furnitureChennai

 

Parts
pnoPnamePart_spec
P1TableWood
P2ChairWood
P3TableSteel
P4AlmirahSteel
P5AlmirahWood

 

The primary key of each table is indicated by underling the constituent fields.

SELECT  s.sno, s.sname

FROM   Suppliers s, Cataloque c

WHERE s.sno = c.sno AND

                Cost > (SELECT AVG (cost)

FROM Cataloque

WHERE pno = ‘P4’

GROUP BY pno);

The number of rows returned by the above SQL query is

  1. ((a))

    4

  2. ((b))

    5

  3. ((c))

    0

  4. ((d))

    2

Show Answer
Answer: ((a))

4

Inner Query: SELECT AVG (cost) FROM Cataloque WHERE pno = ‘P4’ GROUP BY pno

The execution of the inner query gives the average of the cost of parts with part-id P4

Output:

Avg (cost)
225

 

Outer Query:

SELECT s.sno, s.sname FROM Suppliers s, Cataloque c WHERE s.sno = c.sno AND Cost > (225)

The execution of the entire query output the following table:

snosname
S2M/s Balaji furniture
S3M/s Premium furniture
S3M/s Premium furniture
S3M/s Premium furniture

 

Hence, there are 4 rows in the resultant table.

24

Which one of the following is used to represent the supporting many-one relationships of a weak entity set in an entity-relationship diagram?

  1. ((a))

    Diamonds with double/bold border

  2. ((b))

    Rectangles with double/bold border

  3. ((c))

    Ovals with double/bold border

  4. ((d))

    Ovals that contain underlined identifiers

Show Answer
Answer: ((a))

Diamonds with double/bold border

Concept: 

An entity set which has determined an attribute or set of attributes to be a primary key is called a strong entity set.

If an entity set does not have enough attributes to form a primary key, it is called a weak entity set.

Explanation:

In E-R diagram, the many-to-one relationship with a weak entity set is represented by diamond with double borders.

Important Point:

The relationship with weak entity set would be represented by diamonds with double/bold borders.

The weak entity set itself would be represented by rectangle with double/bold border.

25

Consider the following statements about the functionality of an IP based router.

I. A router does not modify the IP packets during forwarding.

II. It is not necessary for a router to implement any routing protocol.

III. A router should reassemble IP fragments if the MTU of the outgoing link is larger than the size of the incoming IP packet.

Which of the above statements is/are TRUE?

  1. ((a))

    I and II only

  2. ((b))

    I only

  3. ((c))

    II and III only

  4. ((d))

    II only

Show Answer
Answer: ((d))

II only

Statement I is FALSE. An IP packet gets modified after router has processed it because the Time to Live (TTL) field in IP header is decremented by 1.

Statement II is TRUE. A router need not necessarily implement a routing protocol. If no routing protocol is specified for a router, default routing with address 0.0.0.0 is implemented.

Statement III is FALSE. Re-assembly of IP fragments into a single IP packet is done only at the receiver site.

26

What is the worst case time complexity of inserting n elements into an empty linked list, if the linked list needs to be maintained in sorted order?

  1. ((a))

    Θ(n)

  2. ((b))

    Θ(n log n)

  3. ((c))

    Θ(n2)

  4. ((d))

    Θ(1)

Show Answer
Answer: ((c))

Θ(n2)

The linked list needs to be maintained in sorted order: (insertion sort on linked list)

Assume the worst case comparison:

Elements are sorted in ascending order and linked list is singly.

Insert 1st element:

1st element is always sorted and hence no comparison

Insert 2nd element:

2nd element, 1 comparison is needed

Insert 3rd element:

3rd element, 2 comparison is needed

:

:

Insert nth element:

nth element, (n – 1)    comparison is needed

For comparison:

T(n1) = 1 + 2 + … (n – 1 ) = n(n1)2=θ(n2)\frac{{{\rm{n}}\left( {{\rm{n}} - 1} \right)}}{2} = {\rm{\theta }}\left( {{{\rm{n}}^2}} \right)

For insertion:

Also, for every insertion, time complexity is θ 1).

T(n2) = θ(n)

T(n) = T(n1) + T(n2) = θ (n2) + θ (n)

∴ T(n) = θ (n2)

Important Point:

In elements are sorted in descending order, then to insert it will give best case θ (n), since each element will take θ(1) for comparison and θ (1) for insertion.

27

Let R be the set of all binary relations on the set {1,2,3}. Suppose a relation is chosen from R at random. The probability that the chose relation is reflexive (round off to 3 decimal places) is ______.

28

Let G be a group of 35 elements. Then the largest possible size of a subgroup of G other than G itself is ______.

29

A multiplexer is placed between a group of 32 registers and an accumulator to regulate data movement such that at any given point in time the content of only one register will move to the accumulator. The minimum number of select lines needed for the multiplexer is ______.

30

If there are m input lines and n output lines for a decoder that is used to uniquely address a byte addressable 1 KB RAM, then the minimum value of m + n is ______.

31

A direct-mapped cache memory of 1 MB has a block size of 256 bytes. The cache has an access time of 3 ns and a hit rate of 94%. During a cache miss, it takes 20 ns to bring the first word of a block from the main memory, while each subsequent word takes 5 ns. The word size is 64 bits. The average memory access time in ns (round off to 1 decimal place) is _______.

32

Consider the following C program.

#include <stdio.h>

int main() {

     int a[4][5] = { {1, 2, 3, 4, 5},

{6, 7, 8, 9, 10},

{11, 12, 13, 14, 15},

{16, 17, 18, 19, 20}};

        printf(“%d\n”, * (* (a+**a+2) +3) ) ;

        return (0);

}

The output of the program is _______.

33

Consider a double hashing scheme in which the primary hash function is h1(k) = k mod 23, and the secondary hash function is h2(k) = 1 + (k mod 19). Assume that the table size is 23. Then the address returned by probe 1 in the probe sequence (assume that the probe sequence begins at probe 0) for key value k = 90 is _______.

34

Consider the following grammar.

S → aSB | d

B → b

The number of reduction steps taken by a bottom-up parser while accepting the string aaadbbb is _______.

35

Assume that you have made a request for a web page through your web browser to a web server. Initially the browser cache is empty. Further, the browser is configured to send HTTP requests in non-persistent mode. The web page contains text and five very small images. The minimum number of TCP connections required to display the web page completely in your browser is _______.

36

Which of the following languages are undecidable? Note that (M) indicates encoding of the Turing machine M.

L1 = {<M>| L(M) = ϕ}

L2 = {<M, w, q>| M on input w reaches state q in exactly 100 steps}

L3 = {<M>| L(M) is not recursive}

L4 = {<M>| L(M) contains at least 21 members}

  1. ((a))

    L1, L3, and L4 only

  2. ((b))

    L1 and L3 only

  3. ((c))

    L2 and L3 only

  4. ((d))

    L2, L3, and L4 only

Show Answer
Answer: ((a))

L1, L3, and L4 only

The decidability problem of Turing Machines can directly be determined using Rice’s theorem.

L1 is undecidable. According to Rice’s theorem, emptiness problem of Turing machine is undecidable.

L2 is decidable. This is because here we have to check whether the Turing machine reaches a particular step ‘q’ on a given input in finite steps or not. This is a decidable problem.

L3 is undecidable. There is no algorithm to computationally determine whether a Turing machine accepts a recursive language or not. Some Turing machines may accept recursive languages, while other may not.

L4 is also undecidable. According to Rice’s theorem, membership problem of Turing machine is undecidable.

37

Let A and B two n × n matrices over real numbers. Let rank(M) and det(M) denote the rank and determinant of a matrix M, respectively. Consider the following statements.

I. rank(AB) = rank(A) rank(B)

II. det(AB) = det(A) det(B)

III. rank(A + B) ≤ rank(A) + rank(B)

IV. det(A + B) ≤ det(A) + det(B)

Which of the above statements are TRUE?

  1. ((a))

    I and II only

  2. ((b))

    I and IV only

  3. ((c))

    II and III only

  4. ((d))

    III and IV only

Show Answer
Answer: ((c))

II and III only

Concept:

Properties of Rank:

Rank of a matrix is the number of independent rows in the given matrix. Given two square matrices A and B of order n × n, we have following properties:

1. Rank of product of A and B i.e. Rank (AB) ≥ Rank (A) + Rank (B) – order of square matrix 2. Rank of sum of A and B i.e. Rank (A + B) ≤ Rank (A) + Rank (B).

Properties of Determinant**:**

Given two square matrices A and B of order n × n and their determinants Det(A) and Det(B) respectively, determinant of their product i.e Det( AB) = Det(A) * Det(B). However, the same does not hold for the addition of the given matrices.

Example:

Consider two square matrices A and B each of order 2×2.

\(A = \left[ {\begin{array}{*{20}{c}} 2&1\ 3&4 \end{array}} \right]\)

Rank of A = 2

Det (A) = 5

\(B = \left[ {\begin{array}{*{20}{c}} 1&0\ 0&1 \end{array}} \right]\)

Rank of B = 2

Det (B) = 1

\(AB = \left[ {\begin{array}{{20}{c}} 2&1\ 3&4 \end{array}} \right] \times \left[ {\begin{array}{{20}{c}} 1&0\ 0&1 \end{array}} \right] = \left[ {\begin{array}{*{20}{c}} 2&1\ 3&4 \end{array}} \right]\)

Rank (AB) = 2

Det (AB) = 5

\(A + B = ;\left[ {\begin{array}{{20}{c}} 2&1\ 3&4 \end{array}} \right] + \left[ {\begin{array}{{20}{c}} 1&0\ 0&1 \end{array}} \right] \)

\(A+B = ;\left[ {\begin{array}{*{20}{c}} 3&1\ 3&5 \end{array}} \right]\)

Rank of A+B = 2

Det (A+B) = 12

Statement I is FALSE.

The rank of product matrix AB is 2. Product of Rank(A) and Rank(B) is: 2*2 = 4. Therefore, the rank of the product matrix is not equal to the product of the rank of individual matrices.

Statement II is TRUE. 

Det(AB)= 5 = Det(A) * Det(B)

Statement III is TRUE.  

Rank(A + B) = 2. Sum of rank of A and B is: 2 + 2 = 4. Therefore, the relation: Rank (A + B) ≤ Rank (A) + Rank (B) holds true

Therefore, the rank of the addition matrix is less than or equal to the sum of the rank of the individual matrices.

Statement IV is FALSE.  

Det(A+B)= 12, which is greater than the sum of the determinants of individual matrices.

38

Consider the Boolean function z(a, b, c).

Which one of the following minterm lists represents the circuit given above?

  1. ((a))

    z = ∑ (0, 1, 3, 7)

  2. ((b))

    z = ∑ (1, 4, 5, 6, 7)

  3. ((c))

    z = ∑ (2, 4, 5, 6, 7)

  4. ((d))

    z = ∑ (2, 3, 5)

Show Answer
Answer: ((b))

z = ∑ (1, 4, 5, 6, 7)

The given circuit gives the output:

Z(a, b, c) = \(a + ;\mathord{\buildrel{\lower3pt\hbox{$\scriptscriptstyle\leftharpoonup$}} \over b} ;c\) 

Expanding it into canonical form to obtain the minterms

Z(a, b, c) = a(b+;bˉ)(c+cˉ)+(a+aˉ)bˉ;ca\left( {b + ;\bar b} \right)\left( {c + \bar c} \right) + \left( {a + \bar a} \right)\bar b;c 

abc+ab;cˉ+abˉ;c+abˉcˉ+aˉbˉ;cabc + ab;\bar c + a\bar b;c + a\bar b\bar c + \bar a\bar b;c

After rearranging the canonical terms, this corresponds to min-terms: ∑ (1,4, 5, 6, 7)

Alternate solution:

The output of the circuit is \(a + \mathord{\buildrel{\lower3pt\hbox{$\scriptscriptstyle\leftharpoonup$}} \over b} ;c\) 

K Map for this Boolean expression

The above K Map corresponds to min-terms: ∑ (1,4, 5, 6, 7)

39

Consider three registers R1, R2 and R3 that store numbers in IEEE-754 single precision floating point format. Assume that R1 and R2 contain the values (in hexadecimal notation) 0x42200000 and 0xC1200000, respectively.

If R3 =R1R2,= \frac{{R1}}{{R2}}, what is the value stored in R3?

  1. ((a))

    0x40800000

  2. ((b))

    0xC0800000

  3. ((c))

    0x83400000

  4. ((d))

    0xC85800000

Show Answer
Answer: ((b))

0xC0800000

Concept:

 In IEEE- 754 single precision format, a floating-point number is represented in 32 bits.

Sign bit (MSB)Biased Exponent (E’) (8 bits)Normalized Mantissa (M’) (23 bits)

 

Sign bit value 0 means positive number, and 1 means a negative number.

The floating-point number can be obtained by formula: ± 1. M × 2(E-127)

Data:

Content of R1: 0x 42200000               (0x means Hexadecimal notation)

Content of R2: 0x C1200000

Calculation:

Content of R1 in Hex (0x) is 42200000. After converting into binary, it can be represented in IEEE- 754 format as:

0100 0010 0010 0000 0000 0000 0000 0000

 

Sign bit is 0 i.e. the number is positive

Biased Exponent (E’) = 100 0010 0 = 132

Normalized Mantissa (M) = 010 0000 0000 0000 0000 0000 = .25

Therefore, the number in register R1 = + 1.25 * 2(132-127) = 1.25 × 32 = 40

Content of R2 in Hex (0x) is C1200000. After converting into binary, it can be represented in IEEE- 754 format as:

1100 0001 0010 0000 0000 0000 0000 0000

 

Sign bit is 1 i.e. the number is negative

Biased Exponent (E’) = 100 0001 0 = 130

Normalized Mantissa (M) = 010 0000 0000 0000 0000 0000 = .25

Therefore, the number in register R1 = - 1.25 * 2(130-127) = -1.25 * 8 = -10

R3 = R1/R2 = 40/-10 = -4

Since the number is negative, Sign bit (MSB) = 1

Converting 4 into binary of a floating point gives: (100.0)2

Representing it into normalized form gives:  (1.000000….) × 22

Therefore, Mantissa is 23 bits of all 0s

Biased Exponent (E’) = E+ 127 = 2+127 = 129 = (10000001)2

It can be represented in IEEE- 754 format as:

1100 0000 1000 0000 0000 0000 0000 0000

 

Converting it into Hex format gives: 0x C0800000

40

A computer system with a word length of 32 bits has a 16 MB byte-addressable main memory and a 64 KB, 4-way set associative cache memory with a block size of 256 bytes. Consider the following four physical addresses represented in hexadecimal notation.

A1 = 0x42C8A4, A2 = 0x546888, A3 = 0x6A289C, A4 = 0x5E4880

Which one of the following is TRUE?

  1. ((a))

    A1 and A4 are mapped to different cache sets.

  2. ((b))

    A2 and A3 are mapped to the same cache set.

  3. ((c))

    A3 and A4 are mapped to the same cache set.

  4. ((d))

    A1 and A3 are mapped to the same cache set.

Show Answer
Answer: ((b))

A2 and A3 are mapped to the same cache set.

Data:

Size of main memory: 16 MB

Size of cache memory: 64 KB

Block/line size: 256 B

The cache memory has been designed as 4- way set associative.

Calculation:

The memory is Byte- addressable.

Main memory size = 16 MB = 224 B. That means physical address generated by CPU would be represented

using 24 bits.

Cache memory size = 64 KB = 216 B

Block size = 256 B = 28 B. i.e. word would be represented by 8 bits

Therefore, Number of cache lines ÷ blocks = 216 ÷ 28 = 28

Since, the cache memory is 4-way set associative.

Hence, number of sets = 28 ÷ 22 = 26. i.e. 6 bits would be required for set/index.

Therefore, Number of bits for tag = 24 – (6 +8) = 10 bits

Hence, the 24 bit address generated by CPU would have following components:

Tag (10 bits)Set/Index (6 bits)Word (8 bits)

 

Physical Address A1 = 0x 42C8A4. Converting it into binary gives:

0100 0010 1100 10001010 0100

 

Physical Address A2 = 0x 546888. Converting it into binary gives:

0101 0100 0110 10001000 1000

 

Physical Address A3 = 0x 6A289C. Converting it into binary gives:

0110 1010 0010 10001001 1100

 

Physical Address A4 =0x 5E4880. Converting it into binary gives:

0101 1110 0100 10001000 0000

 

Thus it can be observed that A2 and A3 map to same set.

Also, address A1 and A4 map to same set.

Tips and Tricks:

The following approach should be adopted to quickly solve this question and save a lot of time:-

The number of bits for tag in a K- way set associative memory can be calculated directly as:

(log2 (Main memory size in Bytes) – log2 (Cache memory size in Bytes)) + log2 K

Another thing is that the question is concerned only about the set number of the given addresses. So, we need not convert first two Hex digits of the given address into binary format, because they would be part of tag bits. Similarly, the last two Hex digits need not be converted into binary as they are part of Word/Offset. Only the middle two Hex digit needs to be converted into binary. And then the 6 LSBs can be compared to check if they represent the same set or not.

41

Let G = (V, E) be a weighted undirected graph and let T be a Minimum Spanning Tree (MST) of G maintained using adjacency lists. Suppose a new weighted edge (u, v) ϵ V × V is added to G. The worst case time complexity of determining if T is still an MST of the resultant graph is

  1. ((a))

    Θ(|E| + |V|)

  2. ((b))

    Θ(|E||V|)

  3. ((c))

    Θ(|E| log |V|)

  4. ((d))

    Θ(|V|)

Show Answer
Answer: ((d))

Θ(|V|)

Concept:

The Minimum Spanning Tree (MST) of a graph G(V, E) with v vertices has (v-1) edges.

Explanation:

T is the MST of the given graph G and now a new edge has been added to G(V, E). Now there can be two scenarios:

Case I:

The edge weight of newly added edge (u, v) is greater than the weight of every edge in MST. In this case, MST would not be altered.  (Best Case scenario)

Case II:

The edge weight of newly added edge is less than any of the weights of the edges in MST ‘T’, in that case we would replace the maximum weighted edge in T with the new edge weight and then check if it forms a cycle (Worst case). Detection of cycle in a tree with V nodes can be done in O(V) time. This is because, the number of edges in T would always be (V-1)

42

Consider the following languages.

L1 = {wxyx | w, x, y ϵ (0 + 1)+}

L2 = {xy | x, y ϵ (a + b)*, |x| = |y|, x ≠ y}

Which one of the following is TRUE?

  1. ((a))

    L1 is regular and L2 is context-free.

  2. ((b))

    L1 is context-free but not regular and L2 is context-free.

  3. ((c))

    Neither L1 nor L2 is context-free.

  4. ((d))

    L1 is context-free but L2 is not context-free

Show Answer
Answer: ((a))

L1 is regular and L2 is context-free.

Concept:

A language is regular if we could find a corresponding regular expression that generates it and an finite automata that accepts it. A language is CFL, if we could construct a Push Down Automata (PDA) that accepts it.

Explanation:

L1 = {wxyx | w, x, y ϵ (0 + 1)+}

L1 is a regular language.

Since it is given that w, x, y ϵ (0 + 1)+}, that means w, x, y all three can be strings of {0, 1}.

L1 can be generated by a regular expression of the form:

(0+1)+0 (0+1)+0 + (0+1)+1 (0+1)+1, by putting x as 0 and 1 alternatively. Since it can be represented as a regular expression, it is a regular language.

L2 = {xy | x, y ϵ (a + b), |x| = |y|, x ≠ y}*

L2 is a Context Free Language.

L2 consists of set of strings which could be split into two non-identical substrings, but of equal length. Since comparison is involved, it cannot be done with a finite automata. However, a PDA can do comparisons, so PDA would accept the above language. Thus L2 is a CFL.

43

Consider the productions A → PQ and A → XY. Each of the five non-terminals A, P, Q, X and Y has two attributes: s is a synthesized attribute, and i is an inherited attribute. Consider the following rules.

Rule 1: P.i = A.i + 2, Q.i = P.i + A.i, and A.s = P.s + Q.s

Rule 2: X.i = A.i + Y.s and Y.i = X.s + A.i

Which one of the following is TRUE?

  1. ((a))

    Both Rule 1 and Rule 2 are L-attributed.

  2. ((b))

    Only Rule 1 is L-attributed.

  3. ((c))

    Only Rule 2 is L-attributed.

  4. ((d))

    Neither Rule 1 nor Rule 2 is L-attributed.

Show Answer
Answer: ((b))

Only Rule 1 is L-attributed.

Concept:

A rule is said to be L- attributed if it used both synthesized and inherited attributes. But, in the inherited attribute, we can get attribute values from the parent or from the left siblings, but not the right sibling.

Rule 1 is L- attributed.

Rule 1: P.i = A.i + 2, Q.i = P.i + A.i, and A.s = P.s + Q.s

Explanation:

P.i = A.i + 2     ...{This is an inherited attribute, as child P is getting value from parent A}

Q.i = P.i + A.i     ...{This is also inherited attribute and Q is getting value from parent P and left sibling A}

A.s = P.s + Q.s     ...{This is synthesized attribute as Parent A is taking values from children P and Q}

Rule 2 is not L- attributed

Rule 2: X.i = A.i + Y.s and Y.i = X.s + A.i

Explanation:

X.i = A.i + Y.s     ...{Child X is taking attribute value from parent A and right sibling Y}

Therefore, this violates the conditions of L- attributed definitions.

44

Each of a set of n processes executes the following code using two semaphores a and b initialized to 1 and 0, respectively. Assume that count is a shared variable initialized to 0 and not used in CODE SECTION P.

CODE SECTION P

wait (a); count=count+1 ;

if (count==n) signal (b) ;

signal (a) ; wait (b) ; signal (b) ;

CODE SECTION Q

What does the code achieve?

  1. ((a))

    It ensures that no process executes CODE SECTION Q before every process has finished CODE SECTION P.

  2. ((b))

    It ensures that at most two processes are in CODE SECTION Q at any time.

  3. ((c))

    It ensures that all processes execute CODE SECTION P mutually exclusively.

  4. ((d))

    It ensures that at most n-1 processes are in CODE SECTION P at any time.

Show Answer
Answer: ((a))

It ensures that no process executes CODE SECTION Q before every process has finished CODE SECTION P.

Explanation:

The key statement in the above code is wait (b). It will keep the remaining processes blocked until value on count becomes n. Once, the value of count = n, signal (b) would be executed and then a process can enter the code section Q. Thus, none of the process will execute Q until every process has executed code section P.

Stepwise Explanation:

Initialization:  a=1, b=0, count= 0

There are n processes say, P1, P2, P3, ……………., Pn.

Let’s assume P1 has executed successfully the code section P and encounters the statements:

wait (a);      

Now, ‘a’ becomes 0, so all the subsequent processes are blocked.

b= 0, count= 0.

count=count+1 ;                          [ a=0, b=0, count=1]

if (count==n) signal (b) ;              [if condition not true, so statement will not be executed]

signal (a);                                        [a= 1, b=0, count= 1. Other processes can now execute Wait(a)]

wait (b) ;                                [ b= -1, therefore P1 also gets blocked and statement would not be executed]

signal (b);                             

This statement would only run if its preceding statement is executed, which in turn would only be executed if (count==n). Therefore, none of the process would execute Q until every process has successfully executed code section P.

45

Consider the following five disk access requests of the form (request id, cylinder number) that are present in the disk scheduler queue at a given time.

(P, 155), (Q, 85), (R, 110), (S, 30), (T, 115)

Assume the head is positioned at cylinder 100. The scheduler follows Shortest Seek Time First scheduling to service the requests.

Which one of the following statements is FALSE?

  1. ((a))

    T is serviced before P.

  2. ((b))

    Q is serviced after S, but before T.

  3. ((c))

    The head reverses its direction of movement between servicing of Q and P.

  4. ((d))

    R is serviced before P.

Show Answer
Answer: ((b))

Q is serviced after S, but before T.

Concept:

In the Shortest Seek Time First (SSTF) disk scheduling algorithm, the I/O request which requires the least disk arm movement, irrespective of the direction, from the current position is selected.

Explanation:

Given the disk head is currently at cylinder number 100. Using SSTF it would next serve the request id R with cylinder number 110, because it requires least amount of arm movement. After R being served, T would be served and so on, as shown below:

Statement I is TRUE.

Request T is serviced before request P.

Statement II is FALSE.

Q is serviced before S and after T.  

Statement III is TRUE.

The direction of disk arm movement changes between servicing of Q and P, as visible from the diagram.

Statement IV is TRUE.

R is serviced before P.

46

Consider a relational table R that is in 3NF, but not in BCNF, Which one of the following statements is TRUE?

  1. ((a))

    R has a nontrivial functional dependency X → A, where X is not a superkey and A is a prime attribute.

  2. ((b))

    R has a nontrivial functional dependency X → A, where X is not a superkey and A is a non-prime attribute and X is not a proper subset of any key.

  3. ((c))

    R has a nontrivial functional dependency X → A, where X is not a superkey and A is a non-prime attribute and X is a proper subset of some key.

  4. ((d))

    A cell in R holds a set instead of an atomic value.

Show Answer
Answer: ((a))

R has a nontrivial functional dependency X → A, where X is not a superkey and A is a prime attribute.

Concept:

A relation is in 1NF if every values in the relation are atomic.

A relation R with nontrivial functional dependency X → A, where X is not a superkey and A is a non-prime attribute and X is not a proper subset of any key is in called to be in 2NF.

A relation R with nontrivial functional dependency X → A, where X is not a superkey and A is a prime attribute, is called to be in 3NF.

A relation R with nontrivial functional dependency X → A, where X is a superkey is called to be in BCNF.

Explanation:

Statement I:

corresponds to a relation that is in 3NF but not in BCNF, because for BCNF, X must be a superkey.

Statement II

corresponds to a relation that is only in 2NF by definition.

Statement III

corresponds to a relation that is not even in 2NF. It is in 1NF.

Statement IV corresponds to a relation that is not even in 1NF.

47

Consider a schedule of transactions T1 and T2:

T1RARCWDWBCommit
T2RBWBRDWCCommit

 

Here, RX stands for “Read(X)” and WX stands for “Write(X)”.

Which one of the following schedules is conflict equivalent to the above schedule?

  1. ((a))
    T1RARCWDWBCommit
    T2RBWBRDWCCommit
  2. ((b))
    T1RARCWDWBCommit
    T2RBWBRDWCCommit
  3. ((c))
    T1RARCWDWBCommit
    T2RBWBRDWCCommit
  4. ((d))
    T1RARCWDWBCommit
    T2RBWBRDWCCommit
Show Answer
Answer: ((a))
T1RARCWDWBCommit
T2RBWBRDWCCommit

Concept:

Two schedules S1 and S2 are termed to be conflict equivalent if the conflict operations in both the schedules are executed in same order. The conflict operations are identified by RW, WR, and WW pairs.

Explanation:

The given Schedule in question is:

T1T2
R(A) R(C) W(D) W(B) CommitR(B) W(B) R(D) W(C) Commit

       

 

 

 

 

 

 

 

 

 

 

 

The conflict pairs are:

 R2(B)-> W1(B)

 W2(B)-> W1(B)

R1(C)-> W2(C)

R2(D)-> W1(D)

The schedule in which these pairs are executed in the same order would be conflict equivalent to this given schedule.

Only the schedule in option 1 has all these 4 pairs in the same order of execution and thus is conflict equivalent to a given schedule.

48

An organization requires a range of IP addresses to assign one to each of its 1500 computers. The organization has approached on Internet Service Provider (ISP) for this task. The ISP uses CIDR and serves the requests from the available IP address space 202.61.0.0/17. The ISP wants to assign an address space to the organization which will minimize the number of routing entries in the ISP’s router using route aggregation. Which of the following address spaces are potential candidates from which the ISP can allot any one to the organization?

I. 202.61.84.0/21

II. 202.61.104.0/21

III. 202.61.64.0/21

IV. 202.61.144.0/21

  1. ((a))

    I and II only

  2. ((b))

    II and III only

  3. ((c))

    III and IV only

  4. ((d))

    I and IV only

Show Answer
Answer: ((b))

II and III only

Concept:

CIDR stands for Classless Inter Domain Routing. CIDR denotes the number of bits in the Netid.  Upon subnetting, any IP address consist of three subparts: Netid (bits for identifying the network), subnetid (bits for subnetting), and Hostid (bits for address allocation to hosts)

Calculation:

Given CIDR is 17, that means Netid=17.

There are 1500 devices, so the number of bits in Hostid= 11 (because 211 ≥ 1500)

Therefore, subnet bits= 32- (17+11) = 4

Hence, in any IP address in the given network, first 17 bits be part of network, next 4 of subnet ans last 11 bits would be for host address. Host bits should be all 0s

Address I: Cannot be allotted

202.61.84.0/21= 202.61. 0 1010 100.00000000. This address is not possible because the all the 11 host bits should be zero, but it contains a 1.

Address II: Can be allotted

202.61.104.0/21= 202.61. 0 1101 000.00000000. This address is possible as all the host bits are 0 and network bits are also satisfied.

Address III: Can be allotted

202.61.64.0/21= 202.61.0 1000 000.0000000. This address is possible as all the host bits are 0 and network bits are also satisfied

Address IV: Cannot be allotted

202.61.144.0/21= 202.61. 1 0010 000. 00000000. This address is not possible because bit in Netid has become 1.

49

Which one of the following predicate formulae is NOT logically valid?

Note that W is a predicate formula without any free occurrence of x.

  1. ((a))

    ∀x(p(x) ∨ W) ≡ ∀x p(x) ∨ W

  2. ((b))

    Ǝx(p(x) ∧ W) ≡ Ǝx p(x) ∧ W

  3. ((c))

    ∀x(p(x) → W) ≡ ∀x p(x) → W

  4. ((d))

    Ǝx(p(x) → W) ≡ ∀x p(x) → W

Show Answer
Answer: ((c))

∀x(p(x) → W) ≡ ∀x p(x) → W

Statement I:

∀x(p(x) ∨ W) ≡ ∀x p(x) ∨ W

This is logically valid. Because, W is free of any quantifier so, ∀x would be associated with p(x) only and hence L.H.S and R.H.S are equal.

Statement II:

Ǝx(p(x) ∧ W) ≡ Ǝx p(x) ∧ W

This also logically valid. Because, W is free of any quantifier so, Ǝx would be associated with p(x) only and hence L.H.S and R.H.S are equal.

Statement III:

∀x(p(x) → W) ≡ ∀x p(x) → W

This is logically NOT valid.

L.H.S: ∀x(p(x) → W

        = ∀x(¬ p(x) ∨ W)

        = ∀x (¬ p(x)) ∨ W

         = ¬ Ǝx p(x) ∨ W

         = Ǝx p(x) → W.

This is not equal to R.H.S

Statement IV:

Ǝx(p(x) → W) ≡ ∀x p(x) → W

This is logically valid.

L.H.S: Ǝx(p(x) → W)

       = Ǝx(¬ p(x) ∨ W)

      = Ǝx(¬ p(x)) ∨ W

      = ¬ ∀x p(x) ∨ W

      = ∀x p(x) → W = R.H.S

50

Let G = (V, E) be a directed, weighted graph with weight function w:E → ℝ.

For some function f:v → ℝ, for each edge (u, v) ϵ E, define w’(u, v) as w(u, v) + f(u) – f(v).

Which one of the options completes the following sentence so that it is TRUE?

“The shortest paths in G under w are shortest paths under w’ too, ______”.

  1. ((a))

    for every f: v → ℝ

  2. ((b))

    if and only if ∀u ϵ V, f(u) is positive

  3. ((c))

    if and only if ∀u ϵ V, f(u) is negative

  4. ((d))

    if and only if f(u) is the distance from s to u in the graph obtained by adding a new vertex s to G and edges of zero weight from s to every vertex of G

Show Answer
Answer: ((a))

for every f: v → ℝ

Shortest path will remain unchanged even if the weight functions are changed.

Hence option 1 is correct.

51

In a balanced binary search tree with n elements, what is the worst case time complexity of reporting all elements in range [a, b]? Assume that the number of reported elements is k.

  1. ((a))

    Θ(log n)

  2. ((b))

    Θ(log n + k)

  3. ((c))

    Θ(k log n)

  4. ((d))

    Θ(n log k)

Show Answer
Answer: ((b))

Θ(log n + k)

For the range [a, b], we first need to check if a and b are present in BST.

  1. Time complexity to check if element ‘a’ is present in BST = O(log n)
  2. Time complexity to check if element ‘b’ is present in BST = O(log n)

For finding all the elements in the range [a, b], we have to apply in-order sorting from a to b.

In this way, we will lay every successor of a reaching to the predecessor of b and all the elements between a and b will be reported.

For k elements, the in-order sorting will take O(k) time.

Hence, O(log n) + O(log n) + O(k) = O(2logn + k) = O(logn + k)

52

The number of permutations of the characters in LILAC so that no character appears in its original position, if the two L's are indistinguishable, is ______.

53

Consider a non-pipelined processor operating at 2.5 GHz. It takes 5 clock cycles to complete an instruction. You are going to make a 5-stage pipeline out of this processor. Overheads associated with pipelining force you to operate the pipelined processor at 2 GHz. In a given program, assume that 30% are memory instructions, 60% are ALU instructions and the rest are branch instructions. 5% of the memory instructions cause stalls of 50 clock cycles each due to cache misses and 50% of the branch instructions cause stalls of 2 cycles each. Assume that there are no stalls associated with the execution of ALU instructions. For this program, the speedup achieved by the pipelined processor over the non-pipelined processor (round off to 2 decimal places) is _____.

54

A processor has 64 registers and uses 16-bit instruction format. It has two types of instructions: I-type and R-type. Each I-type instruction contains an opcode, a register name, and a 4-bit immediate value. Each R-type instruction contains an opcode and two register names. If there are 8 distinct I-type opcodes, then the maximum number of distinct R-type opcodes is ______.

55

For n > 2, let a ϵ (0, 1)n be a non-zero vector. Suppose that x is chosen uniformly at random from {0, 1}n. Then, the probability that ∑ni=1 aixi is an odd number is ______.

56

Consider the following C functions.

int fun1 (int n) { static int I = 0; if (n > 0) { ++I; fun1 (n-1); } return (i) ; }int fun2 (int n) { static int I = 0; if (n > 0) { i = i + fun1(n) ; fun2 (n-1) ; } return (i) ; }

 

The return value of fun2 (5) is ______

57

Consider the array representation of a binary min-heap containing 1023 elements. The minimum number of comparison required to find the maximum in the heap is ______.

58

Consider the following C functions.

int tob (int b, int* arr) { int i; for (i=0 ; b>0; i++) { if (b%2) arr[i]=1; else arr[i]=0; b = b/2; } return (i) ; }int pp (int a, int b) { int arr(20) ; int i, tot = 1, ex, len; ex = a; len = tob (b,arr) ; for (i=0; i<len; i++) { if (arr[i] ==1) tot = tot * ex; ex = ex * ex; } return (tot) ; }

 

The value returned by pp (3, 4) is ______.

59

Consider a graph G = (V, E), where V = {v1, v2, …, v100}, E = {(vi, vj)|1≤ i < j ≤ 100}, and weight of the edge (vi, vj) is |i - j|. The weight of minimum spanning tree of G is ______.

60

Consider the following set of processes, assumed to have arrived at time 0. Consider the CPU scheduling algorithms Shortest Job First (SJF) and Round Robin (RR). For RR, assume that the processes are scheduled in the order P1, P2, P3, P4.

ProcessesP1P2P3P4
Burst time (in ms)8724

 

If the time quantum for RR is 4 ms, then the absolute value of the difference between the average turnaround times (in ms) of SJF and RR (round off to 2 decimal places) is ______.

61

Consider the following language.

L = {x ϵ {a, b}*| number of a’s in x is divisible by 2 but not divisible by 3}

The minimum number of states in a DFA that accepts L is ______.

62

Graph G is obtained by adding vertex s to K3,4 and making s adjacent to every vertex of K3,4. The minimum number of colours required to edge-colour G is ______.

63

Consider a paging system that uses 1-level page table residing in main memory and a TLB for address translation. Each main memory access takes 100 ns and TLB lookup takes 20 ns. Each page transfer to/from the disk takes 5000 ns. Assume that the TLB hit ratio is 95%, page fault rate is 10%. Assume that for 20% of the total page faults, a dirty page has to be written back to disk before the required page is read in from disk. TLB update time is negligible. The average memory access time in ns (round off to 1 decimal places) is ______.

64

Consider a database implemented using B+ tree for file indexing and installed on a disk drive with block size of 4 KB. The size of search key is 12 bytes and the size of tree/disk pointer is 8 bytes. Assume that the database has one million records. Also assume that no node of the B+ tree and no records are present initially in main memory. Consider that each record fits into one disk block. The minimum number of disk accesses required to retrieve any record in the database

is ______.

65

​Consider a TCP connection between a client and a server with the following specifications: the round trip time is 6 ms, the size of the receiver advertised window is 50 KB, slow-start threshold at the client is 32 KB, and the maximum segment size is 2 KB. The connection is established at time t = 0. Assume that there are no timeouts and errors during transmission. Then the size of the congestion window (in KB) at time t + 60 ms after all acknowledgements are processed is ______.

Attempt this paper under real exam conditions

Timed interface, section switching, instant scoring, and question-by-question analytics — free.

Start Timed Attempt