Official Paper

GATE CS 2018 Official Paper (Previous Year Paper)

65 questions · 180 minutes · with answers · free

General Aptitude (10 questions)

1

“From where are they bringing their books? ________ bringing _______ books from _____.”

The words that best fill the blanks in the above sentence are

  1. ((a))

    Their, they’re, there

  2. ((b))

    They’re, their, there

  3. ((c))

    There, their, they’re

  4. ((d))

    They’re, there, there

Show Answer
Answer: ((b))

They’re, their, there

They’re  is a contraction of the words they and are.

They used to refer to two or more people or things previously mentioned.

Their is the possessive case of the pronoun they, meaning belonging to them.

There is an adverb that means in or at that place.

Hence option 2 is the correct answer

2

“A _____ investigation can sometimes yield new facts, but typically organized ones are more successful.”

The word that best fills the blank in the above sentence is

  1. ((a))

    meandering

  2. ((b))

    timely

  3. ((c))

    consistent

  4. ((d))

    systematic

Show Answer
Answer: ((a))

meandering

  • Meandering (as adjective) means "proceeding in a convoluted or undirected fashion."
  • Timely (as adjective) means "done or occurring at a favorable or useful time."
  • Consistent (as adjective) means "acting or done in the same way over time, especially so as to be fair or accurate."
  • Systematic (as adjective) means "done or acting according to a fixed plan or system; methodical."
<br>

Timely, consistent, and systematic in a way are similar words

Therefore, meandering is the correct answer

3

The area of a square is 𝑑. What is the area of the circle which has the diagonal of the square as its diameter?

  1. ((a))

    πd

  2. ((b))

    πd2

  3. ((c))

    ¼ πd2

  4. ((d))

    ½ πd

Show Answer
Answer: ((d))

½ πd

Data:

let x, y, r be the side diagonal and radius of a square respectively.

Area of square (A) = d

Diagram:

Formula:

y2=r\frac{y}{2} =r

Area of square (A) = x2

Using Pythagorus Theorem;

y2 = 2x2 

Calculation:

Area of circle = π × r2 

A=π×y24A = \pi \times\frac{y^2}{4}

d = x2

∴ y2 = 2d

A=π×2d4=12πdA = \pi \times\frac{2d}{4} =\frac{1}{2} \pi d

Hence option 4 is correct

4

What would be the smallest natural number which when divided either by 20 or by 42 or by 76 leaves a remainder of 7 in each case?

  1. ((a))

    3047

  2. ((b))

    6047

  3. ((c))

    7987

  4. ((d))

    63847

Show Answer
Answer: ((c))

7987

30473047mod20 = 73047mod42 = 233047mod76 = 7
60476047mod20 = 76047mod42 = 416047mod76 = 43
79877987mod20 = 77987mod42 = 77987mod76 = 7
6384763847mod20 = 763847mod42 = 763847mod76 = 7

 

Among the option, 7987 is the smallest number which when divided either by 20 or by 42 or by 76 leaves a remainder of 7 in each case

5

What is the missing number in the following sequence?

2, 12, 60, 240, 720, 1440, _____, 0

  1. ((a))

    2880

  2. ((b))

    1440

  3. ((c))

    720

  4. ((d))

    0

Show Answer
Answer: ((b))

1440

SequenceLogicNext number in sequence
22 × 612
1212 × 560
6060 × 4240
240240 × 3720
720720 × 21440
14401440 × 11440
14401440 × 00
6

In appreciation of the social improvements completed in a town, a wealthy philanthropist decided to gift Rs. 750 to each male senior citizen in the town and Rs. 1000 to each female senior citizen. Altogether, there were 300 senior citizens eligible for this gift. However, only 8/9th of the eligible men and 2/3rd of the eligible women claimed the gift. How much money (in Rupees) did the philanthropist give away in total?

  1. ((a))

    1,50,000

  2. ((b))

    2,00,000

  3. ((c))

    1,75,000

  4. ((d))

    1,51,000

Show Answer
Answer: ((b))

2,00,000

Let the number of senior male citizen be x and the number of senior males be y.

Also, each senior male citizen gets Rs. 750 while each senior female citizen gets Rs. 1000

Since only 8/9th of the eligible men and 2/3rd of the eligible women claimed the gift

By given condition:

x + y = 300

cost of the gift = x×750×89+y×1000×23 x\times 750\times \frac{8}{9}+y\times 1000\times \frac{2}{3}~

=20003×(x+y)=20003×300=200000=\frac{2000}{3}\times \left( x+y \right)=\frac{2000}{3}\times 300=200000

Therefore, the cost of gift is Rs. 2,00,000

7

If pqr ≠ 0 and \({{p}^{-x}}=\frac{1}{q},{{q}^{-y}}=\frac{1}{r}\text{ }!!!!\text{ },\text{ }!!!!\text{ }{{r}^{-z}}=\frac{1}{p}\text{ }!!!!\text{ },\text{ }!!!!\text{ }\)What is the value of the product of xyz?

  1. ((a))

    -1

  2. ((b))

    1pqr\frac{1}{pqr}

  3. ((c))

    1

  4. ((d))

    pqr

Show Answer
Answer: ((c))

1

Formula:

log(a×b)=loga+logb\log \left( a\times b \right)=loga+logb

log(ab)=logalogb \log \left( \frac{a}{b} \right)=\log a-logb~

logaa=1{{\log }_{a}}a=1

Calculation:

px=1qp^{-x} = \frac{1}{q}

Take logp on both sides

– x = – logpq

∴ x = logpq

qy=1r{{q}^{-y}}=\frac{1}{r}

Take logq on both sides

– y = – logqr

y = logqr

rz=1p{{r}^{-z}}=\frac{1}{p}

Take logr on both sides

– r = – logrp

r = logrp

xyz = logpq × logqr × logrp

xyz = logpqr(qrp) = logpqr(pqr) = 1

value of the product of xyz is 1.

8

In a party, 60% of the invited guests are male and 40% are female. If 80% of the invited guests attended the party and if all the invited female guests attended, what would be the ratio of males to females among the attendees in the party?

  1. ((a))

    2 : 3

  2. ((b))

    1 : 1

  3. ((c))

    3 : 2

  4. ((d))

    2 : 1

Show Answer
Answer: ((b))

1 : 1

Let the total number of guests be 100

Male invited guest = 60% of 100 = 60

Female invited guest = 40% of 100 = 40

Guests attended the party = 80% of 100 = 80

All females invited female attended the party

Therefore Male attended the party = 80 – 40 = 40

The ration of males to females attends the party = 4040=1:1\frac{40}{40}=1:1

Therefore, the ratio of males to females among the attendees at the party is 1:1

9

In the figure below, ∠DEC + ∠BFC is equal to _________.

  1. ((a))

    ∠BCD − ∠BAD 

  2. ((b))

    ∠BAD + ∠BCF

  3. ((c))

    ∠BAD + ∠BCD

  4. ((d))

    ∠CBA + ∠ADC

Show Answer
Answer: ((a))

∠BCD − ∠BAD 

