Official Paper

GATE CS 2015 Official Paper: Shift 2 (Previous Year Paper)

65 questions · 180 minutes · with answers · free

General Aptitude (10 questions)

1

We _________ our friend’s birthday and we ________ how to make it up to him.

  1. ((a))

    completely forgot --- don’t just know

  2. ((b))

    forgot completely --- don’t just know

  3. ((c))

    completely forgot --- just don’t know

  4. ((d))

    forgot completely --- just don’t know

Show Answer
Answer: ((c))

completely forgot --- just don’t know

'Completely’ and ‘just’ are considered adverbs of emphasis and should be placed in front of the verbs they describe. Even if a verb is in its negative form, for eg. "don't know", the adverb should be placed before the entire form.

The only option that satisfies this criteria in both cases is option C.

Hence, option C is the correct answer.

2

Choose the statement where the underlined word is used correctly.

  1. ((a))

    The industrialist had a personnel jet.

  2. ((b))

    I write my experience in my personnel diary.

  3. ((c))

    All personnel are being given the day off.

  4. ((d))

    Being religious is a personnel aspect.

Show Answer
Answer: ((c))

All personnel are being given the day off.

The word ‘personnel’ means 'people who are employed in an organization'.

Out of the given options, this meaning is accurately represented only in the sentence from option 3. The other options are instead referring to the word 'personal'.

Hence, option 3 is the answer.

3

A generic term that includes various items of clothing such as a skirt, a pair of trousers and a shirt is

  1. ((a))

    fabric

  2. ((b))

    textile

  3. ((c))

    fibre

  4. ((d))

    apparel

Show Answer
Answer: ((d))

apparel

Here are the meanings of the given words:

  • Fabric - cloth produced by weaving or knitting fibres
  • Textile - a type of cloth or woven fabric
  • Fibre - a thread or filament from which textile is formed
  • Apparel - clothing in general

We can see that the word that most accurately defines the given set of words is ‘apparel’.

Hence, option 4 is correct.

4

Based on the given statements, select the most appropriate option to solve the given

question. What will be the total weight of 10 poles each of same weight?

Statements:

(I) One fourth of the weight of a pole is 5Kg

(II) The total weight of these poles is 160kg more than the total weight of two poles.

  1. ((a))

    Statement I alone is not sufficient.

  2. ((b))

    Statement II alone is not sufficient.

  3. ((c))

    Either I or II alone is sufficient.

  4. ((d))

    Both statement I and II together are not sufficient.

Show Answer
Answer: ((c))

Either I or II alone is sufficient.

The given problem requires the total weight of 10 poles, each of same weight.

We check the given statements for evaluation of the total weight.

Statement I:

Given that one fourth of weight of a pole is 5 kg.

Let weight of a pole =x;kg= x;kg

x4=5 x=20;kg\begin{array}{l} \frac{x}{4} = 5\ x = 20;kg \end{array}

Total weight of 10 poles =10x=200;kg= 10x = 200;kg

Statement II:

The total weight of 10 poles is 160 kg more than the total weight of two poles.

Let weight of a pole =x;kg= x;kg

So, total weight of 10 poles =10x= 10x

10x=2x+160 8x=160 x=20;kg\begin{array}{l} 10x = 2x + 160\ 8x = 160\ x = 20;kg \end{array}

Hence, total weight of 10 poles =10x=20×10=200;kg= 10x = 20 \times 10 = 200;kg

Thus, the given problem can be solved by using any of the two statements.

5

Consider a function f(x)=1xf\left( x \right) = 1-\left| x \right| in 1x1- 1 \le x \le 1. The value of xx at which the function attains a maximum, and the maximum value of the function are:

  1. ((a))

    0, –1

  2. ((b))

    –1, 0

  3. ((c))

    0,1

  4. ((d))

    –1, 2

Show Answer
Answer: ((c))

0,1

Given f(x)=1xf\left( x \right) = 1-\left| x \right| in 1x1- 1 \le x \le 1

Since, x>0,;for;all;x\left| x \right| > 0,;for;all;x

So, x\left| x \right|can take minimum value of 0 and maximum value of 1. Also on increasing value of x\left| x \right|, value of f(x)f\left( x \right) decreases. At x=0\left| x \right| = 0, we obtain

f(x)=1xf\left( x \right) = 1 - \left| x \right|

=10=1= 1 - 0 = 1 (function has maximum value)

Again, at x=1\left| x \right| = 1, we obtain

f(x)=1xf\left( x \right) = 1 - \left| x \right|

=11=0= 1 - 1 = 0 (function has minimum value)

Thus, at x=0\left| x \right| = 0 value of f(x)f\left( x \right) is maximum and at x=1\left| x \right| = 1 value of f(x)f\left( x \right) is minimum.

6

Out of the following four sentences, select the most suitable sentence with respect to grammar and usage:

  1. ((a))

    Since the report lacked the needed information, it was of no use to them.

  2. ((b))

    The report was useless to them because there were no needed information in it.

  3. ((c))

    Since the report did not contain the needed information, it was not real useful to them.

  4. ((d))

    Since the report lacked needed information, it would not had been useful to them.

Show Answer
Answer: ((a))

Since the report lacked the needed information, it was of no use to them.

Out of all the given sentences, only the sentence in option 1 is entirely correct with respect to grammar and usage.

Here are the errors in the other sentences:

  • Option 2: The verb 'were' should actually be 'was' since the subject 'information' is singular.
  • Option 3: The word 'real' should instead be 'really' - an adverb to describe the adjective 'useful'.
  • Option 4: 'Would not had been' is an ungrammatical tense construction.
<br>

Hence, the correct answer is option 1.

7

In a triangle PQRPQR, PSPS is the angle bisector of SPR\angle SPR and QPS=60\angle QPS = 60. What is the

length of PSPS?

  1. ((a))

    (q+r)qr\frac{{\left( {q + r} \right)}}{{qr}}

  2. ((b))

    qr(q+r)\frac{{qr}}{{\left( {q + r} \right)}}

  3. ((c))

    (q2+rr)\sqrt {\left( {{q^2} + {r^r}} \right)}

  4. ((d))

    (q+r)2qr\frac{{{{\left( {q + r} \right)}^2}}}{{qr}}

Show Answer
Answer: ((b))

qr(q+r)\frac{{qr}}{{\left( {q + r} \right)}}

We redraw this triangle as

In triangle, the internal bisector of an angle bisect the opposite side in the ratio of the other two sides. So, we have

QSSR=PQPR QSSR=rq QS+SRSR=r+qq SRQR=qr+q SR=qpr+q\begin{array}{l} \frac{{QS}}{{SR}} = \frac{{PQ}}{{PR}}\ \frac{{QS}}{{SR}} = \frac{r}{q}\ \frac{{QS + SR}}{{SR}} = \frac{{r + q}}{q}\ \frac{{SR}}{{QR}} = \frac{q}{{r + q}}\ SR = \frac{{qp}}{{r + q}} \end{array}

By using cosine formula in triangle ΔPSR{\rm{\Delta }}PSR,

cos60=(PR)2+(PS)2(SR)2(PR)(PS) 12=(q)2+(PS)2(qpr+q)2(q)(PS) PS=qrr+q\begin{array}{l} \cos 60^\circ = \frac{{{{\left( {PR} \right)}^2} + {{\left( {PS} \right)}^2} - {{\left( {SR} \right)}^2}}}{{\left( {PR} \right)\left( {PS} \right)}}\ \frac{1}{2} = \frac{{{{\left( q \right)}^2} + {{\left( {PS} \right)}^2} - {{\left( {\frac{{qp}}{{r + q}}} \right)}^2}}}{{\left( q \right)\left( {PS} \right)}}\ PS = \frac{{qr}}{{r + q}} \end{array}

