## GATE 1995

Question 1 |

A single instruction to clear the lower four bits of the accumulator in 8085 assembly language?

XRI OFH | |

ANI FOH | |

XRI FOH | |

ANI OFH |

→ The XOR's don't reliably clear random bits and ANI OF clears the upper nibble, not the lower nibble.

Question 2 |

Which of the following statements is true?

ROM is a Read/Write memory | |

PC points to the last instruction that was executed | |

Stack works on the principle of LIFO | |

All instructions affect the flags |

Question 3 |

In a vectored interrupt

the branch address is assigned to a fixed location in memory | |

the interrupt source supplies the branch information to the processor through an interrupt vector | |

the branch address is obtained from a register in the processor | |

none of the above |

Question 4 |

In the following Pascal program segment, what is the value of X after the execution of the program segment?

X:=-10; Y:=20;

If X > Y then if X < 0 then X:=abs(X) else X:=2*X;

10 | |

-20 | |

-10 | |

None |

X = -10

Question 5 |

Merge sort uses

Divide and conquer strategy | |

Backtracking approach | |

Heuristic search | |

Greedy approach |

Question 6 |

The principle of locality justifies the use of

interrupts | |

DMA | |

Polling | |

Cache Memory |

→ The things which are used more frequently those are stored in locality of reference.

→ For this purpose we use the cache memory.

Question 7 |

In a paged segmented scheme of memory management, the segment table itself must have a page table because

the segment table is often too large to fit in one page | |

each segment is spread over a number of pages | |

segment tables point to page table and not to the physical locations of the segment | |

the processor’s description base register points to a page table | |

Both A and B |

Segment paging is different from paged segmentation.

Question 8 |

Which of the following page replacement algorithms suffers from Belady’s anamoly?

Optimal replacement | |

LRU | |

FIFO | |

Both (A) and (C) |

Question 9 |

In some programming languages, an identifier is permitted to be a letter following by any number of letters or digits. If L and D denote the sets of letters and digits respectively, which of the following expressions defines an identifier?

(L ∪ D) ^{+} | |

L(L ∪ D)* | |

(L⋅D)* | |

L⋅(L⋅D)* |

L(L ∪ D)*

Question 10 |

Consider a grammar with the following productions

S → a∝b|b∝c| aB S → ∝S|b S → ∝b b|ab S ∝ → bd b|b

The above grammar is:

Context free | |

Regular | |

Context sensitive | |

LR(k) |

Because LHS must be single non-terminal symbol.

S ∝→ b [violates CSG]

→ Length of RHS production must be atleast same as that of LHS.

Extra information is added to the state by redefining iteams to include a terminal symbol as second component in this type of grammar.

Ex: [A → αβa]

A → αβ is a production, a is a terminal (or) right end marker $, such an object is called LR(k).

So, answer is (D) i.e., LR(k).

Question 11 |

What are x and y in the following macro definition?

macro Add x,y Load y Mul x Store y end macro

Variables | |

Identifiers | |

Actual parameters | |

Formal parameters |

Question 12 |

What is the distance of the following code 000000, 010101, 000111, 011001, 111111?

2 | |

3 | |

4 | |

1 |

010101 ⊕ 011001 = 001100

Question 13 |

Which of the following strings can definitely be said to be tokens without looking at the next input character while compiling a Pascal program?

I. begin II. program III. <>

I | |

II | |

III | |

All of the above |

Question 14 |

A linker is given object modules for a set of programs that were compiled separately. What information need to be included in an object module?

Object code | |

Relocation bits | |

Names and locations of all external symbols defined in the object module
| |

Absolute addresses of internal symbols |

To link to external symbols it must know the location of external symbols.

Question 15 |

Which scheduling policy is most suitable for a time shared operating system?

Shortest Job First | |

Round Robin | |

First Come First Serve | |

Elevator |

Question 16 |

For merging two sorted lists of sizes m and n into a sorted list of size m+n, we required comparisons of

O(m) | |

O(n) | |

O(m+n) | |

O(logm+logn) |

In worst case, no. of comparisons is m+n-1.