Property:

The sum of the interior angle of a triangle is 1800.

The sum of the interior angle of a quadrilateral is 360o.

Diagram:

Calculation:

In Δ EAB,

 a + b + e = 180 (i)

In Δ FAD,

a + d + f = 180 (ii)

Adding i and ii

2a + b + d + e + f = 360 (iii)

In □ ABCD

a + b + c + d = 360 (iv)

From (iii) and (iv)

2a + b + d + e + f = a + b + c + d

e + f = c – a

∴ ∠ DEC + ∠ BFC = ∠ BCD – ∠ BAD

Hence option 1 is correct

10

A six-sided unbiased die with four green faces and two red faces is rolled seven times. Which of the following combinations is the most likely outcome of the experiment?

  1. ((a))

    Three green faces and four red faces.

  2. ((b))

    Four green faces and three red faces.

  3. ((c))

    Five green faces and two red faces.

  4. ((d))

    Six green faces and one red face.

Show Answer
Answer: ((c))

Five green faces and two red faces.

Probability of getting green faces = 46=23\frac{4}{6} = \frac{2}{3}

Probability of getting red faces = 26=13\frac{2}{6} = \frac{1}{3}

Probability of getting 3 green faces and 4 red faces

P(3G,4R)= 7C3(23)3(13)4=35×2337 P(3G,4R)=\ _{}^7{C_3}({\frac{2}{3}})^3(\frac{1}{3})^4 = 35 \times\frac{2^3}{3^7}

Probability of getting 4 green faces and 3 red faces

P(4G,3R)=7C4(23)4(13)3=35×2437P(4G,3R)={}^7{C_4}({\frac{2}{3}})^4(\frac{1}{3})^3 = 35 \times\frac{2^4}{3^7}

Probability of getting 5 green faces and two red faces

P(5G,2R)=7C5(23)5(13)2=21×2537=42×2437P(5G,2R)={}^7{C_5}({\frac{2}{3}})^5(\frac{1}{3})^2 = 21 \times\frac{2^5}{3^7}= 42 \times \frac{2^4}{3^7}

Probability of getting 6 green faces and one red faces

P(6G,1R)=7C6(23)6(13)1=7×2637=28×2437P(6G,1R)={}^7{C_6}({\frac{2}{3}})^6(\frac{1}{3})^1 = 7 \times\frac{2^6}{3^7}= 28 \times \frac{2^4}{3^7}

Probability of getting 5 green faces and 2 red faces is the highest

Hence option 3 is correct

Computer Science and Information Technology (55 questions)

11

Which one of the following is a closed form expression for the generating function of the sequence {an}, where an = 2n + 3 for all n = 0, 1, 2, …. ?

  1. ((a))

    3/(1x)23/(1-x)^2

  2. ((b))

    3x/(1x)23x/(1-x)^2

  3. ((c))

    (2x)/(1x)2(2-x)/(1-x)^2

  4. ((d))

    (3x)/(1x)2(3-x)/(1-x)^2

Show Answer
Answer: ((d))

(3x)/(1x)2(3-x)/(1-x)^2

Given: an = 2n + 3

G(n) = \(∑{n=0}^∝a_n n^n = ∑{n=0}^∝2n(n^n )+3(n^n ) \)

= 2 (0 + n + 2n2 + 3n3 + …………..)

  • 3 (1 + n + n2 + n3 ……….....)

Also (1 – n) –1 = 1 + n + n2 + n3 …………………

(1 – n) –2 = 1 + 2n + 3n2 + 4n3 + ………………….

G(x) = 2×x/(1x)2+3×1/(1x)2\times x/(1-x)^2 +3\times1/(1-x)

= (3x)/(1x)2(3-x)/(1-x)^2

12

Consider the following C program.

include<stdio.h>

struct Ournode {

        char x, y, z ;

} ;

int main ( ) {

        struct Ournode p = {‘1’, ‘0’, ‘a’ + 2} ;

        struct Ournode *q = &p;

        printf (“%c, %c”, ( (char) q + 1) , ( (char) q + 2) ) ;

        return 0 ;

}

 

The output of this program is:

  1. ((a))

    0, c

  2. ((b))

    0, a + 2

  3. ((c))

    ‘0’, ‘a + 2’

  4. ((d))

    ‘0’, ‘c’

Show Answer
Answer: ((a))

0, c

Character ‘a’ has ASCII value 97, adding 2 will result in 99, which is the ASCII value for ‘c’.

Hence dereferencing q + 1 and q + 2 will give 0 and c respectively.

char x = 'a' + 2, that is, x == 'c'

So, p={'1','0','c'};

((char)q+1) = *(address of data '1' + 1) = *(address of data '0')  = 0; 

((char)q + 2) = *(address of data '1' + 2) = *(address of data 'c')  = c;

printf("%c, %c",((char)q+1),((char)q+2)) will print 0, c.

13

A queue is implemented using a non-circular singly linked list. The queue has a head pointer and a tail pointer, as shown in the figure. Let n denote the number of nodes in the queue. Let enqueue be implemented by inserting a new node at the head, and dequeue be

implemented by deletion of a node from the tail.

Which one of the following is the time complexity of the most time-efficient implementation of enqueue and dequeue, respectively, for this data structure?

  1. ((a))

    θ(1), θ(1)

  2. ((b))

    θ(1), θ(n)

  3. ((c))

    θ(n), θ(1)

  4. ((d))

    θ(n), θ(n)

Show Answer
Answer: ((b))

θ(1), θ(n)

Enquene: Inserting new node in front.

next =  Head

Head = P

Hence two-pointer operations will take O(1) time.

Dequeue:

As the list is singly linked, we have to traverse up to the second last node for pointer manipulation, which will take O(n) time.

Enqueue:

Create a Node P.

P-->Data = Data

P-->Next = Head

Head = P

Complexity = Only pointer manipulatuon so constant = O(1)

Dequeue:temp = head;

 While( temp-Next-->Next != NULL)

{       

 temp = temp-Next;       

 }

temp-->next = NULL;

Tail = temp;

Complexity = Traversing list and then free last node and keep track of Tail pointer = O(n)

14

Let ⊕ and ⊙ denote the Exclusive OR and Exclusive NOR operations, respectively.

Which one of the following is NOT CORRECT?

  1. ((a))

    (PQ)=PQ\overline{{(P⊕Q)}} =P⊙Q

  2. ((b))

    PˉQ=PQ\bar P⊕Q=P⊙Q

  3. ((c))

    PˉQˉ=PQ\bar P ⊕\bar Q =P⊕Q

  4. ((d))

    (PPˉ)Q=(PPˉ)Qˉ(P⊕\bar P)⊕Q=(P⊙\bar P)⊙\bar Q

Show Answer
Answer: ((d))

(PPˉ)Q=(PPˉ)Qˉ(P⊕\bar P)⊕Q=(P⊙\bar P)⊙\bar Q

The correct answer is option 4

Calculation:

LHS = (P ⊕ P̅) ⊕ Q=1 ⊕ Q=Q̅