8

If p,q,r,sp,q,r,s are distinct integers such that:

f(p,q,r,s)=max(p,q,r,s) g(p,q,r,s,)=min;(p,q,r,s) h(p,q,r,s)=remainder;ofp×qr×sif;(p×q)>(r×s) ;(or)remainder;ofr×sp×q;if;(r×s)>(p×q)\begin{array}{l} f\left( {p,q,r,s} \right) = max\left( {p,q,r,s} \right)\ g\left( {p,q,r,s,} \right) = min;\left( {p,q,r,s} \right)\ h\left( {p,q,r,s} \right) = remainder;of\frac{{p \times q}}{{r \times s}}if;\left( {p \times q} \right) > \left( {r \times s} \right)\ ;\left( {or} \right)remainder;of\frac{{r \times s}}{{p \times q}};if;\left( {r \times s} \right) > \left( {p \times q} \right) \end{array}

Also a function fgh;(p,q,r,s)=f(p,q,r,s)×g(p,q,r,s)×h(p,q,r,s)fgh;\left( {p,q,r,s} \right) = f\left( {p,q,r,s} \right) \times g\left( {p,q,r,s} \right) \times h\left( {p,q,r,s} \right)

Also the same operations are valid with two variable function of the form f(p,q)f\left( {p,q} \right).

What is the value of fg(h(2,5,7,3),4,6,8)fg\left( {h\left( {2,5,7,3} \right),4,6,8} \right)?

9

If the list of letters, P,R,S,T,UP,R,S,T,U is an arithmetic sequence, which of the following

are also in arithmetic sequence?

I. 2P,;2R,;2S,;2T,;2U2P,;2R,;2S,;2T,;2U

II. P3,;R3,;S;;3,;T3,;U3P-3,;R-3,;S;-;3,;T-3,;U-3

III. P2,;R2,;S2,;T2,;U2{P^2},;{R^2},;{S^2},;{T^2},;{U^2}

  1. ((a))

    I only

  2. ((b))

    I and II

  3. ((c))

    II and III

  4. ((d))

    I and III

Show Answer
Answer: ((b))

I and II

Here P,R,S,T,UP,R,S,T,U are in A.P. So, the difference between two consecutive numbers will be equal, i.e.

d=RP=SR=TS=UTd = R - P = S - R = T - S = U - T

Where dd is common difference for the given A.P. Now, we check the given sequences

Sequence I:

2P,;2R,;2S;,;2T;,;2U2P,;2R,;2S;,;2T;,;2U

The differences between two consecutive numbers are obtained as

D=2R2P=2(RP)=2d D=2S2R=2(SR)=2d D=2T2S=2(TS)=2d\begin{array}{l} D = 2R - 2P = 2\left( {R - P} \right) = 2d\ D = 2S - 2R = 2\left( {S - R} \right) = 2d\ D = 2T - 2S = 2\left( {T - S} \right) = 2d \end{array}

Since, the differences are same in each case, so it is in A.P.

Sequence II:

P3,;R3,;S3,;T3,;V3P - 3,;R - 3,;S - 3,;T - 3,;V - 3

The differences between two consecutive numbers are obtained as

D=(R3)(P3) =RP3+3=RP=d D=(S3)(R3) =SR3+3=SR=d\begin{array}{l} D = \left( {R - 3} \right) - \left( {P - 3} \right)\ = R - P - 3 + 3 = R - P = d\ D = \left( {S - 3} \right) - \left( {R - 3} \right)\ = S - R - 3 + 3 = S - R = d \end{array}

Again, the differences are same in each case, so it is in A.P.

Sequence III:

P2,;R2,;S2,;T2,;V2{P^2},;{R^2},;{S^2},;{T^2},;{V^2}

The differences between two consecutive numbers are obtained as

D=R2P2=(RP)(R+P) =d(R+P) D=S2R2=(SR)(S+R) =d(S+R)\begin{array}{l} D = {R^2} - {P^2} = \left( {R - P} \right)\left( {R + P} \right)\ = d\left( {R + P} \right)\ D = {S^2} - {R^2} = \left( {S - R} \right)\left( {S + R} \right)\ = d\left( {S + R} \right) \end{array}

In this case, the differences are not same, so it is not in A.P.

Thus, sequences I and II will be in A.P.

10

Four branches of a company are located at M,N,O, and P. M is north of N at a distance of 4km; P is south of O at a distance of 2km; N is southeast of O by 1km. What is the distance between M and P in km?

  1. ((a))

    5.34

  2. ((b))

    6.74

  3. ((c))

    28.5

  4. ((d))

    45.49

Show Answer
Answer: ((a))

5.34

From the given data, we draw the schematic as

Let coordinate of N = (0,0)

Coordinate of M = (0,4)

Coordinate of O = (12,12)\left( { - \frac{1}{{\sqrt 2 }},\frac{1}{{\sqrt 2 }}} \right)

Coordinate of P = (12,122)\left( { - \frac{1}{{\sqrt 2 }},\frac{1}{{\sqrt 2 }} - 2} \right)

Hence by distance formula, we obtain

=(x1x2)2+(y1y2)2 =(012)2+(4+212)2 =5.34;km\begin{array}{l} = \sqrt {{{\left( {{x_1} - {x_2}} \right)}^2} + {{\left( {{y_1} - {y_2}} \right)}^2}} \ = \sqrt {{{\left( {0 - \frac{1}{{\sqrt 2 }}} \right)}^2} + {{\left( {4 + 2 - \frac{1}{{\sqrt 2 }}} \right)}^2}} \ = 5.34;km \end{array}

Computer Science and Information Technology (55 questions)

11

Consider the following two statements.

S1: If a candidate is known to be corrupt, then he will not be elected

S2: If a candidate is kind, he will be elected

Which one of the following statements follows from S1 and S2 as per sound inference rules of logic?

  1. ((a))

    If a person is known to be corrupt, he is kind

  2. ((b))

    If a person is not known to be corrupt, he is not kind

  3. ((c))

    If a person is kind, he is not known to be corrupt

  4. ((d))

    If a person is not kind, he is not known to be corrupt

Show Answer
Answer: ((c))

If a person is kind, he is not known to be corrupt

Concept:

Hypothetical syllogism,

If p → q and q → r then p → r

Formula:

p → q ≡ ¬ q → ¬ p ≡ ¬ p ∨ q 

Explanation:

C(x): x is known to be corrupt

E(x): x will be elected

K(x): x is kind

Statement S1 can be written as:

S1C(x);¬E(x){\rm{S}}1 \equiv {\rm{C}}\left( {\rm{x}} \right){\rm{;}} \to \neg {\rm{E}}\left( {\rm{x}} \right) 

S2 can be written as:

S2K(x)E(x)¬E(x)¬K(x){\rm{S}}2 \equiv {\rm{K}}\left( {\rm{x}} \right) \to {\rm{E}}\left( {\rm{x}} \right) \equiv \neg {\rm{E}}\left( {\rm{x}} \right) \to \neg {\rm{K}}\left( {\rm{x}} \right) 

By using hypothetical syllogism,

From S1 and S2, the conclusion is

C(x);¬;K(x)K(x)¬C;(x){\rm{C}}\left( {\rm{x}} \right) \to {\rm{;}}\neg {\rm{;K}}\left( {\rm{x}} \right) \equiv {\rm{K}}\left( {\rm{x}} \right) \to \neg {\rm{C;}}\left( {\rm{x}} \right)

If a person is kind, then he is not known to be corrupt.

12

The cardinality of the power set of {0, 1, 2, …, 10} is _________.

13