Then we require O(m+n) comparisons to merging two sorted lists.

Question 17 |

A binary tree T has n leaf nodes. The number of nodes of degree 2 in T is:

log _{2} n | |

n - 1 | |

n | |

2 ^{n} |

The no. of subtrees of a node is called the degree of the node. In a binary tree, all nodes have degree 0, 1 and 2.

The degree of a tree is the maximum degree of a node in the tree. A binary tree is of degree 2.

The number of nodes of degree 2 in T is "n - 1".

Question 18 |

The probability that a number selected at random between 100 and 999 (both inclusive) will not contain the digit 7 is:

16/25 | |

(9/10) ^{3} | |

27/75 | |

18/25 |

Question 19 |

Let R be a symmetric and transitive relation on a set A. Then

R is reflexive and hence an equivalence relation | |

R is reflexive and hence a partial order
| |

R is reflexive and hence not an equivalence relation | |

None of the above |

i) Symmetric

ii) Reflexive

iii) Transitive

If a relation is said to be symmetric and transitive then we can't say the relation is reflexive and equivalence.

Question 20 |

The number of elements in he power set P (S) of the set S = {(φ), 1, (2, 3)} is:

2 | |

4 | |

8 | |

None of the above |

P(S) = {φ, {{φ}}, {1}, {{2, 3}}, {{φ}, 1}, {1, {2, 3}}, {{φ}, 1, {2, 3}}}

In P(S) it contains 8 elements.

Question 21 |

In the interval [0, π] the equation x = cos x has

No solution | |

Exactly one solution | |

Exactly two solutions | |

An infinite number of solutions |

x & cos(x) are intersecting at only one point.

Question 22 |

If at every point of a certain curve, the slope of the tangent equals −2x/y the curve is

a straight line | |

a parabola | |

a circle | |

an ellipse |

Question 23 |

The value of k for which 4x^{2} - 8xy + ky^{2} = 0 does not represent a pair of straight lines (both passing through the origin) is:

0 | |

2 | |

9 | |

3 |

Question 24 |

The rank of the following (n + 1)×(n+1) matrix, where a is a real number is

1 | |

2 | |

n | |

Depends on the value of a |

Question 25 |

The minimum number of edges in a connected cyclic graph on n vertices is:

n - 1 | |

n | |

n + 1 | |

None of the above |

In cyclic graph:

No. of edges = No. of vertices

⇒ n = n

Question 26 |

The capacity of a memory unit is defined by the number of words multiplied by the number of bits/word. How many separate address and data lines are needed for a memory of 4K × 16?

10 address, 16 data lines | |

11 address, 8 data lines | |

12 address, 16 data lines | |

12 address, 12 data lines |

^{m}× n

m = no. of address lines

n = no. of data lines

Given, 4K × 16 = 2

^{12}× 16

Address lines = 12

Data lines = 16

Question 27 |

Assume that X and Y are non-zero positive integers. What does the following Pascal program segment do?

while X <>Y do if X > Y then X := X – Y else Y := Y – X; write(X);

Computes the LCM of two numbers | |

Divides the larger number by the smaller number | |

Computes the GCD of two numbers | |

None of the above |

1

^{st}pass : X=3 and Y=2

2

^{nd}pass : X=1 and Y=2

3

^{rd}pass : X=1 and Y=1

Write(X), which writes 1. Which is nothing but GCD of 3 & 5.

Question 28 |

What is the value of X printed by the following program?

program COMPUTE (input, output); var X:integer; procedure FIND (X:real); begin X:=sqrt(X); end; begin X:=2 Find(X) Writeln(X) end

2 | |

√2 | |

Run time error | |

None of the above |

X in the procedure FIND is a local variable. No change will be reflected in global variable X.

Question 29 |

What values of A, B, C and D satisfy the following simultaneous Boolean equations?

A = 1, B = 0, C = 0, D = 1 | |

A = 1, B = 1, C = 0, D = 0 | |

A = 1, B = 0, C = 1, D = 1 | |

A = 1, B = 0, C = 0, D = 0 |

Question 30 |

The sequence …………… is an optimal non-preemptive scheduling sequence for the following jobs which leaves the CPU idle for …………… unit(s) of time.