RHS = (P ⊙ P̅) ⊙ Q̅= 0 ⊙ Q̅ =Q

Hence LHS is not equal to RHS in option 4

15

Consider the following processor design characteristics.

I. Register-to-register arithmetic operations only

II. Fixed-length instruction format

III. Hardwired control unit

Which of the characteristics above are used in the design of a RISC processor?

  1. ((a))

    I and II only

  2. ((b))

    II and III only

  3. ((c))

    I and III only

  4. ((d))

    I, II and III

Show Answer
Answer: ((d))

I, II and III

The correct answer is option 4.

Key Points

  • Instructions length cannot vary in RISC usually it's 32 bit. For CISC it can be between 16 to 64 bits.
  • The hardwired control unit is used when the number and size of instructions are fixed to increase processing speed.
  • Register to register operations is always possible in RISC.
  • CISC can have memory to memory and memory to register instructions also.
16

Let be an NFA with n states. Let k be the number of states of a minimal DFA which is equivalent to N. Which one of the following is necessarily true?

  1. ((a))

    k ≥ 2n

  2. ((b))

    k ≥ n

  3. ((c))

    k ≤ n2

  4. ((d))

    k ≤ 2n

Show Answer
Answer: ((d))

k ≤ 2n

A state in a DFA will be a subset of the set of states of the equivalent NFA. So, the maximum number of states in the equivalent DFA of an NFA, will be 2*n, where n is the number of states in NFA, as a set with n items has maximum 2n* subsets.

17

The set of all recursively enumerable languages is

  1. ((a))

    closed under complementation.

  2. ((b))

    closed under intersection.

  3. ((c))

    a subset of the set of all recursive languages.

  4. ((d))

    an uncountable set

Show Answer
Answer: ((b))

closed under intersection.

C is false as the set of all recursively enumerable languages (semi-decidable) is a STRICT super set of the set of all recursive languages (decidable).

D is false as the set of all recursively enumerable languages (set of all Turing machines) is an infinite but countable set.

18

The following are some events that occur after a device controller issues an interrupt while process L is under execution?

(P) The processor pushes the process status onto the control stack.

(Q) The processor finishes the execution of the current instruction.

(R) The processor executes the interrupt service routine.

(S) The processor pops the process status of from the control stack.

(T) The processor loads the new PC value based on the interrupt.

Which one of the following is the correct order in which the events above occur?

  1. ((a))

    QPTRS

  2. ((b))

    PTRSQ

  3. ((c))

    TRPQS

  4. ((d))

    QTPRS

Show Answer
Answer: ((a))

QPTRS

Whenever an interrupt occurs, CPU first finishes the current instruction before saving process status into the control stack and calling ISR.

After servicing the ISR processor resumes from same state using process status saved on the top of the stack.

19

Consider a process executing on an operating system that uses demand paging. The average time for a memory access in the system is M units if the corresponding memory page is available in memory, and D units if the memory access causes a page fault. It has been experimental measured that the average time taken for a memory access in the process is X units.

Which one of the following is the correct expression for the page fault rate experienced by the process?

  1. ((a))

    (D - M) / (X - M)

  2. ((b))

    (X - M) / (D - M)

  3. ((c))

    (D - X) / (D - M)

  4. ((d))

    (X - M) / (D - X)

Show Answer
Answer: ((b))

(X - M) / (D - M)

Let P be the page fault rate.

Average memory access time = ( 1 - page fault rate) × memory access time when no page fault  +  Page fault rate × Memory access time when page fault.

X = (1 - P) × M + P × D

∴X = M - PM + PD

X - M = P(D - M )

P = (X - M)/( D - M)

20

In an Entity-Relationship (ER) model, suppose 𝑅 is a many-to-one relationship from entity set E1 to entity set E2. Assume that E1 and E2 participate totally in 𝑅 and that the cardinality of E1 is greater than the cardinality of E2.

Which one of the following is true about 𝑅?

  1. ((a))

    Every entity in E1 is associated with exactly one entity in E2.

  2. ((b))

    Some entity in E1 is associated with more than one entity in E2.

  3. ((c))

    Every entity in E2 is associated with exactly one entity in E1.

  4. ((d))

    Every entity in E2 is associated with at most one entity in E1.

Show Answer
Answer: ((a))

Every entity in E1 is associated with exactly one entity in E2.

As the number of entries in E1 is greater than the number of entries in E2

As participation is total,

R is an onto function from E1 to E2

As participation of both the entity sets is total and number of entries in E1 is greater than E2, R is an onto function.

: :  Partial/Optional participation

: : Total/Mandatory participation or Existence dependency

21

Consider the following two tables and four queries in SQL.

Book (isbn, bname), Stock (isbn, copies)

Query 1: SELECT B.isbn, S.copies

FROM Book B INNER JOIN Stock S

ON B.isbn = S.isbn;

 

Query 2: SELECT B.isbn, S.copies

FROM Book B LEFT OUTER JOIN Stock S

ON B.isbn = S.isbn;

Query 3: SELECT B.isbn, S.copies

FROM Book B RIGHT OUTER JOIN Stock S

ON B.isbn = S.isbn;

 

Query 4: SELECT B.isbn, S.copies

FROM Book B FULL OUTER JOIN Stock S

ON B.isbn = S.isbn;

 

Which one of the queries above is certain to have an output that is a superset of the outputs

of the other three queries?

  1. ((a))

    Query 1

  2. ((b))

    Query 2

  3. ((c))

    Query 3

  4. ((d))

    Query 4

Show Answer
Answer: ((d))

Query 4

The FULL OUTER JOIN keyword return all records when there is a match in either left (table1) or right (table2) table records.

Hence it will return the superset of result produced by all other operations.

22

Match the following:

FieldLength in bits
P. UDP Header’s Port NumberI. 48
Q. Ethernet MAC AddressII. 8
R. IPv6 Next HeaderIII. 32
S. TCP Header’s Sequence NumberIV. 16
  1. ((a))

    P-III, Q-IV, R-II, S-I

  2. ((b))

    P-II, Q-I, R-IV, S-III

  3. ((c))

    P-IV, Q-I, R-II, S-III

  4. ((d))

    P-IV, Q-I, R-III, S-II

Show Answer
Answer: ((c))

P-IV, Q-I, R-II, S-III

UDP header - 16 bits

MAC address: 48 bits

IPv6 next header: 8 bits

TCP Sequence No.: 32 bits

Additional Information

  • UDP Header’s Port Number - IV. 16: The source port and destination port fields in the UDP (User Datagram Protocol) header are each 16 bits in length. Therefore, UDP's port number, either source or destination, is 16 bits long.
  • Ethernet MAC Address - I. 48: A MAC (Media Access Control) address, also known as physical address, is used to identify devices at the data link layer level in a network. Ethernet MAC addresses are universally unique and each one is 48 bits in length.
  • IPv6 Next Header - II. 8: In the IPv6 (Internet Protocol version 6) packet header, the Next Header field is used to indicate the type of the next payload (like TCP, UDP, ICMPv6 etc.) after the IPv6 header. This field is 8 bits in length.
  • TCP Header’s Sequence Number - III. 32: The sequence number field in the TCP (Transmission Control Protocol) header is 32 bits in length. It's used in order for the receiving TCP to reassemble the segment to ensure reliable, in-order delivery of data.