Let R be the relation on the set of positive integers such that aRb if and only if 'a 'and 'b' are distinct and have a common divisor other than 1. Which one of the following statements about 'R' is true?

  1. ((a))

    𝑅 is symmetric and reflexive but not transitive

  2. ((b))

    𝑅 is reflexive but not symmetric and not transitive

  3. ((c))

    𝑅 is transitive but not reflexive and not symmetric

  4. ((d))

    𝑅 is symmetric but not reflexive and not transitive

Show Answer
Answer: ((d))

𝑅 is symmetric but not reflexive and not transitive

R be the relation on the set of positive integers such that aRb if and only if a and b are distinct and have a common divisor other than 1.

Let A = {1, 2, 3, 4, 5, 6…}

aRb ≡ (a, b}

  • R cannot be reflexive because aRa, a and a are not distinct.

Example: R = {(4,6)}

  • R is symmetric because if aRb is there then bRa is also possible, in both a and b are distinct.

Example:  R = {(6, 4), (4,6)}  

  • R is not transitive as aRb and bRc doesn’t mean aRc.

Example: R = {(6, 4), (4,6)} since (6,6) cannot be included and hence it cannot be transitive

So, given relation is symmetric but not transitive and not reflexive.

14

The number of divisors of 2100 is _____ .

15

The larger of the two eigenvalues of the matrix is \(\left[ {\begin{array}{*{20}{c}} 4&5\ 2&1 \end{array}} \right]\) is_______.

16

An unordered list contains n distinct elements. The number of comparisons to find an element in this list that is neither maximum nor minimum is

  1. ((a))

    Θ(n log n)

  2. ((b))

    Θ(n)

  3. ((c))

    Θ(log n)

  4. ((d))

    Θ(1)

Show Answer
Answer: ((d))

Θ(1)

Code in C programming language:

#include<stdio.h>

int not_max_min(int a, int b, int c)

{

if ((a < b && b < c) || (c < b && b < a))

    return b;

else if ((b < a && a < c) || (c < a && a < b))

    return a;

else

    return c;

}

int main()

{

    int list[] = {2,1,34,3,9,31};

    printf("%d",not_max_min(list[0], list[1], list[2]));

    return 0;

}

Explanation:

Constant amount of comparison is needed to find neither maximum nor minimum element from and unordered distinct list and therefore time complexity for comparison is O(1).

Alternate method:

Here, it means to find an element which is greater than an element and lesser than another element. We have a given an unordered list contains n distinct element so, we just need three elements to get that element. To analyse that it will take constant amount of time.

Consider the example:

Let us take the elements as {15, 20, 16, 8, 80}. Output should be 15, 16, 20.

Here minimum = 8, maximum = 80

Pick any three elements from given list. Let the three elements: 15, 20, 8. By three comparisons, we can find that the middle element is 20.

It will take O(1) time to find an element in the list that is neither maximum nor minimum.

17

The minimum number of JK flip-flops required to construct a synchronous counter with the count sequence (0, 0, 1, 1, 2, 2, 3, 3, 0, 0, …) is __________

18

Assume that for a certain processor, a read request takes 50 nanoseconds on a cache miss and 5 nanoseconds on a cache hit. Suppose while running a program, it was observed that 80% of the processor's read requests result in a cache hit. The average read access time in nanoseconds is __________.

19

A computer system implements a 40-bit virtual address, page size of 8 kilobytes, and a 128-entry translation look-aside buffer (TLB) organized into 32 sets each having four ways. Assume that the TLB tag does not store any process id. The minimum length of the TLB tag in bits is _________.

20

Consider the following statements.

I. The complement of every Turing decidable language is Turing decidable

II. There exists some language which is in NP but is not Turing decidable

III. If L is a language in NP, L is Turing decidable

Which of the above statements is/are true?

  1. ((a))

    Only II

  2. ((b))

    Only III

  3. ((c))

    Only I and II

  4. ((d))

    Only I and III

Show Answer
Answer: ((d))

Only I and III

Statement I: TRUE

A decision problem is a problem that can be posed as a yes or no. If we can decide a problem, then its complement is also decidable. So, given statement is true.

Statement II: FALSE

NP class problems are the problems which can be solved in polynomial time using non-deterministic machine. None of the NP class problem is undecidable. So, this statement is incorrect

Statement III: TRUE

As it is explained in option II none of the NP class problem is undecidable. So, given statement is correct.

21

Consider the following function written in the C programming language.

void foo(char *a){

if (*a && *a != ‘ ‘){

foo(a+1);

putchar(*a);

}

}

The output of the above function on input “ABCD EFGH” is

  1. ((a))

    ABCD EFGH

  2. ((b))

    ABCD

  3. ((c))

    HGFE DCBA

  4. ((d))

    DCBA

Show Answer
Answer: ((d))

DCBA

Concept:

If (*a && *a!= ‘ ’)

In this priority of != is greater than && in C. If will break either when a space occurs in the string or a Null ‘\0’ occurs in the string.

Explanation:

Consider the array of string with base address 100:

\

 

Recursive call:

Traverse the tree from top to bottom and left to write

Output: DCBA

22

Consider a complete binary tree where the left and the right subtrees of the root are max-heaps. The lower bound for the number of operations to convert the tree to a heap is

  1. ((a))

    Ω (log n)

  2. ((b))

    Ω (n)

  3. ((c))

    Ω (n log n)

  4. ((d))

    Ω (n2)

Show Answer
Answer: ((a))

Ω (log n)

Consider complete binary tree where left and right subtrees of the root are max-heaps given below

To convert the tree into a heap which is possible by calling MAX-HEAPIFY at root. MAX- HEAPIFY operation takes time as the height of the tree. i.e. if we have n elements in the tree then log(n) is the height of the tree.

Step 1: Swap 10 and 40

Step 2: swap 10 and 25

The above tree is a MAX-HEAP

To convert this into a max heap it takes only 2 swap and 2 comparison which is nothing but the height of the tree. So, log(n) time is required to convert the tree into a heap.

23

A binary tree T has 20 leaves. The number of nodes in T having two children is _______.

24

Consider the following C function.

int fun(int n){

            int x=1, k;

if (n==1) return x;

for (k=1; k<n; ++k)

              x = x + fun(k) * fun(n-k);

      return x;

}

The return value of fun (5) is ________.

25

A software requirements specification (SRS) document should avoid discussing which one of the following?

  1. ((a))

    User interface issues

  2. ((b))

    Non-functional requirements

  3. ((c))

    Design specification

  4. ((d))

    Interfaces with third party software

Show Answer
Answer: ((c))

Design specification

Software requirement specification (SRS) is a description of a software system to be developed.  Specification types that are included are functional, non- functional, interfaces, performance, maintainability etc.

But design specification is not included in software requirement specification.  Design is something related to implementation.

26

Consider two decision problems Q1, Q2 such that Q1 reduces in polynomial time to 3-SAT and 3-SAT reduces in polynomial time to Q2. Then which one of the following is consistent with the above statement?

  1. ((a))

    Q1 is in NP, Q2 is NP hard

  2. ((b))

    Q2 is in NP, Q1 is NP hard

  3. ((c))

    Both Q1 and Q2 are in NP

  4. ((d))

    Both Q1 and Q2 are NP hard

Show Answer
Answer: ((a))

Q1 is in NP, Q2 is NP hard

Concept:

If a NP complete problem is reducible to another problem in polynomial time than that other problem becomes NP hard.

If X ϵ NP complete and X reduces to Y in polynomial time than Y is NP hard.

3 - SAT is NP complete problem

Explanation:

Q1 reduces in polynomial time to 3- SAT. As 3 - SAT is NP complete problem, Q1 is easier than NPC. So, Q1 can’t be NP hard. It is in NP.