{3,2,1),1 | |

(2,1,3},0 | |

{3,2,1),0 | |

{1,2,3},5 |

So, (B) and (C) will be eliminated.

Now in (A) and (D):

For r(A),

So, idle time is between 0 to 1 which in case of option (A).

For option(D),

We can see there is no idle time at all, but in option given idle time is 5, which is not matching with our chart. So option (D) is eliminated.

Therefore, the correct sequence is option (A).

Question 31 |

The address sequence generated by tracing a particular program executing in a pure demand paging system with 100 records per page with 1 free main memory frame is recorded as follows. What is the number of page faults?

0100, 0200, 0430, 0499, 0510, 0530, 0560, 0120, 0220, 0240, 0260, 0320, 0370

13 | |

8 | |

7 | |

10 |

01, 02, 04, 04, 05, 05, 05, 01, 02, 02, 02, 03, 03.

Clearly 7 page faults.

Question 32 |

If the cube roots of unity are 1, ω and ω^{2}, then the roots of the following equation are (x - 1)^{3} + 8 = 0

-1, 1 + 2ω, 1 + 2ω ^{2} | |

1, 1 - 2ω, 1 - 2ω ^{2} | |

-1, 1 - 2ω, 1 - 2ω ^{2} | |

-1, 1 + 2ω, -1 + 2ω ^{2} |

Question 33 |

A language with string manipulation facilities uses the following operations

head(s): first character of a string tail(s): all but the first character of a string concat(s1,s2):s1 s2 for the string acbc what will be the output of concat(head(s), head(tail(tail(s))))

ac | |

bc | |

ab | |

cc |

concat (a, head (tail (cbc)))

concat (a, head (bc))

concat (a, b)

ab

Question 34 |

A shift reduce parser carries out the actions specified within braces immediately after reducing with the corresponding rule of grammar

S → xxW {print "1"} S → y {print "2"} W → Sz {print "3"}

What is the translation of xxxxyzz using the syntax directed translation scheme described by the above rules?

23131 | |

11233 | |

11231 | |

33211 |

⇒ 23131

Note SR is bottom up parser.

Question 35 |

A variant record in Pascal is defined by

type varirec = record number : integer; case (var1,var2) of var1: (x,y : integer); var2: (p.q.: real) end end

Suppose an array of 100 records was declared on a machine which uses 4 bytes for an integer and 8 bytes for a real. How much space would the compiler have to reserve for the array?

2800 | |

2400 | |

2000 | |

1200 |

Question 36 |

The number of 1’s in the binary representation of

(3*4096 + 15*256 + 5*16 + 3) are:

8 | |

8 | |

10 | |

12 |

^{12}

= (11000000000000)

_{2}

15 × 256 = 15 × 2

^{8}

= (111100000000)

_{2}

5 × 16 = 5 × 2

^{4}

= (1010000)

_{2}

3 = (11)

_{2}

Hence, all binary numbers,

∴ 101's

Question 37 |

A unit vector perpendicular to both the vectors a = 2i - 2j + k and b = 1 + j - 2k is:

1/√3 (1+j+k) | |

1/3 (1+j-k) | |

1/3 (1-j-k) | |

1/√3 (1+j-k) | |

None of the above. |

Question 38 |

A bag contains 10 white balls and 15 black balls. Two balls are drawn in succession. The probability that one of them is black and the other is white is:

2/3 | |

4/5 | |

1/2 | |

2/1 |

Probability of first ball black and second one white is,

Question 39 |

The iteration formula to find the square root of a positive real number b using the Newton Raphson method is

None of the above |

Question 40 |

In a virtual memory system the address space specified by the address lines of the CUP must be __________ than the physical memory size and _______ than the secondary storage size.

smaller, smaller | |

smaller, larger | |

larger, smaller | |

larger, larger |

Question 41 |

Let A be the set of all non-singular matrices over real number and let* be the matrix multiplication operation. Then

A is closed under* but < A, *> is not a semigroup | |

Question 42 |

The solution of differential equation y'' + 3y' + 2y = 0 is of the form