23

Consider the following statements regarding the slow start phase of the TCP congestion

control algorithm. Note that cwnd stands for the TCP congestion window and MSS denotes

the Maximum Segment Size.

(i) The cwnd increases by 2 MSS on every successful acknowledgment.

(ii) The cwnd approximately doubles on every successful acknowledgement.

(iii) The cwnd increases by 1 MSS every round trip time.

(iv) The cwnd approximately doubles every round trip time.

Which one of the following is correct?

  1. ((a))

    Only (ii) and (iii) are true

  2. ((b))

    Only (i) and (iii) are true

  3. ((c))

    Only (iv) is true

  4. ((d))

    Only (i) and (iv) are true

Show Answer
Answer: ((c))

Only (iv) is true

(i) FALSE: The cnwd increases by 1MSS on every successful acknowledgement.

(ii) FALSE: The cwnd does not always double.

(iii) FALSE: The cnwd increases exponentially on every RTT.

(iv) TRUE:  The cnwd increases exponentially on every RTT hence it almost doubles.

24

Which one of the following statements is FALSE?

  1. ((a))

    Context-free grammar can be used to specify both lexical and syntax rules.

  2. ((b))

    Type checking is done before parsing.

  3. ((c))

    High-level language programs can be translated to different Intermediate representations.

  4. ((d))

    Arguments to a function can be passed using the program stack.

Show Answer
Answer: ((b))

Type checking is done before parsing.

(A)TRUE: Since Lexical rules are nothing but regular expressions, we can use CFGs to represent such rules.(Every Type-3 grammar is Type-2 grammar) Additionally syntax rules can be represented by CFGs.

(B).FALSE: Type checking is done during Semantic Analysis phase which comes after Parsing.

(C).TRUE: We have various types of Intermediate Code Representations, ex 3-address code, Postfix notation, Syntax trees.

(D). TRUE: Program stack holds the activation record of the function called, which stores function parameters, return value, return address etc.

25

Two people, P and Q, decide to independently roll two identical dice, each with 6 faces, numbered 1 to 6. The person with the lower number wins. In case of a tie, they roll the dice repeatedly until there is no tie. Define a trial as a throw of the dice by P and Q. Assume that all 6 numbers on each dice are equi-probable and that all trials are independent. The probability (rounded to 3 decimal places) that one of them wins on the third trial is _____.

26

The value of 0(π/4)xcos(x2)dx∫_0^{(\pi /4)}x cos (x^2) dx correct to three decimal places (assuming that 𝜋 = 3.14 ) is _____.

27

Consider a matrix A = uvT where  u=(21), v=(11)u=(^1_2) ,\ v=(^1_1).Note that vT denotes the transpose of v. The largest eigenvalue of A is ________.

28

The chromatic number of the following graph is _______.

29

Let G be a finite group on 84 elements. The size of a largest possible proper subgroup of G is ________.

30

The postorder traversal of a binary tree is 8,9,6,7,4,5,2,3,1. The inorder traversal of the same tree is 8,6,9,4,7,2,5,1,3. The height of a tree is the length of the longest path from the root to any leaf. The height of the binary tree above is ______.

31

Consider the following C program:

include <stdio.h>

int counter = 0 ;

int calc (int a, int b) {

int c;

counter++;

if (b==3) return (aaa) ;

else {

c = calc (a, b/3) ;

return (ccc) ;

}

}

int main ( ) {

      calc (4, 81) ;

      printf (“%d” , counter) ;

}

The output of this program is: ________ .

32

Consider the sequential circuit shown in the figure, where both flip-flops used are positive edge-triggered D flip-flops.

The number of states in the state transition diagram of this circuit that have a transition back

to the same state on some value of “in” is _____.

33

A 32-bit wide main memory unit with a capacity of 1 GB is built using 256M × 4-bit DRAM chips. The number of rows of memory cells in the DRAM chip is 214. The time taken to perform one refresh operation is 50 nanoseconds. The refresh period is 2 milliseconds. The percentage (rounded to the closest integer) of the time available for performing the memory read/write operations in the main memory unit is __________.

34

Consider a system with 3 processes that share 4 instances of the same resource type. Each process can request a maximum of K instances. Resource instances can be requested and released only one at a time. The largest value of K that will always avoid deadlock is ____.

35

Consider a long-lived TCP session with an end-to-end bandwidth of 1 Gbps (= 109 bits-per-second). The session starts with a sequence number of 1234. The minimum time (in seconds, rounded to the closest integer) before this sequence number can be used again is _______.

36

Consider a matrix P whose only eigenvectors are the multiples of \(\left[ {\begin{array}{*{20}{c}} 1\ 4 \end{array}} \right]\).

Consider the following statements. 

(I) P does not have an inverse

(II) P has a repeated eigenvalue

(III) P cannot be diagonalized

Which one of the following options is correct?

  1. ((a))

    Only I and III are necessarily true

  2. ((b))

    Only II is necessarily true

  3. ((c))

    Only I and II are necessarily true

  4. ((d))

    Only II and III are necessarily true

Show Answer
Answer: ((d))

Only II and III are necessarily true

As eigen vectors are multiples of \(\left[ {\begin{array}{*{20}{c}} 1\ 4 \end{array}} \right]\) hence P does have repeated eigen values.

Also a matrix is diagonalizable if it has distinct eigen values.

37

Let N be the set of natural numbers. Consider the following sets.

P: Set of Rational numbers (positive and negative)

Q: Set of functions from {0, 1} to N

R: Set of functions from N to {0, 1}

S: Set of finite subsets of N.

Which of the sets above are countable?

  1. ((a))

    Q and S only

  2. ((b))

    P and S only

  3. ((c))

    P and R only

  4. ((d))

    P, Q and S only

Show Answer
Answer: ((d))

P, Q and S only

Set of rational numbers are countable.

Set of functions from {0, 1} to N is also countable.

Set of functions from N to {0, 1} is equal to number of subsets of N which is uncountable using Cantor's diagonalization argument.

Set of finite subsets of N has bijection with N.

38

Consider the following C program:

#include<stdio.h>

void fun1 (char *s1, char *s2) {

          char *tmp ;

          tmp = s1 ;

          s1 = s2 ;

          s2 = tmp ;

}

void fun2 (char **s1, char **s2) {

          char *tmp ;

          tmp = * s1 ;

          * s1 = * s2 ;

          * s2 = tmp ;

}

int main ( ) {

          char *str1 = “Hi”, *str2 = “Bye” ;

          fun1 (str1, str2) ;            printf (“%s  %s  “,    str1,  str2) ;

          fun2 (&str1, &str2) ;      printf (“%s %s “,   str1, str2) ;

          return 0 ;

}