3- SAT reduces in polynomial time to Q2. As, 3- SAT is NP complete so, Q2 will be NP hard.

Therefore, Q1 is NP and Q2 is NP hard.

27

Match the following:

P. Lexical analysis1. Graph coloring
Q. Parsing2. DFA minimization
R. Register allocation3. Post-order traversal
S. Expression evaluation4. Production tree
  1. ((a))

    P – 2, Q – 3, R – 1, S - 4

  2. ((b))

    P – 2, Q – 1, R – 4, S - 3

  3. ((c))

    P – 2, Q – 4, R – 1, S - 3

  4. ((d))

    P – 2, Q – 3, R – 4, S - 1

Show Answer
Answer: ((c))

P – 2, Q – 4, R – 1, S - 3

Lexical analysis: Lexical analysis is the first phase of compiler also known as scanner. It converts the high-level input program into a sequence of tokens. Lexical analysis can be implemented by deterministic finite automata.

Parsing: Parser constructs a production tree. Parse tree is a hierarchical structure which represents the derivation of the programmer to yield input strings.

Register allocation: Register allocation reduces to graph coloring problem in which colors (registers) are assigned to the nodes such that two nodes connected by an edge do not receive the same color.

Expression evaluation: Expression evaluation is done using post order traversal.

28

In the context of abstract-syntax-tree (AST) and control-flow-graph (CFG), which one of the following is TRUE?

  1. ((a))

    In both AST and CFG, let node N2 be the successor of node N1. In the input program, the code corresponding to N2 is present after the code corresponding to N1

  2. ((b))

    For any input program, neither AST nor CFG will contain a cycle

  3. ((c))

    The maximum number of successors of a node in an AST and a CFG depends on the input program

  4. ((d))

    Each node in AST and CFG corresponds to at most one statement in the input program

Show Answer
Answer: ((c))

The maximum number of successors of a node in an AST and a CFG depends on the input program

  • Abstract syntax tree (AST) is a tree that represents the abstract syntactic structure of a language construct where each interior node and the root represents an operator and the children of the node represent the operands of that operator.
  • Control flow graph (CFG) is the graphical representation of control flow or computation during the execution of programs or applications. These are mostly used in static analysis as well as computer applications.
<br>

Option 1: FALSE

In CFG code of N2 may be present before N1 when there is a loop or goto.

Option 2: FALSE

CFG contains cycle when input program has loop.

Option 3: TRUE

Successors in AST and CFG depend on input program.

Option 3: FALSE

A single statement may belong to a block of statements.

29

Consider the basic COCOMO model where E is the effort applied in person-months, D is the development time in chronological months, KLOC is the estimated number of delivered lines of code (in thousands) and ab, bb, cb, db have their usual meanings. The basic COCOMO equations are of the form

  1. ((a))

    E = ab (KLOC) exp(bb), D = cb (E) exp(db)

  2. ((b))

    D = ab (KLOC) exp(bb), E = cb (D) exp(db)

  3. ((c))

    E = ab exp(bb), D = cb (KLOC) exp(db)

  4. ((d))

    E = ab exp(db), D = cb (KLOC) exp(bb)

Show Answer
Answer: ((a))

E = ab (KLOC) exp(bb), D = cb (E) exp(db)

BASIC COCOMO: 

It is the simplest version of the COCOMO model which uses only LOC (line of code) as an input matrix to predict the cost, time and team size.

In BASIC COCOMO,

Development effort(E) = ab (KLOC) exp(bb)

where KLOC is the size of the program in lines of code.

Development time (D) = cb (E) exp(db)

Team size = (development effort) / (development time)

30

A system has 6 identical resources and N processes competing for them. Each process can request at most 2 resources. Which one of the following values of N could lead to a deadlock?

  1. ((a))

    1

  2. ((b))

    2

  3. ((c))

    3

  4. ((d))

    6

Show Answer
Answer: ((d))

6

Data:

Available identical Resources = R = 6

Max needs per process = 2

Concepts:

Deadlock can occur If any process gets available resource < needed (requested) resource

Max resource per process to be in deadlock = needed – 1 = 2 – 1 = 1

For N process, max resource to be in deadlock = N × 1 = N

Condition for deadlock

N ≥ R

N ≥ 6

values of N could lead to a deadlock is 6

Explanation:

As there are 6 identical resources and Max requirement is 2, hence Max. number of process can be allowed is

But when the number of process is more than 5

Important Point:

In GATE, option 4 is 4, which won't give the correct answer and hence option 4 has been changed to 6

31

Consider the following transaction involving two bank accounts x and y.

read (x); x := x – 50 ; write (x) ; read (y) ; y≔ y + 50 ; write (y)

The constraint that the sum of the accounts x and y should remain constant is that of

  1. ((a))

    Atomicity

  2. ((b))

    Consistency

  3. ((c))

    Isolation

  4. ((d))

    Durability

Show Answer
Answer: ((b))

Consistency

ACID Properties:

ATOMICITY: It states that either all the operations of a transaction are executed or NULL.

ISOLATION: It states that each transaction of the concurrent schedule is unaware from another transaction that is parallel executed even if that transaction is executed on same data item.

DURABILITY: It states that after the successful execution of the transaction on the database all the modifications must be reflected on the database even after the system failure.

CONSISTENCY: It states that after the execution of a transaction the database must be in the consistent state (as that before execution).

Explanation:

Let us assume that RS.50 is debited from one account and credited to another account, in such case T1 transaction should execute first then T2

T1T2
read(x)
x := x – 50
write(x)
read(y)
y ≔ y+50
write(y)

 

Before transaction: Initially

x = 100 and y = 150 then x + y = 250

After transaction: Finally

x = 50 and y = 200 then x + y = 250

The constraint that the sum of the accounts x and y should remain constant is that of consistency.

32

With reference to the B+ tree index of order 1 shown below, the minimum number of nodes (including the Root node) that must be fetched in order to satisfy the following query: "Get all records with a search key greater than or equal to 7 and less than 15" is ____________.

33

Identify the correct order in which a server process must invoke the function calls accept, bind, listen, and recv according to UNIX socket API.

  1. ((a))

    listen, accept, bind, recv

  2. ((b))

    bind, listen, accept, recv

  3. ((c))

    bind, accept, listen, recv

  4. ((d))

    accept, listen, bind, recv

Show Answer
Answer: ((b))

bind, listen, accept, recv

BIND:

bind () function call binds a unique local name to the socket with descriptor socket. After calling socket (), a descriptor does not have a name associated with it.

LISTEN:

It causes a bound TCP socket to enter the listening state. It waits for the connections to socket.

ACCEPT:

It accepts a connection on a socket.

RECV:

It is used to read incoming data on connection-oriented sockets or connectionless sockets.

34

A link has a transmission speed of 106 bits/sec. It uses data packets of size 1000 bytes each. Assume that the acknowledgment has negligible transmission delay, and that its propagation delay is the same as the data propagation delay. Also assume that the processing delays at nodes are negligible. The efficiency of the stop-and-wait protocol in this setup is exactly 25%. The value of the one-way propagation delay (in milliseconds) is __________.

35

Which one of the following statements is NOT correct about HTTP cookies?

  1. ((a))

    A cookie is a piece of code that has the potential to compromise the security of an Internet user

  2. ((b))

    A cookie gains entry to the user’s work area through an HTTP header

  3. ((c))

    A cookie has an expiry date and time

  4. ((d))

    Cookies can be used to track the browsing pattern of a user at a particular site

Show Answer
Answer: ((a))