C _{1}e^{x} + C_{2}e^{2x} | |

C _{1}e^{-x} + C_{2}e^{3x} | |

C _{1}e^{-x} + C_{2}e^{-2x} | |

C _{1}e^{-2x} + C_{2}2^{-x} |

Question 43 |

If the proposition ¬p ⇒ ν is true, then the truth value of the proposition ¬p ∨ (p ⇒ q), where ¬ is negation, ‘∨’ is inclusive or and ⇒ is implication, is

true | |

multiple valued | |

false | |

cannot be determined |

So, either p or q must be True.

Now,

¬p ∨ (p → q)

= ¬p ∨ (¬p ∨ q)

= ¬p ∨ q

Since nothing c an be said about the truth values of p, it implies that ¬p ∨ q can also be True or False. Hence, the value cannot be determined.

Question 44 |

Which of the following definitions below generates the same language as L, where L = {x^{n}y^{n} such that n >= 1}?

I. E → xEy|xy II. xy|(x^{+}xyy^{+}) III. x^{+}y^{+}

I only | |

I and II | |

II and III | |

II only |

Question 45 |

The postfix expression for the infix expression

A + B*(C + D)/F + D*E is:

AB + CD + *F/D + E* | |

ABCD + *F/DE*++ | |

A *B + CD/F *DE++ | |

A + *BCD/F* DE++ | |

None of the above |

A B C D + * F / + D E * +

Question 46 |

Which of the following statements is true?

- I. As the number of entries in a hash table increases, the number of collisions increases.

II. Recursive programs are efficient

III. The worst case complexity for Quicksort is O(n

^{2})

I and II | |

II and III | |

I and IV | |

I and III |

Recursive program requires stack for storing the function state. Any recursive program can be rewritten as an iterative one. Advantage of recursion is "less programming effort", while it always lags behind iterative one in terms of performance.

Question 47 |

A finite state machine with the following state table has a single input x and a single out z.

If the initial state is unknown, then the shortest input sequence to reach the final state C is:

01 | |

10 | |

101 | |

110 |

If A is the start state, shortest sequence is 10 'or' 00 to reach C.

If B is the start state, shortest sequence is 0 to reach C.

If C is the start state, shortest sequence is 10 or 00 to reach C.

If D is the start state, shortest sequence is 0 to reach C.

∴ (B) is correct.

Question 48 |

Let Σ = {0,1}, L = Σ* and R = {0^{n}1^{n} such that n >0} then the languages L ∪ R and R are respectively

regular, regular | |

not regular, regular | |

regular, not regular | |

not regular, no regular |

Question 49 |

A computer system has a 4K word cache organized in block-set-associative manner with 4 blocks per set, 64 words per block. The number of its in the SET and WORD fields of the main memory address format is:

15, 40 | |

6, 4 | |

7, 2 | |

4, 6 |

^{12}/ 2

^{8}= 2

^{4}

So we need 4 set bits.

And,

64 words per block means WORD bit is 6-bits.

So, answer is option (D).

Question 50 |

Consider the following high level program segment. Give the contents of the memory locations for variables W, X, Y and Z after the execution of the program segment. The values of the variables A and B are 5 CH and 92H, respectively. Also indicate error conditions if any.

var A, B, W, X, Y :unsigned byte; Z :unsigned integer, (each integer is represented by two bytes) begin X :=A+B Y :=abs(bA-b); W :=A-B Z :=A*B End;

Theory Explanation. |

Question 51 |

(a) Consider the following Pascal function where A and B are non-zero positive integers. What is the value of GET(3,2)?

function GET(A,B:integer);integer; begin if B = 0 then GET:=1 else if A < B then GET:=0 else GET:=GET(A-1,B)+GET(A-1,B-1) end ;

(b) The Pascal procedure given for computing the transpose of an N × N (N>1) matrix A of integers has an error. Find the error and correct it.

Assume that the following declaration are made in the main program