The output of the program above is

  1. ((a))

    Hi Bye Bye Hi

  2. ((b))

    Hi Bye Hi Bye

  3. ((c))

    Bye Hi Hi Bye

  4. ((d))

    Bye Hi Bye Hi

Show Answer
Answer: ((a))

Hi Bye Bye Hi

The first call to the function 'func1(str1,str2); is Call by Value. Hence, any change in the formal parameters will not be reflected in actual parameters. Hence, str1 points at "hi" and str2 points at "bye".

The second call to the function 'func2(&str1,&str2);' is Call by Reference. Hence, any change in the formal parameters are reflected in actual parameters. Hence, str1 now points at "bye" and str2 points at "hi". Hence, answer is hi bye bye hi.

39

Let G be a simple undirected graph. Let TD be a depth first search tree of G. Let TB be a breadth first search tree of G. Consider the following statements.

(I) No edge of G is a cross edge with respect to TD. (A cross edge in G is between two nodes neither of which is an ancestor of the other in TD .)

(II) For every edge (u, v) of if u is at depth i and v is at depth j in TB , then |𝑖 − 𝑗| = 1.

Which of the statements above must necessarily be true?

  1. ((a))

    I only

  2. ((b))

    II only

  3. ((c))

    Both I and II

  4. ((d))

    Neither I nor II

Show Answer
Answer: ((a))

I only

Undirected graph cant have cross edges in DFS forest. Hence statement 1 is TRUE.

Using triangle graph we can counter the second statement.

40

Assume that multiplying a matrix G1 of dimension 𝑝 × 𝑞 with another matrix G2 of dimension 𝑞 × 𝑟 requires 𝑝𝑞𝑟 scalar multiplications. Computing the product of n matrices G1G2G3…Gn can be done by parenthesizing in different ways. Define Gi Gi+1 as an explicitly computed pair for a given paranthesization if they are directly multiplied. For example, in the matrix multiplication chain G1G2G3G4G5G6 using parenthesization (G1(G2G3))(G4(G5G6)), G2G3 and G5G6 are the only explicitly computed pairs.Consider a matrix multiplication chain F1F2F3F4F5, where matrices F1, F2, F3, F4 and F5 are of dimensions 2 × 25, 25 × 3, 3 × 16, 16 × 1 and 1 × 1000, respectively. In the parenthesization of F1F2F3F4F5 that minimizes the total number of scalar multiplications, the explicitly computed pairs is/are

  1. ((a))

    F1F2 and F3F4 only

  2. ((b))

    F2F3 only

  3. ((c))

    F3F4 only

  4. ((d))

    F1F2 and F4F5 only

Show Answer
Answer: ((c))

F3F4 only