A cookie is a piece of code that has the potential to compromise the security of an Internet user

  • Cookies are messages that web servers pass to your web browser when user visit Internet sites. Web browser stores each message in a small file, called cookie.txt.
  • When user request another page from the server, browser sends the cookie back to the server. These files typically contain information about users visit to the web page, as well as any information user have volunteered, such as your name and interests.
  • Cookies are not piece of code; they are just string typically in the form of key value pairs.
<br>

Key points about cookies:

It is used to track the browsing pattern of a user.

It gains entry to the user’s work area through an HTTP header.

It has an expiry date and time.

36

Consider the following routing table at an IP router:

Network No.Net MaskNext Hop
128.96.170.0255.255.254.0Interface 0
128.96.168.0255.255.254.0Interface 1
128.96.166.0255.255.254.0R2
128.96.164.0255.255.252.0R3
0.0.0.0DefaultR4

For each IP address in Group I identify the correct choice of the next hop from Group II using the entries from the routing table above.

Group I                                                Group II

i) 128.96.171.92                                  a) Interface 0

ii) 128.96.167.151                               b) Interface 1

iii) 128.96.163.151                              c) R2

iv) 128.96.165.121                              d) R3

                        e) R4

  1. ((a))

    i – a, ii – c, iii – e, iv – d

  2. ((b))

    i – a, ii – d, iii – b, iv – e

  3. ((c))

    i – b, ii – c, iii – d, iv – e

  4. ((d))

    i – b, ii – c, iii – e, iv – d

Show Answer
Answer: ((a))

i – a, ii – c, iii – e, iv – d

Destination ip address of incoming packet is ANDed with the net mask with the longest prefixed, if it matches with the corresponding interface otherwise we AND the input ip address with next longest prefixed netmask and so on, If no match is found them we choose default interface.

Hence:

37

Host A sends a UDP datagram containing 8880 bytes of user data to host B over an Ethernet LAN. Ethernet frames may carry data up to 1500 bytes (i.e. MTU = 1500 bytes). Size of UDP header is 8 bytes and size of IP header is 20 bytes. There is no option field in IP header. How many total number of IP fragments will be transmitted and what will be the contents of offset field in the last fragment?

  1. ((a))

    6 and 925

  2. ((b))

    6 and 7400

  3. ((c))

    7 and 1110

  4. ((d))

    7 and 8880

Show Answer
Answer: ((c))

7 and 1110

The fragment offset: Offset of a fragment relative to the beginning of the original fragment IP datagram in units of 8 byte blocks.

Total size of input data in Network layer = 8880 + 8 = 8888

Each T.U. can carry Max 1480 Bytes of Network layer packet.

Hence # transmission =;88881480;=;7= ;\left\lceil {\frac{{8888}}{{1480}}} \right\rceil; = ;7

Also 1480 × 6 = 8880

Hence the last transmission will carry only.

8  data bytes and a total of 28 bytes.

Also, No. of 8 – byte blocks of network ahead of last fragment is 88888;=;1110\frac{{8888}}{8}; = ;1110

38

Assume that the bandwidth for a TCP connection is 1048560 bits /sec. Let α be the value of RTT in milliseconds (rounded off to the nearest integer) after which the TCP window scale option is needed. Let β be the maximum possible window size with window scale option. Then the values of α and β are

  1. ((a))

    63 milliseconds, 65535 x 214

  2. ((b))

    63 milliseconds, 65535 x 216

  3. ((c))

    500 milliseconds, 65535 x 214

  4. ((d))

    500 milliseconds, 65535 x 216

Show Answer
Answer: ((c))

500 milliseconds, 65535 x 214

Concept:

RTT (Round trip time) is the length of time it takes for a signal to be sent plus the length of time it takes for an acknowledgement of that signal to be received.

Bandwidth delay product: It gives the maximum amount of data that can be transmitted by the sender at a given time before waiting for acknowledgement.

It is measured in terms of RTT × Bandwidth.

Explanation:

In TCP, sequence number is limited to 16 bits i.e. TCP allows scaling of windows when bandwidth delay product is greater than 65,535.

Here, it is given that bandwidth = 1048560 bits/sec

RTT = α ms

Maximum possible window size = β

Bandwidth delay product = 1048560 × ∝

65535 B = 1048560 × α

α = 500 milliseconds

When we do scaling, window size increases from 64KB to 1 GB i.e. from 216 B to 230 B.

A 14-bit shift count is used in TCP header.

i.e. from 65535 to 65535 × 214 Bytes

39

Consider a simple checkpointing protocol and the following set of operations in the log.

(start, T4); (write, T4, y, 2, 3); (start, T1); (commit, T4); (write, T1, z, 5, 7); (checkpoint);

(start, T2); (write, T2, x, 1, 9); (commit, T2); (start, T3), (write, T3, z, 7, 2);

If a crash happens now and the system tries to recover using both undo and redo operations, what are the contents of the undo list and the redo list?

  1. ((a))

    Undo: T3, T1; Redo: T2

  2. ((b))

    Undo: T3, T1; Redo: T2, T4

  3. ((c))

    Undo: none; Redo: T2, T4, T3, T1

  4. ((d))

    Undo: T3, T1, T4; Redo: T2

Show Answer
Answer: ((a))

Undo: T3, T1; Redo: T2

Concept:

Check pointing is a mechanism where all the previous logs are removed from the system and stored permanently in the storage disk. Checkpoint declares a point before which the DBMS was in consistent state, and all the transactions were committed.

It maintains two list - undo list and redo list.

  • If the recovery system sees a log with <Tn, start> and <Tn, commit> or just <Tn, commit> , it puts the transaction in the redo list.
  • If the recovery system sees a log with <Tn, start> but no commit or abort log found, it puts the transaction in undo list.

Explanation:

Above operation are shown in table as:

T1T2T3T4
start
write(y,2,3)
start
commit
write(z,5,7)
CheckpointCheckpointCheckpointCheckpoint
start
write(x,1,9)
commit
start
write(z,7,2)
crashcrashcrashcrash

 

Now, as T1 and T3 are uncommitted, they must be undone. T2 is committed but it is after checkpoint so, it must be redone. As, T4 is already committed before checkpoint so, it neither comes in undo list nor in redo list.

40

Consider two relations R1(A, B) with the tuples (1, 5), (3, 7) and R2(A, C) = (1, 7), (4, 9). Assume that R(A, B, C) is the full natural outer join of R1 and R2. Consider the following tuples of the form (A, B, C): a = (1, 5, null), b = (1, null, 7), c = (3, null, 9), d = (4, 7, null), e = (1, 5, 7), f = (3, 7, null), g = (4, null, 9). Which one of the following statements is correct?

  1. ((a))

    R contains a, b, e, f, g but not c, d.

  2. ((b))

    R contains all of a, b, c, d, e, f, g.

  3. ((c))

    R contains e, f, g but not a, b.

  4. ((d))

    R contains e but not f, g.

Show Answer
Answer: ((c))

R contains e, f, g but not a, b.

Full natural outer join of R1 and R2 is :

Hence option 3 is correct:

41

Consider six memory partitions of sizes 200 KB, 400 KB, 600 KB, 500 KB, 300 KB and 250 KB, where KB refers to kilobyte. These partitions need to be allotted to four processes of sizes 357 KB, 210 KB, 468 KB and 491 KB in that order. If the best fit algorithm is used, which partitions are NOT allotted to any process?

  1. ((a))

    200 KB and 300 KB

  2. ((b))

    200 KB and 250 KB

  3. ((c))

    250 KB and 300 KB

  4. ((d))

    300 KB and 400 KB

Show Answer
Answer: ((a))

200 KB and 300 KB

In best fit approach we choose smallest partition are process can fit in.

Fixed partitions

(Only one process can reside in one partition)

Hence partitions of size 200 KB and 300 KB will not be allotted to any process.