const MAXSIZE=20; type INTARR=array [1.,MAXSIZE,1..MAXSIZE] of integer; Procedure TRANSPOSE (var A: INTARR; N : integer); var I, J, TMP, integer; begin for I:=1 to NO – 1 do for J:=1 to N do begin TMP: = A[I,J]; A[I,J]:=A[J,I]; A(J,I):=TMP end end;

Theory Explanation. |

Question 52 |

A computer installation has 1000k of main memory. The jobs arrive and finish in the following sequences.

Job 1 requiring 200k arrives Job 2 requiring 350k arrives Job 3 requiring 300k arrives Job 1 finishes Job 4 requiring 120k arrives Job 5 requiring 150k arrives Job 6 requiring 80k arrives

(a) Draw the memory allocation table using Best Fit and First fit algorithms.

(b) Which algorithm performs better for this sequence?

Theory Explanation. |

Question 53 |

What is the number of binary trees with 3 nodes which when traversed in postorder give the sequence A, B, C? Draw all these binary trees.

Theory Explanation. |

Question 54 |

(a) Determine the number of divisors of 600.

(b) Compute without using power series expansion

Theory Explanation. |

Question 55 |

Construct the LL(1) table for the following grammar.

1. Expr → _Expr 2. Expr → (Expr) 3. Expr → Var Expr Tail 4. ExprTail → _Expr 5. ExprTail → λ 6. Var → Id Var Tail 7. VarTail → (Expr) 8. VarTail → λ 9. Goal → Expr$

Theory Explanation. |

Question 56 |

(a) Translate the arithmetic expression a*-(b+c) into syntax tree.

(b) A grammar is said to have cycles if it is the case that

A ⇒ +_{A}

Show that no grammar that has cycles can be LL(I).

Theory Explanation. |

Question 57 |

(a) Using the scope rules of Pascal determine the declaration that apply to each occurrence of the names A and B in the following program segment.

procedure T(U, V, X, Y: integer); var A: record A, B : integer end; B: record B, A : integer end; begin with A do begin A:=4; B:=V end; with B do begin A:=X; B:=Y end end;

(b) Find the lexical errors in the following Pascal statement:

if A > 1, then B = 2.5A else read (C);

Theory Explanation. |

Question 58 |

Let L be a language over ∑ i.e., *L ≤ ∑ . Suppose L satisfies the two conditions given below

(i) L is in NP and

(ii) For every n, there is exactly one string of length n that belongs to L.

Let L^{c} be the complement of L over ∑*. Show that L^{c} is also in NP.

Theory Explanation. |

Question 59 |

Consider the following sequence of numbers

92, 37, 52, 12, 11, 25

Use bubble sort to arrange the sequence in ascending order. Give the sequence at the end of each of the first five passes.

Theory Explanation. |

Question 60 |

Obtain the principal (canonical) conjunctive normal form of the propositional formula

(p ∧ q) V (¬q ∧ r)

Where ‘∧’ is logical and, ‘v’ is inclusive or and ¬ is negation.

Theory Explanation. |

Question 61 |

If the overhead for formatting a disk is 96 bytes for 4000 byte sector,

(a) Compute the unformatted capacity of the disk for the following parameters:

Number of surfaces: 8 Outer diameter of the disk: 12 cm Inner diameter of the disk: 4 cm Inter track space: 0.1 mm Number of sectors per track: 20

(b) if the disk in (a) is rotating at 360 rpm, determine the effective data transfer rate which is defined as the number of bytes transferred per second between disk and memory.

Theory Explanation. |

Question 62 |

(a) Implement a circuit having the following output expression using an inverter and NAND gate .

(b) What is the equivalent minimal Boolean expression (in sum of products form)
for the Karnaugh map given below?

Theory Explanation. |

Question 63 |

The following is an 8085 assembly language program:

MVI B, OAH MVI A, 05H LXI H, IC40H CALL SUB HLT SUB CMP M RZ INX H DCR B JNZ SUB RET

(a) What does the program do?

(b) What are the contents of registers A and B initially?

(c) What are the contents of HL register pair after the execution of the program?

Theory Explanation. |

Question 64 |

(a) An asynchronous serial communication controller that uses a start stop scheme for controlling the serial I/O of a system is programmed for a string of length seven bits, one parity bit (odd parity) and one step bit. The
transmission rate is 1200 bits/second.