As F5 is 1∗1000 matrix so 1000 will play vital role in cost. So it is good to multiply F5 at very last step.So, the sequence giving minimal cost: (((F1(F2(F3F4))(F5)) = 48+75+50+2000 = 2173

Explicitly computed pairs is (F3F4).

41

Consider the following C code. Assume that unsigned long int type length is 64 bits.

unsigned long int fun (unsigned long int n) {

unsigned long int i, j = 0, sum = 0 ;

for (i = n; i > 1 ; i = i/2)

j++ ;

for ( ; j > 1 ; j = j/2)

sum++ ;

return (sum) ;

}

The value returned when we call fun with the input 240 is

  1. ((a))

    4

  2. ((b))

    5

  3. ((c))

    6

  4. ((d))

    40

Show Answer
Answer: ((b))

5

First for loop makes j = 40.

Next for loop will divide j value by 2 every time unless j <=1. ​​​​​ starts:

Loop begins:

j = 40 and sum =1,

j = 20 and sum=2,

j = 10 and sum=3,

j = 5 and sum=4,

j = 2 and sum=5,

j=1 Loop ends.

42

Consider the first-order logic sentence 𝜑 ≡ ∃𝑠∃𝑡∃𝑢∀𝑣∀𝑤∀𝑥∀𝑦 𝜓(𝑠, 𝑡, 𝑢, 𝑣, 𝑤, 𝑥, 𝑦) where 𝜓(𝑠, 𝑡, 𝑢, 𝑣, 𝑤, 𝑥, 𝑦) is a quantifier-free first-order logic formula using only predicate symbols, and possibly equality, but no function symbols. Suppose 𝜑 has a model with a universe containing 7 elements.

  1. ((a))

    There exists at least one model of 𝜑 with universe of size less than or equal to 3.

  2. ((b))

    There exists no model of 𝜑 with universe of size less than or equal to 3.

  3. ((c))

    There exists no model of 𝜑 with universe of size greater than 7

  4. ((d))

    Every model of 𝜑 has a universe of size equal to 7

Show Answer
Answer: ((a))

There exists at least one model of 𝜑 with universe of size less than or equal to 3.

∀ are always True and ∃ are always False for empty sets. So, there exists at least one model with universe of size 3 (or less than).

Therefore, option 1 is necessarily TRUE.

Important Points:

∀ → for all

∃ → there exists

43

Consider the unsigned 8-bit fixed-point binary number representation below, b7 b6 b5 b4 b3 . b2 b1 b0 where the position of the binary point is between b3 and b2. Assume b7 is the most significant bit. Some of the decimal numbers listed below cannot be represented exactly in the above representation:

(i) 31.500 (ii) 0.875 (iii) 12.100 (iv) 3.001

Which one of the following statements is true?

  1. ((a))

    None of (i), (ii), (iii), (iv) can be exactly represented

  2. ((b))

    Only (ii) cannot be exactly represented

  3. ((c))

    Only (iii) and (iv) cannot be exactly represented

  4. ((d))

    Only (i) and (ii) cannot be exactly represented

Show Answer
Answer: ((c))

Only (iii) and (iv) cannot be exactly represented

The correct answer is option 3.

Concept:

Fixed-point number representation:

A real data type for a number is a fixed-point number representation. Data is translated into the binary form using fixed number representation, and then processed, stored, and utilized by the system.

(i) 31.500:

(31.5)10 = (11111.100)2

 =24 + 23+22 + 21 + 20 + 2-1 = 16 + 8 + 4 + 2 + 1 + 0.5 = (31.05)10

(ii) 0.875:

(0.875)10 = (00000.111)2

=2-1 + 2-2+ 2-3 = 0.50 + 0.25 + 0.125 = (0.875)10

(iii) 12.100:

(12.100)10=(1100.00011)2 we can not represent exactly in the above representation.

(iv) 3.001:

(3.001)10=(11.0000000001000)2 we can not represent exactly in the above representation.

Hence the correct answer is Only (iii) and (iv) cannot be exactly represented.

44

The size of the physical address space of a processor is 2𝑃 bytes. The word length is 2𝑊 bytes. The capacity of cache memory is 2𝑁 bytes. The size of each cache block is 2𝑀 words. For a 𝐾-way set-associative cache memory, the length (in number of bits) of the tag field is

  1. ((a))

    P – N – log2K

  2. ((b))

    P – N + log2K

  3. ((c))

    P – N – M – W – log2K

  4. ((d))

    P – N – M – W + log2K

Show Answer
Answer: ((b))

P – N + log2K

Assume there are x tag bits.

Given Main memory size is 2P, cache size is 2N, block size is 2M, and cache is K way set associative.

=> #tag bits =  N−M−log2K

,Offset bits is M

=> Tag bits = Main memory bits − set bits − offset bits

= P−(N−M−log2K)−M = P – N + log2K

45

Consider the following languages:

I. 𝑎𝑚𝑏𝑛𝑐𝑝𝑑𝑞𝑚+𝑝=𝑛+𝑞,where 𝑚,𝑛,𝑝,𝑞0𝑎^𝑚 𝑏^𝑛𝑐^𝑝𝑑^𝑞| 𝑚 + 𝑝 = 𝑛 + 𝑞, where \text{ 𝑚}, 𝑛, 𝑝, 𝑞 ≥ 0

II. 𝑎𝑚𝑏𝑛𝑐𝑝𝑑𝑞𝑚=𝑛 and 𝑝=𝑞,where 𝑚,𝑛,𝑝,𝑞0{𝑎^𝑚𝑏^𝑛𝑐^𝑝𝑑^𝑞| 𝑚 = 𝑛 \text{ and } 𝑝 = 𝑞, where \text{ 𝑚}, 𝑛, 𝑝, 𝑞 ≥ 0}

III. 𝑎𝑚𝑏𝑛𝑐𝑝𝑑𝑞𝑚=𝑛=𝑝 and 𝑝𝑞,where 𝑚,𝑛,𝑝,𝑞0𝑎^𝑚𝑏^𝑛𝑐^𝑝𝑑^𝑞| 𝑚 = 𝑛 = 𝑝 \text{ and } 𝑝 ≠ 𝑞, where \text{ 𝑚}, 𝑛, 𝑝, 𝑞 ≥ 0

IV. 𝑎𝑚𝑏𝑛𝑐𝑝𝑑𝑞𝑚𝑛=𝑝+𝑞,where 𝑚,𝑛,𝑝,𝑞0𝑎^𝑚𝑏^𝑛𝑐^𝑝𝑑^𝑞| 𝑚𝑛 = 𝑝 + 𝑞, where \text{ 𝑚}, 𝑛, 𝑝, 𝑞 ≥ 0

Which of the languages above are context-free?

  1. ((a))

    I and IV only

  2. ((b))

    I and II only

  3. ((c))

    II and III only

  4. ((d))

    II and IV only

Show Answer
Answer: ((b))

I and II only

(i) and (ii) can be recognized using a single stack while (iii) has two comparisons hence it will require 2 stacks which means it is not cfl.

(iv) is not cfl because a pda can not do non linear arithmetics.

46

Consider the following problems. L(𝐺) denotes the language generated by a grammar 𝐺. L(𝑀) denotes the language accepted by a machine 𝑀.

(I) For an unrestricted grammar 𝐺 and a string 𝑤, whether 𝑤 ∈ (𝐺)

(II) Given a Turing machine M, whether L(M) is regular

(III) Given two grammars 𝐺1 and 𝐺2, whether (𝐺1) = (𝐺2)

(IV) Given an NFA N, whether there is a deterministic PDA P such that N and P accept the same language.

Which one of the following statements is correct?

  1. ((a))

    Only I and II are undecidable

  2. ((b))

    Only III is undecidable

  3. ((c))

    Only II and IV are undecidable

  4. ((d))

    Only I, II and III are undecidable

Show Answer
Answer: ((d))

Only I, II and III are undecidable

Membership algorithm does not exist for unrestricted grammars.

Regularity problem for TM is undecidable.

Equivalence of Two grammar is undecidable.

Every NFA is a PDA with a finite memory.

47

A lexical analyzer uses the following patterns to recognize three tokens T1, T2, and T3 over the alphabet {a,b,c}.

𝑇1: 𝑎? (𝑏|𝑐)∗𝑎

𝑇2: 𝑏? (𝑎|𝑐)∗𝑏

𝑇3: 𝑐? (𝑏|𝑎)∗𝑐

Note that ‘x?’ means 0 or 1 occurrence of the symbol x. Note also that the analyzer outputs the token that matches the longest possible prefix. If the string 𝑏𝑏𝑎𝑎𝑐𝑎𝑏𝑐 is processed by the analyzer, which one of the following is the sequence of tokens it outputs?

  1. ((a))

    𝑇1𝑇2𝑇3

  2. ((b))

    𝑇1𝑇1𝑇3

  3. ((c))

    𝑇2𝑇1𝑇3

  4. ((d))

    𝑇3𝑇3

Show Answer
Answer: ((d))

𝑇3𝑇3

Concept:

Take relational algebra which generates the longest subsequence.

With  T3 we get a subsequence of 5, and T1 we get a subsequence of only 4, T2 we get a subsequence of only 3.

Hence, T3 preferred over Tand T1

Explanation

String = 𝑏𝑏𝑎𝑎𝑐𝑎𝑏𝑐

(𝑏|𝑎)∗ = (a + b)*

𝑐? = (ϵ + c)

𝑇3: 𝑐? (𝑏|𝑎)∗𝑐

T3 = bbaac (longest prefix match)

T3= abc

𝑇3𝑇3 = 𝑏𝑏𝑎𝑎𝑐 𝑎𝑏𝑐

Therefore option 4 is correct

48

Consider the following parse tree for the expression a # b c c d # e # f, involving two binary operators $ and #.

Which one of the following is correct for the given parse tree?

  1. ((a))

    $ has higher precedence and is left associative; # is right associative.

  2. ((b))

    has higher precedence and is left associative; $ is right associative

  3. ((c))

    $ has higher precedence and is left associative; # is left associative

  4. ((d))

    has higher precedence and is right associative; $ is left associative

Show Answer
Answer: ((a))

$ has higher precedence and is left associative; # is right associative.

Highest Precedence Operator is at the lowest level in the expression tree so that it is evaluated first.

For unambiguous grammar, we can get precedence and associativity directly from production or expression tree.

Left Associativity => Left Linear Grammar or in expression, tree it should expand on left child for the same operator and vice versa.

Here at the lowest level, we have $ so it has the highest precedence.

is right associative and $ is left associative.

49

In a system, there are three types of resources and four processes that execute concurrently. At the outset, the processes have declared their maximum resource requirements using a matrix named Max as given below. For example, Max[ ] is the maximum number of instances of that would require. The number of instances of the resources allocated to the various processes at any given state is given by a matrix named Allocation.

Consider a state of the system with the Allocation matrix as shown below, and in which 3 instances of E and 3 instances of F are the only resources available.

Allocation
EFG
P0101
P1112
P2103
P3200

 

Max
EFG
P0431
P1214
P2133
P3541

 

From the perspective of deadlock avoidance, which one of the following is true?

  1. ((a))

    The system is in safe state.

  2. ((b))

    The system is not in state, but would be if one more instance of E were available

  3. ((c))

    The system is not in safe state, but would be safe if one more instance of F were available

  4. ((d))

    The system is not in state, but would be if one more instance of G were available

Show Answer
Answer: ((a))

The system is in safe state.

Using Banker's algorithm we can deduce that the system is in a safe state. 

The formula to find the required resources for each process = Maximum allocation possible - Already allocated resources.

The requirement of each process is like:

Required
EFG
P0330
P1102
P2030
P3341
Total7103

 

The total number of free resources are more than they need for any process, as a result, the system is in a safe state.

50

Consider the following solution to the producer-consumer synchronization problem. The shared buffer size is 𝑁. Three semaphores empty, full and mutex are defined with respective initial values of 0, 𝑁 and 1. Semaphore empty denotes the number of available slots in the buffer, for the consumer to read from. Semaphore denotes the number of available slots in the buffer, for the producer to write to. The placeholder variables, denoted by P, Q, R, and S, in the code below can be assigned either empty or full. The valid semaphore operations are: wait ( ) and signal ( ).

Producer:Consumer:
do { wait (P) ; wait (mutex) ; //Add item to buffer signal (mutex) ; signal (Q) ; } while (1) ;do { wait (R) ; wait (mutex) ; //Consume item from buffer signal (mutex) ; signal (S) ; } while (1) ;

 

Which one of the following assignments to P, Q, R and S will yield the correct solution?

  1. ((a))

    P: full, Q: full, R: empty, S: empty

  2. ((b))

    P: empty, Q: empty, R: full, S: full

  3. ((c))

    P: full, Q: empty, R: empty, S: full

  4. ((d))

    P: empty, Q: full, R: full, S: empty

Show Answer
Answer: ((c))

P: full, Q: empty, R: empty, S: full

The correct answer is option 3.

Concept:

Given data,

Empty = 0

Full = N

Mutex = 1

Because the value of the empty semaphore is 0, you cannot wait for the empty semaphore on the first try.

Note: 

The number of filled slots is represented by an empty semaphore, therefore the producer process must deal with both empty and mutex semaphores. The number of empty slots in a full semaphore is the same as the number of empty slots in a mutex semaphore, so consumer processes must deal with both full and mutex semaphores.

Option 1: 

It results in starvation. It is starvation is the problem that occurs when high-priority processes keep executing and low priority processes get blocked for an indefinite time. Here Producer and consumer process is not allowed. 

Option 2:

results in starvation. It producer at P condition blocks the process that there are no items to give and R conditions blocks that there is no item to consume because it is already full it means something blocking high-priority processes keep executing and low priority processes get blocked for an indefinite time.

Option 4:

Because the number of filled slots is originally 0 (as indicated by an empty semaphore), the consumer process is unable to consume. As a result, its implementation is flawed.

Option 3: P: full, Q: empty, R: empty, S: full is ensure deadlock-free and starvation-free implementation.

P: full, Q: empty, R: empty, S: full

Empty = 0

Full = N

Mutex = 1

Producer:Consumer:
do { wait (full); wait (mutex); //Add item signal (mutex); signal (empty); } while (1);do { wait (empty); wait (mutex); //Consume item signal (mutex); signal (full); } while (1);

 

 

Hence the correct answer is P: full, Q: empty, R: empty, S: full.

51

Consider the relations r(A, B) and s(B, C), where s*.B is a primary key and r.B is a foreign key referencing s.*B. Consider the query

Q: 𝑟 ⋈ (𝜎𝐵<5(𝑠))

Let LOJ denote the natural left outer-join operation. Assume that r and s contain no null values.

Which one of the following queries is NOT equivalent to Q?

  1. ((a))

    𝜎𝐵<5(𝑟 ⋈ 𝑠)

  2. ((b))

    𝜎𝐵<5(𝑟 𝐿𝑂𝐽 𝑠)

  3. ((c))

    𝑟 𝐿𝑂𝐽 (𝜎𝐵<5(𝑠))

  4. ((d))

    𝜎𝐵<5(𝑟) 𝐿𝑂𝐽 𝑠

Show Answer
Answer: ((c))

𝑟 𝐿𝑂𝐽 (𝜎𝐵<5(𝑠))

𝑟 𝐿𝑂𝐽 (𝜎𝐵<5(𝑠)) will include record with b> = 5 but other three queries will not.

52

Consider the following four relational schemas. For each schema, all non-trivial functional dependencies are listed. The underlined attributes are the respective primary keys.

Schema I:

Field ‘courses’ is a set-valued attribute containing the set of courses a student has

registered for.

Non-trivial functional dependency:

rollno → courses

Schema II:

Non-trivial functional dependencies:

rollno, courseid → email

email → rollno

Schema III:

Non-trivial functional dependencies:

rollno, courseid → marks, grade

marks → grade

Schema IV:

Non-trivial functional dependencies:

rollno, courseid → credit

courseid → credit

Which one of the relational schemas above is in 3NF but not in BCNF?

  1. ((a))

    Schema I

  2. ((b))

    Schema II

  3. ((c))

    Schema III

  4. ((d))

    Schema IV

Show Answer
Answer: ((b))

Schema II

Schema I

Field ‘courses’ is a set-valued attribute containing the set of courses a student has registered for.

Non-trivial functional dependency

rollno → courses

Since rollno is the primary key, so this relation is in BCNF as well as 3 NF.

Schema II

Non-trivial functional dependencies:

rollno, courseid → email

email → rollno

Since, {rollno, coursid} is the primary key so rollno and courseid are prime attributes. email is a non-prime attribute.

Functional dependency (FD) rollno, courseid → email is in BCNF and 3NF, but FD email → rollno violates the rule of BCNF because email is not superkey.

But it satisfies the rule of 3 NF because rollno is prime-attribute.

So, overall this relation is in 3 NF but not in BCNF.

Schema III

Non-trivial functional dependencies:

rollno, courseid, → marks, grade

marks → grade

Since rollno, courseid is the primary key, so rollno and courseid are prime attributes, and marks and grade are non-prime attributes.

FD rollno, courseid, → marks, grade satisfies BCNF as well as 3 NF.

FD marks → grade does not satisfy 3 NF because neither marks are superkey nor grade is prime-attribute. So, also can not be in BCNF.

So, overall this relation is not in 3 NF and not in BCNF but it does not violate the rule of 2 NF, so can be only in 2 NF.

Schema IV

Non-trivial functional dependencies:

rollno, courseid → credit

courseid → credit

Since, rollno, courseid is the primary key, so rollno and courseid are prime-attributes and credit is a non-prime attribute.

FD rollno, courseid → credit satisfies BCNF as well as 3 NF.

FD courseid → credit violates the rule of 2 NF, so can not be in 2NF.

So, overall this is not in 2 NF, 3 NF, and BCNF. But it is only in 1 NF.

Therefore only schema-II is in 3 NF but not in BCNF.

53

Let G be a graph with 100! vertices, with each vertex labelled by a distinct permutation of the numbers 1, 2, … , 100. There is an edge between vertices 𝑢 and 𝑣 if and only if the label of 𝑢 can be obtained by swapping two adjacent numbers in the label of 𝑣. Let 𝑦 denote the degree of a vertex in G, and 𝑧 denote the number of connected components in G.

Then, 𝑦 + 10𝑧 = _____.

54

Consider the following program written in pseudo-code. Assume that x and y are integers.

Count (x,y)  {

          if  (y !=  1) {

                if (x != 1) {

                    print ("*") ;

                    Count (x/2,  y) ;

                }

else {

                      y = y-1;

                      Count (1024,  y) ;

}

        }

}

The number of times that the print statement is executed by the call Count (1024,1024) is _____.

55

Consider Guwahati (G) and Delhi (D) whose temperatures can be classified as high (𝐻), medium (𝑀) and low (𝐿). Let (𝐻𝐺) denote the probability that Guwahati has high temperature. Similarly, (𝑀𝐺) and (𝐿𝐺) denotes the probability of Guwahati having medium and low temperatures respectively. Similarly, we use (𝐻𝐷), (𝑀𝐷) and 𝑃(𝐿𝐷) for Delhi. The following table gives the conditional probabilities for Delhi’s temperature given Guwahati’s temperature.

HDMDLD
HG0.400.480.12
MG0.100.650.25
LG0.010.500.49

Consider the first row in the table above. The first entry denotes that if Guwahati has high temperature (𝐻𝐺) then the probability of Delhi also having a high temperature (𝐻𝐷) is 0.40; i.e., (𝐻𝐷|𝐻𝐺) = 0.40. Similarly, the next two entries are (𝑀𝐷|𝐻𝐺) = 0.48 and (𝐿𝐷|𝐻𝐺) = 0.12. Similarly for the other rows. If it is known that (𝐻𝐺) = 0.2, (𝑀𝐺) = 0.5, and 𝑃(𝐿𝐺) = 0.3, then the probability (correct to two decimal places) that Guwahati has high temperature given that Delhi has high temperature is _______.

56

Consider the following undirected graph G:

Choose a value for x that will maximize the number of minimum weight spanning trees (MWSTs) of G. The number of MWSTs of G for this value of x is ______.

57

Consider the weights and values of items listed below. Note that there is only one unit of each item.

Item numberWeight (in Kgs)Value (in Rupees)
11060
2728
3420
4224

 

The task is to pick a subset of these items such that their total weight is no more than 11 Kgs and their total value is maximized. Moreover, no item may be split. The total value of items picked by an optimal algorithm is denoted by 𝑉opt. A greedy algorithm sorts the items by their value-to-weight ratios in descending order and packs them greedily, starting from the first item in the ordered list. The total value of items picked by the greedy algorithm is denoted by 𝑉greedy.

The value of 𝑉opt − 𝑉greedy is ____________.

58

The number of possible min-heaps containing each value from {1, 2, 3, 4, 5, 6, 7} exactly once is _____.

59

Consider the minterm list form of a Boolean function 𝐹 given below.

F(P,Q,R,S)=m(0,2,5,7,9,11)+d(3,8,10,12,14)F(P,Q,R,S)=∑m(0,2,5,7,9,11)+d(3,8,10,12,14)

Here, 𝑚 denotes a minterm and 𝑑 denotes a don’t care term. The number of essential prime implicants of the function 𝐹 is ______.

60

The instruction pipeline of a RISC processor has the following stages: Instruction Fetch (IF), Instruction Decode (ID), Operand Fetch (OF), Perform Operation (PO) and Writeback (WB). The IF, ID, OF and WB stages take 1 clock cycle each for every instruction. Consider a sequence of 100 instructions. In the PO stage, 40 instructions take 3 clock cycles each, 35 instructions take 2 clock cycles each, and the remaining 25 instructions take 1 clock cycle each. Assume that there are no data hazards and no control hazards.

The number of clock cycles required for completion of execution of the sequence of instructions is ______.

61

A processor has 16 integer registers (R0, R1, .. , R15) and 64 floating point registers (F0, F1,… , F63). It uses a 2-byte instruction format. There are four categories of instructions: Type-1, Type-2, Type-3, and Type-4. Type-1 category consists of four instructions, each with 3 integer register operands (3Rs). Type-2 category consists of eight instructions, each with 2 floating point register operands (2Fs). Type-3 category consists of fourteen instructions, each with one integer register operand and one floating point register operand (1R+1F). Type-4 category consists of N instructions, each with a floating point register operand (1F).

The maximum value of N is __________.

62

Given a language 𝐿, define LiL^i as follows:

L0=εL^0={ε}

Li=Li1L For all i>0L^i=L^{i-1}⋅L\ For\ all\ i>0

The order of a language is defined as the smallest such that 𝐿𝑘 = 𝐿𝑘+1.Consider the language L1 (over alphabet 0) accepted by the following automaton:

The order of L1 is ________

63

Consider an IP packet with a length of 4,500 bytes that includes a 20-byte IPv4 header and a 40-byte TCP header. The packet is forwarded to an IPv4 router that supports a Maximum Transmission Unit (MTU) of 600 bytes. Assume that the length of the IP header in all the outgoing fragments of this packet is 20 bytes. Assume that the fragmentation offset value stored in the first fragment is 0.

The fragmentation offset value stored in the third fragment is _______.

64

Consider a storage disk with 4 platters (numbered as 0, 1, 2 and 3), 200 cylinders (numbered as 0, 1, … , 199), and 256 sectors per track (numbered as 0, 1, … , 255). The following 6 disk requests of the form [sector number, cylinder number, platter number] are received by the disk controller at the same time: [120, 72, 2] , [180, 134, 1] , [60, 20, 0] , [212, 86, 3] , [56, 116, 2] , [118, 16, 1]  Currently the head is positioned at sector number 100 of cylinder 80, and is moving towards higher cylinder numbers. The average power dissipation in moving the head over 100 cylinders is 20 milliwatts and for reversing the direction of the head movement once is 15 milliwatts. Power dissipation associated with rotational latency and switching of head between different platters is negligible. The total power consumption in milliwatts to satisfy all of the above disk requests using the Shortest Seek Time First disk scheduling algorithm is _______.

65

Consider a simple communication system where multiple nodes are connected by a shared broadcast medium (like Ethernet or wireless). The nodes in the system use the following carrier-sense-based medium access protocol. A node that receives a packet to transmit will carrier-sense the medium for 5 units of time. If the node does not detect any other transmission in this duration, it starts transmitting its packet in the next time unit. If the node detects another transmission, it waits until this other transmission finishes, and then begins to carrier-sense for 5-time units again. Once they start to transmit, nodes do not perform any collision detection and continue transmission even if a collision occurs. All transmissions last for 20 units of time. Assume that the transmission signal travels at the speed of 10 meters per unit time in the medium.

Assume that the system has two nodes P and Q, located at a distance of meters from each other. P starts transmitting a packet at time t= 0 after successfully completing its carrier-sense phase. Node Q has a packet to transmit at time t=0 and begins to carrier-sense the medium. The maximum distance (in meters, rounded to the closest integer) that allows Q to successfully avoid a collision between its proposed transmission and P’s ongoing transmission is _____.

Attempt this paper under real exam conditions

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

Start Timed Attempt