42

Consider a typical disk that rotates at 15000 rotations per minute (RPM) and has a transfer rate of 50 × 106 bytes/sec. If the average seek time of the disk is twice the average rotational delay and the controller’s transfer time is 10 times the disk transfer time, the average time (in milliseconds) to read or write a 512 - byte sector of the disk is ________.

43

A computer system implements 8-kilobyte pages and a 32 - bit physical address space. Each page table entry contains a valid bit, a dirty bit, three permission bits, and the translation. If the maximum size of the page table of a process is 24 megabytes, the length of the virtual address supported by the system is ________ bits.

44

Consider the intermediate code given below.

  1. i = 1

  2. j = 1

  3. t1 = 5 ∗ i

  4. t2 = t1 + j

  5. t3 = 4 ∗ t2

  6. t4 = t3

  7. a[t4] = - 1

  8. j = j + 1

  9. if j < = 5 goto (3)

  10. i = i + 1

  11. if i < 5 goto (2)

The number of nodes and edges in the control - flow - graph constructed for the above code, respectively, are

  1. ((a))

    5 and 7

  2. ((b))

    6 and 7

  3. ((c))

    5 and 5

  4. ((d))

    7 and 8

Show Answer
Answer: ((b))

6 and 7

Concept:

Control flow graph (CFG) is the graphical representation of computation during the execution of programs or applications.

Control flow graph for the above intermediate code is given here as:

Control flow graph contains 6 vertices and 7 edges.

45

The number of states in the minimal deterministic finite automaton corresponding to the regular expression (0 + 1)(10) is ________.

46

Which of the following languages is/are regular?

L1: {wxwRw,xε a, b*wxw^R| w, x \varepsilon\text{ {a, b}*} and |w|, |x| > 0}, wRw^R is the reverse of string w

L2: {anbma^nb^m | m ≠ n and m, n ≥ 0}

L3: {apbqcra^pb^qc^r | p, q, r ≥ 0}

  1. ((a))

    L1 and L3 only

  2. ((b))

    L2 only

  3. ((c))

    L2 and L3 only

  4. ((d))

    L3 only

Show Answer
Answer: ((a))

L1 and L3 only

L1: Regular

L1;=;a(a;+;b)a;+;b(a;+;b)b;+;{L_1}; = ;a\left( {a; + ;b} \right)_a^{; + ;} \cup b\left( {a; + ;b} \right)_b^{; + ;}

L2: DCFL: (one comparison)

L3: Regular

L3 = \(a^*b^c^\)

47

Given below are some algorithms, and some algorithm design paradigms.

1. Dijkstra’s Shortest Pathi. Divide and Conquer
2. Floyd-Warshall algorithm to compute all pairs shortest pathii. Dynamic Programming
3. Binary search on a sorted arrayiii. Greedy design
4. Backtracking search on a graphiv. Depth-first search
v. Breadth-first search

 

Match the above algorithms on the left to the corresponding design paradigm they follow.

  1. ((a))

    1 – i, 2 – iii, 3 – i, 4 – v.

  2. ((b))

    1 – iii, 2 – iii, 3 – i, 4 – v.

  3. ((c))

    1 – iii, 2 – ii, 3 – i, 4 – iv.

  4. ((d))

    1 – iii, 2 – ii, 3 – i, 4 – v.

Show Answer
Answer: ((c))

1 – iii, 2 – ii, 3 – i, 4 – iv.

  • Dijkstra’s Shortest Path uses the greedy method to find the shortest path of a graph G(V, E).
  • Floyd-Warshall algorithm uses dynamic programming approach to find all-pairs shortest paths of a graph G(V, E).
  • Binary search on a sorted array uses divide and conquer technique to search an element
  • Backtracking search on a graph is implemented using a depth-first search technique
48

A Young tableau is a 2D array of integers increasing from left to right and from top to bottom. Any unfilled entries are marked with ∞, and hence there cannot be any entry to the right of, or below a ∞. The following Young tableau consists of unique entries.

12514
34623
10121825
31
<br>

When an element is removed from a Young tableau, other elements should be moved into its place so that the resulting table is still a Young tableau (unfilled entries may be filled in with a ∞). The minimum number of entries (other than 1) to be shifted, to remove 1 from the given Young tableau is ________.

49

Suppose you are provided with the following function declaration in the C programming language.

int partition(int a[], int n);

The function treats the first element of a[ ] as a pivot, and rearranges the array so that all elements less than or equal to the pivot is in the left part of the array, and all elements greater than the pivot is in the right part. In addition, it moves the pivot so that the pivot is the last element of the left part. The return value is the number of elements in the left part.

The following partially given function in the C programming language is used to find the 𝑘𝑡ℎ smallest element in an array a[ ] of size n using the partition function. We assume 𝑘≤ 𝑛.

int kth_smallest(int a[], int n, int k)

{

                int left_end = partition(a, n);

                if ( left_end + 1 = = k ) {

                                return a[left_end];

      }

                if ( left_end + 1 > k ){

                                return kth_smallest( _____________________ );

      } else {

                return kth_smallest( _____________________ );

      }

}

The missing argument lists are respectively

  1. ((a))

    (a, left_end, k) and (a + left_end + 1, n - left_end - 1, k - left_end - 1)

  2. ((b))

    (a, left_end, k) and (a, n - left_end - 1, k - left_end - 1)

  3. ((c))

    (a + left_end + 1, n - left_end - 1, k - left_end - 1) and (a, left_end, k)

  4. ((d))

    (a, n - left_end - 1, k - left_end - 1) and (a, left_end, k)

Show Answer
Answer: ((a))

(a, left_end, k) and (a + left_end + 1, n - left_end - 1, k - left_end - 1)

We have to find the kth smallest element.

Condition is : if (left_end + 1 > k)

If this condition is true it means kth smallest element is present of left side. So a recursive call is done to kth_smallest(a, left_end,k);

If condition becomes false and left_end+ 1 is not equal to k, then kth smallest element will be present of right side of array. So, a recrusive call will be done as :

Kth_smallest(a+left_end+1, n-left_end_1, k-left_end -1);

Example:

Consider an array of 10 numbers i.e. N= 10, k= 7

a= {5,4,3,2,1,7,6,10,9,8}

pivot = 5

Step 1: after partition array will be = {4,3,2,1,5,7,6,10,9,8}

Here, left_end = 4

if(left_end < k)                         //else condition is satisifed

so , (a+left_end+1, n-left_end_1, k-left_end -1);

it will become (a+5, 5, 3)

array a = {7, 6, 10, 9, 8}

pivot = 7

STEP 2: After partition ()

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

Left_end = 1

if(Left_end + 1 < k)               // else condition is satisfied

so, (a+2, 3, 1)

array a = {10, 9, 8}

pivot = 10

STEP 3: After partition ()

Array a = {9, 8, 10}

Left_end = 2

Again left_end + 1 > k           // if condition satisified

So, (a, 2, 1)

Array a = {9, 8}

Pivot = 9

STEP 4:

Array = {8,9}

Left _ end = 1

Left_end +1 > k                  // if condition satisifed

So, (a,1,1)

Array = {8}

Pivot = 8

STEP 8: here, left_end = 0,

Left_end + 1 ==k , a[left_end ]= 8

At the end, it returns the left_end value.

50

Which one of the following hash functions on integers will distribute keys most uniformly over 10 buckets numbered 0 to 9 for 𝑖𝑖 ranging from 0 to 2020?

  1. ((a))

    ℎ(𝑖) = 𝑖2 mod 10

  2. ((b))

    ℎ(𝑖) = 𝑖3  mod 10

  3. ((c))

    ℎ(𝑖) = (11∗𝑖2) mod 10

  4. ((d))

    ℎ(𝑖) = (12∗𝑖) mod 10

