CS and IT Gate 2015 Set-2 Questions with Answer

Ques 1 Gate 2015 Set-2


If p, 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 of (p × q) / (r × s) if (p × q) > (r × s) OR remainder of (r × s) / (p × q) if (r × s) > (p × q)
Also a function fgh (p, q, r, s) = f(p, q, r, s) × g(p, q, r, s) × h(p, q, r, s).

Also the same operation are valid with two variable functions of the form f(p, q).

What is the value of fg(h(2, 5, 7, 3), 4, 6, 8)?


(8) is the correct answer.

Given functions:
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 when larger product is divided by smaller product

We need to find: fg(h(2, 5, 7, 3), 4, 6, 8)

Let me start from the innermost function h(2, 5, 7, 3):
First, calculating the products:
p × q = 2 × 5 = 10
r × s = 7 × 3 = 21

Since (r × s) > (p × q), which means 21 > 10
h(2, 5, 7, 3) = remainder of 21 ÷ 10
h(2, 5, 7, 3) = 1

Now I need to find fg(1, 4, 6, 8):
Here fg means f × g (multiplication of f and g functions)

Calculating f(1, 4, 6, 8):
f(1, 4, 6, 8) = max(1, 4, 6, 8) = 8

Calculating g(1, 4, 6, 8):
g(1, 4, 6, 8) = min(1, 4, 6, 8) = 1

Therefore:
fg(1, 4, 6, 8) = f(1, 4, 6, 8) × g(1, 4, 6, 8)
fg(1, 4, 6, 8) = 8 × 1
fg(1, 4, 6, 8) = 8

Answer: fg(h(2, 5, 7, 3), 4, 6, 8) = 8

Ques 2 Gate 2015 Set-2


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

A

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

B

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

C

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

D

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


(English Grammar) is the correct answer.

Ques 3 Gate 2015 Set-2


If the list of letters, P, R, S, T, U is an arithmetic sequence, which of the following are also in arithmetic sequence?

I. 2P, 2R, 2S, 2T, 2U
II. P–3, R–3, S–3, T–3, U–3
III. P2, R2, S2, T2, U2

A

I only

B

I and II

C

II and III

D

I and III


(Reasoning) is the correct answer.

Ques 4 Gate 2015 Set-2


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

A

5.34

B

6.74

C

28.5

D

45.49


(Distance Time) is the correct answer.

Ques 5 Gate 2015 Set-2


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

A

fabric

B

textile

C

fibre

D

apparel


(English Grammar) is the correct answer.

Ques 6 Gate 2015 Set-2


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 5 kg
(II) The total weight of these poles is 160 kg more
than the total weight of two poles.

A

Statement I alone is not sufficient

B

Statement II alone is not sufficient

C

Either I or II alone is sufficient

D

Both statements I and II together are not sufficient.


(Aptitude) is the correct answer.

Ques 7 Gate 2015 Set-2


Choose the statement where underlined word is used correctly.

A

The industrialist had a personnel jet

B

I write my experience in my personnel diary

C

All personnel are being given the day off

D

Being religious is a personnel aspect


(English Grammar) is the correct answer.

Ques 8 Gate 2015 Set-2


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

A

Completely forgot --- don’t just know

B

Forgot completely --- don’t just know

C

Completely forgot --- just don’t know

D

Completely forgot --- just don’t know


(English Grammar) is the correct answer.

Ques 9 Gate 2015 Set-2


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 __________.


(a) is the correct answer.

Ques 10 Gate 2015 Set-2


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

A

ABCD EFGH

B

ABCD

C

HGFE DCBA

D

DCBA


(C Code) is the correct answer.

Ques 11 Gate 2015 Set-2


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

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.

B

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

C

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

D

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


(CFG) is the correct answer.

Ques 12 GATE 2015 SET-2


Match the following:

A

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

B

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

C

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

D

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


(a) is the correct answer.

Ques 13 GATE 2015 SET-2


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

A

5 and 7

B

6 and 7

C

5 and 5

D

7 and 8


(b) is the correct answer.

Unique Visitor Count

Total Unique Visitors

Loading......