(i) What is the complete bit stream that is transmitted for the string ‘0110101’?

(ii) How many such strings can be transmitted per second?

(b) Consider a CRT display that has a text mode display format of 80 × 25 characters with a 9 × 12 character cell. What is the size of the video buffer RAM for the display to be used in monochrome (1 bit per pixel) graphics mode?

Theory Explanation. |

Question 65 |

The following is an incomplete Pascal function to convert a given decimal integer (in the range -8 to +7) into a binary integer in 2’s complement representation. Determine the expression A, B, C that complete program.

function TWOSCOMP (N:integer):integer; var RAM, EXPONENT:integer; BINARY :integer; begin if(N>=-8) and (N<=+7) then begin if N<0 then N : = A; BINARY:=0; EXPONENT:=1; while N<>0 do begin REM:=N mod 2; BINARY:=BINARY + B*EXPONENT; EXPONENT:=EXPONENT*10; N := C end TWOSCOMP:=BINARY end end;

Theory Explanation. |

Question 66 |

Consider the following program segment for concurrent processing using semaphore operators P and V for synchronization. Draw the precedence graph for the statements S1 to S9.

var a, b, c, d, e, f, g, h, i, j, k : semaphore; begin cobegin begin S1; V(a); V(b) end; begin P(a); S2; V(c); V(d) end; begin P(c); S4; V(c) end; begin P(d); S5; V(f) end; begin P(e); P(f); S7; V(k) end; begin P(b); S3;V(g);V(h) end; begin P(g); S6; V(i) end; begin P(h); P(i); S8; V(j) end; begin P(j); P(j); P(k); S9 end; coend end;

Theory Explanation. |

Question 67 |

The head of a moving head disk with 100 tracks numbered 0 to 99 is currently serving a request at tract 55. If the queue of requests kept in FIFO order is

10, 70, 75, 23, 65

Which of the two disk scheduling algorithms FCFS (First Come First Served) and SSTF (Shortest Seek Time First) will require less head movement? Find the head movement for each of the algorithms.

Theory Explanation. |

Question 68 |

Let G_{1} and G_{2} be subgroups of a group G.

(a) Show that G_{1} ∩ G_{2} is also a group of G.

(b) Is G_{1} ∪ G_{2} always a subgroup of G?

Theory Explanation. |

Question 69 |

How many minimum spanning trees does the following graph have? Draw them. (Weights are assigned to the edge).

Theory Explanation. |

Question 70 |

Prove using mathematical induction for n≥5, 2^{n} > n^{2}

Theory Explanation. |

Question 71 |

Prove that in finite graph, the number of vertices of odd degree is always even.

Theory Explanation. |

Question 72 |

(a) Find the minimum value of 3 - 4x + 2x^{2}.

(b) Determine the number of positive integers (≤ 720) which are not divisible by
any of numbers 2, 3, and 5.

Theory Explanation. |

Question 73 |

(a) Consider the relation scheme R(A, B, C) with the following functional dependencies:

A, B → C, C → A

Show that the scheme R is the Third Normal Form (3NF) but not in Boyce-Code Normal Form (BCNF).

(b) Determine the minimal keys of relation R.

Theory Explanation. |

Question 74 |

Consider the relation scheme.

AUTHOR (ANAME, INSTITUTION, ACITY, AGE) PUBLISHER (PNAME, PCITY) BOOK (TITLE, ANAME, PNAME)

Express the following queries using (one or more of )SELECT, PROJECT, JOIN and DIVIDE operations.

(a) Get the names of all publishers.

(b) Get values of all attributes of all authors who have published a book for the
publisher with PNAME = ‘TECHNICAL PUBLISHERS’.

(c) Get the names of all authors who have published a book for any publisher located in Madras.

Theory Explanation. |

Question 75 |

A sequence of two instructions that multiplies the contents of the DE register pair by 2 and stores the result in the HL register pair (in 8085 assembly language) is:

XCHG and DAD B | |

XTHL and DAD H | |

PCHL and DAD D | |

XCHG and DAD H |