Show Answer
Answer: ((b))

ℎ(𝑖) = 𝑖3  mod 10

Consider h(i) = i2 mod 10

Last digit of iBucket Number
01
14
29
36
45
56
69
74
81
90
<br>

Consider h(i) = i3 mod 10

Last digit of iBucket Number
00
11
28
37
44
55
66
73
82
99
51

The secant method is used to find the root of an equation f(x) = 0. It is started from two distinct estimates xa and xb for the root. It is an iterative procedure involving linear interpolation to a root. The iteration stops if f(xb) is very small and then xb is the solution. The procedure is given below. Observe that there is an expression which is missing and is marked by ?. Which is the suitable expression that is to be put in place of ? so that it follows all steps of the secant method?

Secant

Initialize: xa, xb, ε, N                              // ε = convergence indicator

// N = maximum no. of iterations

fb = f(xb)

i = 0

while (i < N and |fb| > ε) do

i = i + 1                                                 // update counter

xt = ?                                                    // missing expression for

                                                            // intermediate value

xa = xb                                                 // reset xa

xb = xt                                                 // reset xb

fb = f(xb)                                             // function value at new xb end while

if |fb| > ε then                                     // loop is terminated with i = N

write “Non - convergence”

else

write “return xb

end if

  1. ((a))

    xb – (fb – f(xa)) fb /(xb – xa)

  2. ((b))

    xa – (fa – f(xa)) fa /(xb – xa)

  3. ((c))

    xb – (xb – xa)fb/(fb – f(xa))

  4. ((d))

    xa – (xb – xa) fa/(fb – f(xa))

Show Answer
Answer: ((c))

xb – (xb – xa)fb/(fb – f(xa))

Secant method is used to find the roots of an equation. It is defined by the recurrence relation as:

xn=;xn1f(xn1)xn1;xn2f(xn1)f(xn2){x_n} = ;{x_{n - 1}} - f\left( {{x_{n - 1}}} \right)\frac{{{x_{n - 1}} - ;{x_{n - 2}}}}{{f\left( {{x_{n - 1}}} \right) - f\left( {{x_{n - 2}}} \right)}}

It means secant method requires two initial values that are close to the root.

If we take initially values as x0 and x1, we construct a line through the points (x0, f (x0)) and (x1, f(x1))

By this slope of equation will be:

y=;f(x1)f(x0)x1x0(xx1)+f(x1)y = ;\frac{{f\left( {{x_1}} \right) - f\left( {{x_0}} \right)}}{{{x_1} - {x_0}}}\left( {x - {x_1}} \right) + f\left( {{x_1}} \right)

The root of the equation will be when y =0;

x=;x1f;(x1)x1x0f(x1)f(x0)x = ;{x_1} - f;\left( {{x_1}} \right)\frac{{{x_1} - {x_0}}}{{f\left( {{x_1}} \right) - f\left( {{x_0}} \right)}}

We then use this new value of x as x2 and repeat the process using x1 and x2. Continue this process until higher precision is reached.  After all iterations

xn=;xn1f(xn1)xn1;xn2f(xn1)f(xn2){x_n} = ;{x_{n - 1}} - f\left( {{x_{n - 1}}} \right)\frac{{{x_{n - 1}} - ;{x_{n - 2}}}}{{f\left( {{x_{n - 1}}} \right) - f\left( {{x_{n - 2}}} \right)}}

According to above program, this is equivalent to :

xt  =  xb – (xb - xa) fb / (fb – f (xa))

52

Consider the C program below.

#include <stdio.h>

int *A, stkTop;

int stkFunc(int opcode, int val)

{

static int size = 0, stkTop = 0;

switch (opcode) {

case - 1: size = val; break;

case 0: if (stkTop < size) A[stkTop++ ] = val; break;

default: if (stkTop) return A[ - - stkTop];

}       

      return - 1;

}

int main()

{

      int B[20]; A = B; stkTop = - 1;

      stkFunc ( - 1, 10);

      stkFunc ( 0, 5);

      stkFunc ( 0, 10);

      printf ("%d\n", stkFunc(1, 0) + stkFunc(1, 0));

}    

The value printed by the above program is __________.

53

Consider the sequence of machine instructions given below:

MUL                       R5, R0, R1

DIV                         R6, R2, R3

ADD                       R7, R5, R6

SUB                       R8, R7, R4

In the above sequence, R0 to R8 are general purpose registers. In the instructions shown, the first register stores the result of the operation performed on the second and the third registers. This sequence of instructions is to be executed in a pipelined instruction processor with the following 4 stages: (1) Instruction Fetch and Decode (IF), (2) Operand Fetch (OF), (3) Perform Operation (PO) and (4) Write back the result (WB). The IF, OF and WB stages take 1 clock cycle each for any instruction. The PO stage takes 1 clock cycle for ADD or SUB instruction, 3 clock cycles for MUL instruction and 5 clock cycles for DIV instruction. The pipelined processor uses operand forwarding from the PO stage to the OF stage. The number of clock cycles taken for the execution of the above sequence of instructions is ________.

54

Consider a processor with byte - addressable memory. Assume that all registers, including Program Counter (PC) and Program Status Word (PSW), are of size 2 bytes. A stack in the main memory is implemented from memory location (0100)16 and it grows upward. The stack pointer (SP) points to the top element of the stack. The current value of SP is (016E)16. The CALL instruction is of two words, the first word is the op - code and the second word is the starting address of the subroutine (one word = 2 bytes). The CALL instruction is implemented as follows:

• Store the current value of PC in the stack

• Store the value of PSW register in the stack

• Load the starting address of the subroutine in PC

The content of PC just before the fetch of a CALL instruction is (5FA0)16. After execution of the CALL instruction, the value of the stack pointer is

  1. ((a))

    (016A)16

  2. ((b))

    (016C)16

  3. ((c))

    (0170)16

  4. ((d))

    (0172)16

Show Answer
Answer: ((d))

(0172)16

Current value of stack pointer = 016E

The stack pointer is used to point the top element of the stack, here the value of SP = (016E)16

Before the fetch of the CALL instruction, value of PC = (5FA0)16

First, we have to load the current value of PC into memory stack, it will take 2 Bytes 

And then we have to push PSW register, stack pointer again incremented by 2, So stack pointer finally incremented by 4.

So now the value of SP = (016E)16   +   4   = (0172)16 after execute CALL instruction.

55

The number of min - terms after minimizing the following Boolean expression is _________.

[𝐷′ + 𝐴𝐵′ + 𝐴′𝐶 + 𝐴𝐶 ′𝐷 + 𝐴′𝐶 ′𝐷]’

56

Let (𝑥) = 𝑥 −(1/3) and 𝐴 denote the area of the region bounded by 𝑓(𝑥) and the X – axis, when 𝑥 varies from − 1 to 1 Which of the following statements is/are TRUE?

I) 𝑓 is continuous in [−1, 1]

II) 𝑓 is not bounded in [−1, 1]

III) 𝐴 is nonzero and finite

  1. ((a))

    II only

  2. ((b))

    III only

  3. ((c))

    II and III only

  4. ((d))

    I, II and III

Show Answer
Answer: ((c))

II and III only

(I) False: f(x) is not defined at x = 0

(II) True: Range of f is ( - µ, µ)

(III) True: \(\mathop \smallint \limits_{ - 1}^1 {x^{ - \frac{1}{3}}}dx; = ;2\mathop \smallint \limits_0^1 {x^{ - \frac{1}{3}}}dx; = ;3\)

57

Perform the following operations on the matrix \(\left[ {\begin{array}{*{20}{c}} 3&4&{45}\ 7&9&{105}\ {13}&2&{195} \end{array}} \right]\)

i) Add the third row to the second row

ii) Subtract the third column from the first column.

The determinant of the resultant matrix is ________.

58

The number of onto functions (subjective functions) from set 𝑋 = {1, 2, 3, 4} to set 𝑌 = {𝑎, 𝑏, 𝑐} is __________.

59

Let 𝑋 and 𝑌 denote the sets containing 2 and 20 distinct objects respectively and 𝐹 denote the set of all possible functions defined from 𝑋 to 𝑌. Let 𝑓 be randomly chosen from 𝐹. The probability of 𝑓 being one - to - one is ________.

60

Consider the alphabet Σ = {0, 1}, the null/empty string 𝜆 and the sets of strings X0, X1, and X2 generated by the corresponding non - terminals of a regular grammar. X0, X1, and X2 are related as follows.

X0 = 1 X1

X1 = 0 X1 + 1 X2

X2 = 0 X1 + {𝜆}

Which one of the following choices precisely represents the strings in X0?

  1. ((a))

    10(0* + (10)*)1

  2. ((b))

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

  3. ((c))

    1(0 + 10)*1

  4. ((d))

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

Show Answer
Answer: ((c))

1(0 + 10)*1

X0 = 1 X1

X1 = 0 X1 + 1 X2

X2 = 0 X1 + {λ}

Equivalent FA is:

Hence regular expression is:

1(0 + 10)∗1

61

A graph is self - complementary if it is isomorphic to its complement. For all self - complementary graphs on 𝑛 vertices, 𝑛 is

  1. ((a))

    A multiple of 4

  2. ((b))

    Even

  3. ((c))

    Odd

  4. ((d))

    Congruent to 0 𝑚od 4, or, 1 𝑚od 4.

Show Answer
Answer: ((d))

Congruent to 0 𝑚od 4, or, 1 𝑚od 4.

w.k.t. Gn;+;Gˉn;=;kn{G_n}; + ;{\bar G_n}; = ;{k_n}

\(# edges;in;{K_n}; = ;{n_{{c_2}}}\)

Also self - complimentary graph Gn has half of the total number of edges in kn.

\(\therefore ;# edges;in;{G_n}; = ;\frac{{{n_{{c_2}}}}}{2}; = ;some;natural;number.\)

;nc2;=;2k\therefore ;{n_{{c_2}}}; = ;2k      where k ϵ N

n(n1)2;=;2k\frac{{n\left( {n - 1} \right)}}{2}; = ;2k

;n(n1)4\therefore ;\frac{{n\left( {n - 1} \right)}}{4} must be a natural number

Thus 4 should be a factor of n or (n – 1)

62

In a connected graph, a bridge is an edge whose removal disconnects a graph. Which one of the following statements is true?

  1. ((a))

    A tree has no bridges

  2. ((b))

    A bridge cannot be part of a simple cycle

  3. ((c))

    Every edge of a clique with size ≥ 3 is a bridge (A clique is any complete sub graph of a graph)

  4. ((d))

    A graph with bridges cannot have a cycle

Show Answer
Answer: ((b))

A bridge cannot be part of a simple cycle

(A) FALSE:

e.g.

The only edge in the above tree is bridge.

(B) TRUE:

If an edge is the part of the cycle than its removal will not disconnect the graph.

(C) FALSE:

e.g. 

Here no edge of the clique is a bridge

(D) FALSE:

e.g. 

63

Which one of the following well - formed formulae is a tautology?

  1. ((a))

    ∀𝑥 ∃𝑦 (𝑥, ) ↔ ∃𝑦 ∀𝑥 𝑅(𝑥, 𝑦)

  2. ((b))

    (∀𝑥 [∃𝑦 (𝑥, ) → 𝑆(𝑥, 𝑦)]) → ∀𝑥∃𝑦 𝑆(𝑥, 𝑦)

  3. ((c))

    [∀𝑥 ∃𝑦 (𝑃(𝑥, 𝑦) → 𝑅(𝑥, 𝑦)]↔[∀𝑥 ∃𝑦 (¬ 𝑃(𝑥, 𝑦) ∨ 𝑅(𝑥, 𝑦)]

  4. ((d))

    ∀𝑥 ∀𝑦 (𝑥, ) → ∀𝑥 ∀𝑦 𝑃(𝑦, 𝑥)

Show Answer
Answer: ((c))

[∀𝑥 ∃𝑦 (𝑃(𝑥, 𝑦) → 𝑅(𝑥, 𝑦)]↔[∀𝑥 ∃𝑦 (¬ 𝑃(𝑥, 𝑦) ∨ 𝑅(𝑥, 𝑦)]

Option 1: ∀ x ∃y R (x, y) ↔ ∃y ∀ x R(x, y)

∀ x ∃y R (x, y) is not equivalent to ∃y ∀ x R(x, y).

Let R (x, y) represent x > x for the set of numbers as the universe

Example:

∀ x ∃y R (x, y) means for every number x, there exist a number y that is less than x which is true.

While ∃y ∀ x R(x, y) means there is a number that is less than every number. Which is false

Option 2: (∀ x (∃y R(x, y) → S (x, y)]) → ∀ x ∃y S(x, y)

This option is not a tautology. It is a false expression because two predicates can’t be equivalent to single predicate on right side.

Option 4: ∀ x ∀ y P (x, y) → ∀ x ∀ y P (y, x)

Consider P (x, y) as x < y

then ∀ x ∀ y P (x, y) represents for every number x, all y are greater than x.

∀ x ∀ y P (y, x), it means for every number y, there is every x which is greater than y.

These two statements are not equivalent at the same time. So, it is not a tautology.

Option 3:

[∀x ∃y (P(x, y) → R(x, y)] ↔ [∀ x ∃y (¬ P(x, y) ∨ R (x, y)]

As, we know that P → R = ¬ P + R

Here, it is the same statement as that of implication, so it is a tautology.

64

Which one of the following assertions concerning code inspection and code walkthrough is true?

  1. ((a))

    Code inspection is carried out once the code has been unit tested

  2. ((b))

    Code inspection and code walkthrough are synonyms

  3. ((c))

    Adherence to coding standards is checked during code inspection

  4. ((d))

    Code walkthrough is usually carried out by an independent test team

Show Answer
Answer: ((c))

Adherence to coding standards is checked during code inspection

Concept:

Code inspection:

It is the most formal type of review, which is a kind of static testing to avoid the defect multiplication at a later stage. The main purpose of code inspection is to find defects and it can also spot any process improvement if any.  It usually involves peer examination of the code and each one has a defined set of roles.

Code walkthrough:

It is a peer review in which a programmer leads the review process and the other team members ask questions and spot possible errors against development standards and other issues. This meeting is usually led by the author of the document under review and attended by other members of the team. Review sessions may be formal or informal.

Explanation:

Option 1 (FALSE)

Reason: Unit testing is not necessary before code inspection.

Option 2 (FALSE)

Reason: Code inspection and code walkthrough are not same as explained.

Option 4 (FALSE)

Reason: Code walkthrough is done by programmer lead members or designer of development team or other interested parties.

Option 3 (TRUE)

Reason: Adherence to coding standards is checked during code inspection.

65

A half adder is implemented with XOR and AND gates. A full adder is implemented with two half adders and one OR gate. The propagation delay of an XOR gate is twice that of an AND/OR gate. The propagation delay of an AND/OR gate is 1.2 microseconds. A 4 - bit ripple - carry binary adder is implemented by using four full adders. The total propagation time of this 4 - bit binary adder in microseconds is ________.(Do not consider parallelization).

Attempt this paper under real exam conditions

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

Start Timed Attempt