Top Banner
Hyderabad | Delhi | Ahmedabad | Pune | Bhubaneswar | Bengaluru | Lucknow | Chennai | Vayawada | Vizag | Tirupathi | Kukatpally | Kolkata Questions with Detailed Solutions GATE-2020 ACE Engineering Academy has taken utmost care in preparing the GATE-2020 Examination Solutions. Discrepancies, if any, may please be brought to our notice. ACE Engineering Academy do not owe any responsibility for any damage or loss to any person on account of error or omission in these solutions. ACE Engineering Academy is always in the fore front of serving the students, irrespective of the examination type (GATE/ESE/PSUs/PSC/GENCO/TRANSCO etc.,). All Queries related to GATE-2020 Solutions are to be sent to the following email address [email protected] | Contact Us : 040 - 23234418, 19, 20 www.aceenggacademy.com COMPUTER SCIENCE & INFORMATION TECHNOLOGY
28

COMPUTER SCIENCE & INFORMATION TECHNOLOGY

Feb 26, 2023

Download

Documents

Khang Minh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

Hyderabad | Delhi | Ahmedabad | Pune | Bhubaneswar | Bengaluru | Lucknow | Chennai | V�ayawada | Vizag | Tirupathi | Kukatpally | Kolkata

Questions with Detailed Solutions

GATE-2020

ACE Engineering Academy has taken utmost care in preparing the GATE-2020

Examination Solutions. Discrepancies, if any, may please be brought to our notice. ACE

Engineering Academy do not owe any responsibility for any damage or loss to any

person on account of error or omission in these solutions. ACE Engineering Academy is

always in the fore front of serving the students, irrespective of the examination type

(GATE/ESE/PSUs/PSC/GENCO/TRANSCO etc.,).

All Queries related to GATE-2020 Solutions are to be sent to the following email address

[email protected] | Contact Us : 040 - 23234418, 19, 20

www.aceenggacademy.com

COMPUTER SCIENCE & INFORMATION TECHNOLOGY

Page 2: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

GATE - 2020Computer Science & Information Technology

Question with Detailed Solutions08/02/20

SUBJECTWISE WEIGHTAGE

S. No. NAME OF THE SUBJECT 1 MARK QUESTIONS

2 MARKS QUESTIONS

01 Discrete Mathematics 3 6

02 Theory Computation 3 3

03 Compiler Design 2 1

04 Database Management Systems 2 3

05 Computer Networks 2 2

06 Operating Systems 2 7

07 Algorithms 1 1

08 Data Structures 4 3

09 Programming Languages 1 2

10 Digital Logic 0 1

11 Computer Organization & Architecture 5 1

Page 3: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

2 Computer Science & Information Technology

Section : General Aptitude

01. If P = 3, R = 27, T = 243, then Q + S = ____. (a) 110 (b) 40 (c) 80 (d) 9001. Ans:(d)Sol: From the given series follows P=3⇒31 Q=9⇒(3)2

R=27⇒(3)3

S=81⇒(3)4

T=243⇒(3)5

Q+S=9+81=90 ∴ option(d) is correct 02. His knowledge of the subject was excellent but his

classroom performance was______. (a) praiseworthy (b) desirable (c) extremely poor (d) good02. Ans: (c)Sol: The usage of 'but' expresses contradiction.

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

900800700

600

500

400

300200

100

0 2014

Rev

enue

(In

mill

ion

rupe

es)

2017 2018 2015 2016 Year

(a) 16.67 % loss (b) 20% profit (c) 16.67% profit (d) 20% loss

03. Ans: (b) Sol: From the given bar chart, The total expenditure = 500*5 = 2500 million The total revenue from 2014-2018 = 500 + 700 + 800 + 600 + 400 = 3000 million ∴ Profit = revenue − expenditure =3000−2500 = 500 million ∴ The profit on the total expenditure %

2500

500100 20#= =

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

Which one of the following statements can be inferred from the given passage?(A) Nation-states do not have environmental

concerns(B) Nation-states are responsible for providing

fresh water to billions of people(C) Billions of people are affected by melting

glaciers(D) Billions of people are responsible for man-

made emissions04. Ans: (c)

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

Page 4: COMPUTER SCIENCE & INFORMATION TECHNOLOGY
Page 5: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

3 Computer Science & Information Technology

b

a

(a) π[(b2− a2) + n (b−a)2]

(b) ( ( )b anb a

42 2 2�� � � �: D

(c) ( ( )b anb a

42 2 2�� � � �: D

(d) π[(b2 − a2) −n(b−a)2]05. Ans: (b)

Sol: Area of the Big circle = A = ∏ (b2−a2)

Radius of the smaller circles b a

2� �

Area of the smaller circles b a

2

2

��� �b l ( )b a

42��� �

Area of the 'n' number of smaller circles (blue)

( )B n b a4

2# ��� � �

The unpainted area avaiable in annular space

= A−B =∏(b2−a2) ( )n b a4

2# ��� �

[( ) ( ) ]b anb a

42 2 2��� � � �

∴Option (b) is correct

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

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

(a) GST is imposed on the production of goods and services

(b) GST includes all indirect taxes(c) GST is imposed at the point of usage of goods

and services(d) GST does not have a component specific to UT

06. Ans: (c)Sol: The second line states the answer

07. Two straight lines are drawn perpendicular to each other in X-Y plane, If aandbare the acute angles the straight lines make with X-axis, the a + bis ____.

(a) 90° (b) 120° (c) 60° (d) 180°07. Ans: (a)Sol: From the given data, the two straight lines P and

Q are perpendicular to each other in X−Y plane as follows

Y

Y

α β

P

XX

Q

a,bare the acute angles means less than 90°. The

sum of angles in a triangle = 180° ∴a+b+90 = 180 a+b= 180 − 90 = 90°

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

(a) within, for (b) for, in (c) during, for (d) for, since08. Ans: (a)Sol: First blank states the maximum duration and

second blank shows the period of time.

Page 6: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

4 Computer Science & Information Technology

09. Select the word that fits the analogy: Cook: Cook:: Fly: ____ (a) Flying (b) Flew (c) Flighter (d) Flyer09. Ans: (d)Sol: It is verb and noun analogy

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

200

200

0 0

200

200

100

100100

100

300

100

a

d

f

b

c

2

e

1

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

(a) 1-a-c-2 (b) 1-b-2 (c) 1-f-e-2 (d) 1-f-b-210. Ans:(d)Sol: From the given networks, Option(a): 1 – a – c – 2 The cost of travel= 200+100+100=400 Option(b): 1 – b – 2 The cost of travel= 300+200=500 Option(c): 1 – f – e – 2 The cost of travel= 100+100+200=400 Option(d): 1 – f – b – 2 The cost of travel= 100+0+200=300 ∴The cheapest route from node1 to node2 is 1 – f – b – 2 ∴ option (d) is correct.

Section : Computer Science & Information Technology

01. Consider the following statements.I. Daisy chaining is used to assign priorities in

attending interruptsII. When a device raises a vectored interrupt, the

CPU does polling to identify the source of interrupt

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

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

Which fo the above statements is/are TRUE? (a) I and IV only (b) I and III only (c) III only (d) I and II only01. Ans: (b)Sol: Polling is a protocol that keeps checking the

control bits to notify whether a device has something to execute.

Polling method cannot assign priority because it checks all devices in a round-robin fashion.

During DMA, either CPU or DMA controller can be bus master but both cannot be master of bus at the same time.

Daisy chaining is serial priority handling to attend interrupts.

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

I. A running process can move to ready state II. A ready process can mvoe to running state III. A blocked process can move to running state IV. A blocked process can move to ready state Which of the above statements are TRUE? (a) I , II and IV only (b) I, II, III and IV (c) I, II and III only (d) II and III only

Page 7: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

5 Computer Science & Information Technology

02. Ans: (a)Sol: Consider following state transition diagram for

preemptive scheduling

New Terminated

Ready Running

Blocked

III is false because, a blocked process can move to ready state only, then from ready it can go to running state.

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

03. Ans: 5Sol: The given scenario can be understood as follows:-

Reg 1 ................

................Selectlines

Reg 2

Accumulator

Reg 32

Inputs

MUX

To select one of 32 inputs select lines should be = log2 32 = 5

04. Consider the following statements about the functionality of an IP based routerI. A router does not modify the IP packets during

forwardingII. It is not necessary for a router to implement any

routing protocolIII. A router should reassemble IP fragements if

the MTU of the outgoing link is larger than the size of the incoming IP packet

Which of the above statemetns is/are TRUE? (A) I and II only (B) I only (C) II and III only (D) II only04. Ans: (a)Sol: I: TRUE The sender gives the source address and destination

address. Hence IP protocol should simply forward an incoming packet without changing the destination address

II. TRUE Forwarding a packet is simple: consists of taking a

packet, looking at its destination address, consulting a table and sending the packet in a direction determined by that table. (Static routing) where as routing depends on complex distributed algorithm. It is the process by which forwarding tables are built. (Dynamic routing)

So it is not necessary for a router to implement routing algorithm to forward a packet in case of static routing

III. FALSE IP layer uses non transparent fragmentation,

reassembly has to be carried out at the final destination

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

(a) Ovals that contain underlined identifiers (b) Ovals with double/bold border (c) Diamonds with double/bold border (d) Rectangles with double/bold border05. Ans: (c)Sol: Relationship of a weak entity set represented with

diamonds of double or bold borders 06. Consider the following C program # include <stdio.h> int main () { int a[4] [5] = {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}, {16, 17, 18, 19, 20}}; printf("%d\n", *(*(a+**a+2)+3)); return (0); } The output of the program is______.

Page 8: COMPUTER SCIENCE & INFORMATION TECHNOLOGY
Page 9: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

6 Computer Science & Information Technology

06. Ans:19Sol: printf("%d", *(*(a+ * * a + 2)+3)); printf("%d", *(*(a+ 1 + 2)+3)); printf("%d", *(*(a + 3)+3)); printf("%d", a[3][3]) = 19

07. Consider the following statements I. If L1∪ L2 is regular, then both L1 and L2 must be

regular II. The class of regular languages is closed under

infinite union Which of the above statements is/are TRUE? (a) Neither I nor II (b) II only (c) I only (d) Both I and II07. Ans: (a)Sol: If L1 ∪ L2 is regular, then L1 and L2 need not be

regular Example: L1 = (a+b)* L2 = anbn

Here, L1 ∪ L2 is regular but L2 is not regular.

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

08. Ans: 13Sol: Given key = 90, Table size = 23 Primary hash function H1(k) = k mod size H1(90) = 90 mod 23 = 21 When no collision, then primary function is

sufficient But here asked at probe one it indicates the usage

of secondary hash function given secondary hash function H2(k) = 1+(kmod 19)

In general, for ith probe = 1+ (90 mod 19) = 1+14 = 15 [h1(k)+ i h2(k)]% size [21+1(15)] % size (21+15) mod 23 36 mod 23 = 13

09. Consider the functions I. e−x

II. x2 −sin x III. x 1

3 +

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

(a) II and III only (b) I and III only (c) II only (d) III only09. Ans: (d)Sol: I. Let f(x) = e−x

f1(x) = −e−x which is negative in the inteval (0, 1) ∴f(x) is not increasing II. Let g(x) = x2 − sin x

g1(x)= 2x− cosx which is negative at x = 0.1 ∈(0, 1) ∴g(x) is not increasing III. Let h(x) = x 1

3 +

h1(x) x

x

2 1

30

3

2

�� for x ∈(0, 1)

∴h(x) is increasing

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

10. Ans: 6Sol: In HTTP , Non persistence connection requires

connection setup again and again for each object to send. In the problem, there are one Text and 5 images. So, six objects require 6 connections.

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

Which one of the following is the postorder traversal of the tree?

Page 10: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

7 Computer Science & Information Technology

(a) 11, 12, 10, 16, 19, 18, 20, 15 (b) 19, 16, 18, 20, 11, 12, 10, 15 (c) 20, 19, 18, 16, 15, 12, 11, 10 (d) 10, 11, 12, 15, 16, 18, 19, 2011. Ans: (a)Sol: PRE 15 10 12 11 20 18 16 19 IN 10 11 12 15 16 18 19 20

10 11 12 15 16 18 19 20

10 11 12

16 18 19 20

11 12

16 18 19

16 19

11 19

15

10 20

18

16 19

12

11

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

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

(a) Θ(n2) (b) Θ(1) (c) Θ(n) (d) Θ(n log n)12. Ans: (d)Sol: By using comparsion based sorting algorithm

either merge sort or heap sort we can take Θ(n log n)

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

13. Ans: 0.125Sol: Probability that the chosen relation is reflexive

. ( )

Total no of relations

favourable no of relations which are reflexive=

( )No of reflexive relations2

22n n

9

9 32

a= =-

-

( )No of relations here n2

22 3n

9

62

a= = =

512

64=

= 0.125

14. Which one of the following regualr expressions represents the set of all binary strings with an odd nubmer of 1's?

(a) ((0+1) * 1(0+1) * 1) * 10* (b) (0*10*10*)*0*1 (c) 10*(0*10*10*)* (d) (0*10*10*) *10*)14. Ans:*Sol: (a) [(0+1)*1(0+1)*1]*10* cannot generate "01". (b) (0*10*10*)*0*1 cannot generate "10" (c) 10*(0*10*10*)* cannot generate "01" (d) (0*10*10*)*10* cannot generate "01". All given options are wrong. No option generates

the set of all binary strings with an odd number of 1's.

The following expressions represents the set of all binary strings with odd number of 1's.

I. (0*10*10*)0*10* II. 0*10*(0*10*10*)

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

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

context-free III. L is not LL(k) for any k Which of the above statements is/are TRUE? (a) I and III only (b) II only (c) III only (d) I only

Page 11: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

8 Computer Science & Information Technology

15. Ans: (a)Sol: L= {an |n ≥ 0} ∪ {an bn | n ≥ 0} L is DCFL but not regular L has no LL(k) grammar, so L is not LL(k)

16. Consider the following statementsI. Symbol table is accessed only during lexical

analysis and syntax analysisII. Compilers for programming languages that

support recursion necessarily need heap storage for memory allocation in the run-time environment

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

Which of the above statements is/are TRUE? (a) None of I, II, and III (b) I and III only (c) I only (d) II only16. Ans: (a)Sol: I. Symbol table can be accessed in any phase of

compiler II. Stack is required to support recursion III. Declaration error detected during semantic

analysis.

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

17. Ans: 1034Sol: 1 KB = 1K × 1B = 210 ×1B Address size = 10-bits A decoder is used to select one of 1K cells of

RAM based on input address,hence size of decoder= 10 × 210

Input lines in decoder (m) = 10 Output lines in decoder (n) = 210 = 1024 m + n = 10 + 1024 = 1034

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

is _____.18. Ans: 30.8Sol: Word size = 64-bits = 8 bytes Block size = 256 bytes = 32 words(256/8=32) Average memory access time = 0.94*3 + 0.16 [20+31*5]nsec = (2.82+28)nsec = 30.82 nsec

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

(a) Θ(n2) (b) Θ(n2 log n) (c) Θ(n4) (d) Θ(n3)19. Ans: (b)Sol: AVL tree is a balanced BST So height of AVL with 'n' needs is logn →To insert an element, need to traverse till the leaf,

which takes logn2 . If there is an inbalance(at root), it takes another logn2 for rotation, in worst case

→So for inserting each element takes 2 logn2 hence for inserting n2 elements, it takes n2 * 2logn.

Time complexity O(n2. logn)

Page 12: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

9 Computer Science & Information Technology

20. Consider a relational database containing the following schemas. Catalogue

sno pno Cost SuppliersS1 P1 150 sno sname costS1 P2 50 S1 M/s Royal furniture DelhiS1 P3 100 S2 M/s Balaji furniture Bangalore

S2 P4 200 S3 M/s Premium furniture ChennaiS2 P5 250S3 P1 250 PartsS3 P2 150 pno pname part_specS3 P5 300 P1 Table WoodS3 P4 250 P2 Chair Wood

P3 Table SteelP4 Almirah SteelP5 Almirah Wood

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

SELECT s.sno, s.sname FROM Suppliers s, Catalogue c WHERE s.sno=c.sno AND cost>(SELECT AVG(cost) FROM Catalogue WHERE pno='P4' GROUP BY pno); The number of rows returned by the above SQL

query is (a) 2 (b) 4 (c) 0 (d) 520. Ans:(b)Sol: Inner query finds the average from catalogue whose

pno=p4 that is 225. And the outer finds the sno and sname of suppliers supplying some parts whose cost is above 225.

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

Then T(n) is (a) Θ(logb loga n) (b) Θ(log2 log2 n) (c) Θ(loga logb n) (d) Θ(logab n)

21. Ans: (c)Sol: T(n) = T (n1/a) + 1 and T(b) = 1 T n 1 1a

12� � �^ h

: :

:

T n 1 1 1a1k� � � � ����^ h

( ) (*)T n T n ka1k� � ������^ h

( )Let T n T b 1a1k = =^ h

n ba1k` =

loga

1k n

b=

ak = logbn k = loga logb

n

By substituting 'K' value in (*) T(n) = T(b) + loga logb

n

log log1 a bn� �

( )log loga bn���

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

22. Ans: 7

Page 13: COMPUTER SCIENCE & INFORMATION TECHNOLOGY
Page 14: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

10 Computer Science & Information Technology

Sol: The order of any sub group of a group is a divisor of order of the group.

Order of G=35 The largest divisor of 35 = 7 ∴ The largest possible size of a subgroup of G=7.

23. Consider the following data path diagram.

MAR

To Memory

MDR

BUS

IR PC R0

R1TEMP2

ALU

TEMP1

R7

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

1. R2r, TEMP1r, ALUadd, TEMP2w

2. R1r, TEMP1w

3. PCr, MARw, MEMr

4. TEMP2r, R0w

5. MDRr, IRw

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

(a) 3, 5, 2, 1, 4 (b) 1, 2, 4, 3, 5 (c) 3, 5, 1, 2, 4 (d) 2, 1, 4, 5, 323. Ans: (a)Sol: (3) PCr, MARw, MEMr: Read PC value and write

that address into MAR, to read memory (next instruction)

(5) MDRr, IRw : Next instruction is copied to IR from MDR (Memory read copies contents in MDR first)

(2) R1r, TEMP1w: Read value of R1 in TEMP1 (1) R2r, TEMP1r, ALUadd, TEMP2w: This operation

says TEMP2←R2+TEMP1 (4) TEMP2r, R0w: This operation copies final result

of addition from TEMP2 to R0.

24. Consider allocation of memory to a new process. Assume that none of the existing holes in the memory will exactly fit the process's memory requirement. Hence, a new hole of smaller size will be created if allocation is made in any of the existing holes. Which one of the following statements is TRUE?(a) The hole created by next fit is never larger than

the hole created by best fit(b) The hole created by worst fit is always larger

than the hole created by first fit(c) The hole created by first fit is always larger than

the hole created by next fit(d) The hole created by best fit is never larger than

the hole created by first fit24. Ans: (d)Sol: The best fit always selects the smallest size hole

and if a process is allocated to this hole then the remaining space will be used to create another

hole and that remaining space will be lesser as compared to any other allocation scheme. It can be equal if the selected (smallest) hole is first, next or largest hole, but can never be larger.

25. Consider the following grammar S → aSB| d B → b The number of reduction steps taken by a bottom-

up parser while accepting the string aaadbbb is _________.

25. Ans: 7

Page 15: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

11 Computer Science & Information Technology

Sol: S → aSB | d B → b

String: aaadbbbRMD: S

⇓aSB⇓aSb⇓aaSBb⇓aaSbb⇓aaaSBbb⇓aaaSbbb⇓aaadbbb

Reverse of RMD:aaadbbb⇓①aaaSbbb⇓②aaaSBbb⇓③aaSbb⇓④aaSBb⇓⑤aSb⇓⑥aSB⇓⑦S

Bottom up parser uses reverse of RMD that takes 7 reduction steps

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

26. Ans: 12Sol: In the set(I,A,C), two of these letters can be arranged

in first and third positions in P(3,2) ways The third letter of the set can be arranged in two

ways. ∴ Required number of permutations = P(3,2).2=12.

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

27. Ans: 7Sol: Degree (S) =7 = ∆(G)= Maximum of all the degrees

of the vertices of G. we know that χ(G) ≥ ∆(G) ⇒χ(G) ≥ 7 ∴Minimum number of colors required = 7

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

(P, 155), (Q, 85), (R, 110), (S,30), (T,115) Assume the head is positioned at cylinder 100.

The scheduler follows Shortest Seek Time First Scheduling to service the requests.

Which one of the following statements is FALSE? (a) R is serviced before P. (b) T is serviced before P. (c) Q is serviced after S, but before T (d) The head reverses its direction of movement

between servicing of Q and P.28. Ans: (c)Sol: The requests are served as follows, S

35Q85

R T P100 110 115 155

Q is serviced before S and after T. It is false.

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

29. Ans: 511Sol: The maximum element in min heap occurs at leaf

level and leaf node index is starting from n/2+1 and ending with index 'n'

∴ For n = 1023, leaf node index starts from 1023/2+1and leaf node index ends with 1023

∴ Leaf node index are starting from 512 and end with 1023

∴ Number of leaf nodes = 1023–512+1 = 512 ∴ If there are 512 leaf nodes then to find

maximum element we have to perform 512 –1=511 comparisons.

Page 16: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

12 Computer Science & Information Technology

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

30. Ans: 2.16

Sol: Cycle time in non-pipeline processor

=.

. secGHz

n2 5

10 4=

Time required to execute an instruction

= 5*0.4=2 nsec

Cycle time in pipeline processor= . secGHz

n2

10 5=

Average cycles per instruction = 0.3 [0.05*(50+1)+0.95*1]+ 0.6 [1]+ 0.1 [0.5*(2+1)+0.5*1] = 1.05 + 0.6+ 0.2 = 1.85 Time required to execute an instruction in pipeline

processor =1.85*0.5 = 0.925 nsec Speedup =

.

.

avg instruction execution time in pipeline

avg instruction execution time in non pipeline−

.0 925

2=

= 2.162 ≅ 2.16

31. Which of the following languages are undecidable? Note that <M> indicates encoding of the Turing machine M.

L1 = {<M> | L (M) = φ L2 = {<M, w, q>| M on input w reaches state q

in exactly 100 steps} L3 = {<M>| L (M) is not recursive} L4 = {<M> | L (M) contains at least 21 members} (a) L1, L3 and L3 only (b) L2 and L3 only (c) L1 and L3 only (d) L1 ,L3 and L4 only31. Ans: (d)Sol: { | ( ) }L M L M

Emptiness

1 ��� �1 2 344444 44444

⇒ undecidable L2 = {<M,w,q>| M on i/p w reaches state q in

exactly 100 steps} ⇒ Decidable ∵L2 and L2 have TM L3 = {<M>| L(M) is not recursive} ⇒ undecidable L4 = {<M>| L(M) contains atleast 21 members} L4 has TM but L4 has no TM L4 is semidecidable, so L4 is undecidable ∴L2 is Decidable and L1, L3 and L4 are

undecidable

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

CODE SECTION P

wait (a); count= count+1; if (count ==n) signal(b); signal(a); wait(b); signal(b);

CODE SECTION Q

Page 17: COMPUTER SCIENCE & INFORMATION TECHNOLOGY
Page 18: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

13 Computer Science & Information Technology

What does the code achieve?(a) It ensures that all processes execute CODE

SECTION P mutually exclusively.(b) It ensures that at most two processes are in

CODE SECTION Q at any time.(c) It ensures that at most n–1 processes are in

CODE SECTION P at any time.(d) It ensures that no process executes CODE

SECTION Q before every process has finished CODE SECTION P.

32. Ans: (d)Sol: All the processes execute CODE SECTION P and

then execute wait(a); count = count+1; if(count==n) signal b;

signal(a); And then stuck at wait(b); because b=0 initially. when nth process comes and executes CODE

SECTION P and after that executes the statements wait(a); count = count+1; if(count==n) signal b; here count becomes n hence b incremented be 1

and one process can proceed further from wait(b); executes signal (b) and executes CODE SECTION Q. Similarly all other processes also can go further till CODE SECTION Q.

Hence this code ensures that all processes should execute SECTION P then only one process is allowed to execute SECTION Q.

33. Consider a schedule of transactions T1 and T2 :

T1 RA RC WD WB CommitT2 RB WB RD WC Commit

Here, RX stands for "Read(X)" and WX stands for "Write(X)". Which one of the following schedules is conflict equivalent to the above schedule?

(a)T1 RA RC WD WB CommitT2 RB WB RD WC Commit

(b)T1 RA RC WD WB CommitT2 RB WB RD WC Commit

(c)

T1 RA RC WD WB Commit

T2 RB WB RD WC Commit (d)

T1 RA RC WD WB CommitT2 RB WB RD WC Commit

33. Ans: (a)Sol: The two schedules are said to be conflict equivalent if all the conflicts in both the schedules are same. All the conflicts in the given schedule are same in the schedule of option a.

Page 19: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

14 Computer Science & Information Technology

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

I. 202.61.84.0/21 II. 202.61.104.0/21 III. 202.61.64.0/21 IV. 202.61.144.0/21 (a) I and IV only (b) III and IV only (c) II and III only (d) I and II only34. Ans: (b)Sol: Given available space = 202.61.0.0/17 No of computers = 1500 2x = 1500 x = 11 bits So /n = /32−x = /32−11 = /21

I: 202. 61. 84. 0 01010100 cannot accomodate 1500 systems

II: 202. 61. 104. 0

0110 1 000 can accommodate 1500 systems III. 202. 61. 64. 0

0100 0 000 can accomodate 1500 systems IV. 202. 61. 144. 0

1001 0 000 can accomodate 1500 systems To minimize entries in the preceeding router, with option III, additional /21, /20, /19, /18 causes one entry

Similarly with option IV, additional /21 and /20 causes one entry

So III and IV will lead to minimize the entries in the preceeding table.

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

35. Ans: *

36. Consider the following C functions.int tob(int b, int* arr)

{

int i;

for (i=0; b>0; i++)

{

if (b%2) arr[i] =1;

else arr [i] = 0;

b = b/2;

}

return (i);

}

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

The value returned by pp (3, 4) is ________.36. Ans: 81Sol: When we call tob(b_arr) function from pp(int a, int

b) then content of array arr is as follows

arr 0 1 2 3.......19 0 0 1

and the content of i is '3' so it return '3' to the calling function pp(int a, int b) and the value of len becomes 3. In the function pp(int a, int b) when i=0, we have ex content is 9, and when i=1, we have content is 81, when i=2, tot content is 81.

Page 20: COMPUTER SCIENCE & INFORMATION TECHNOLOGY
Page 21: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

15 Computer Science & Information Technology

37. A processor has 64 registers and uses 16-bit instruction format. It has two types of instructions:

I-type and R-type. Each I-type instruction contains an opcode, a register name and a 4-bit immediate value. Each R-type instruction contains an opcode and two register names. If there are 8 distinct I-type opcodes, then the maximum number of distinct R-type opcodes is_____.

37. Ans: 14Sol: Number of registers = 64 Register name size = log2 64 = 6-bits Type R-Intruction:

Opcode

4-bits6⇓ 6

16

Register Register

Max R-type instructions = 24

Assume used R-type instruction = n unused opcode = 24 − n Type I- Instruction

Opcode

6-bits6

4 2

⇓ 4

16

RegisterImmediate value

Max I-type instructions = (24−n) * 22 = 8 (given 8) = 24 − n = 2 n = 14

38. Consider the following languages. L1 = {wxyx | w, x, y ∈(0+1)+} L2 = {xy | x, y ∈ (a+b)*, |x| = |y|, x ≠ y} Which one of the following is TRUE?

(a) L1 is context-free but not regular and L2 is context-free

(b) Neither L1 nor L2 is context-free(c) L1 is regular and L2 is context-free(d) L1 is context-free but L2 is not context-free

38. Ans: (c)

Sol: L1={wxyz | w,x,y ∈ {0,1}+} = (0+1)+0 (0+1)+0 + (0+1)+1 (0+1)+1 L1 is regular language L2 ={xy | x,y ∈ (a+b)*, |x|=|y|, x≠y} CFG that generates L2 is : S→AB | BA A→CAC | a B → CBC | b C → a | b L2 is CFL but not DCFL ∴L1 is regular and L2 is CFL

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

I. rank(AB) = rank (A) rank(B) II. det(AB) = det(A) det(B) III. rank(A+B) ≤ rank(A) + rank(B) IV. det(A+B) ≤ det(A) + det(B) Which of the above statements are TRUE? (a) I and III only (b) I and IV only (c) I and II only (d) III and IV only39. Ans: (a)Sol: From the properties, det(AB)= det(A).det(B) Again from the property of rank we have

rank (A+B)≤ rank(A)+rank(B) we can disprove other two statements with counter

examples ∴ Option (a) is correct.

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

Page 22: COMPUTER SCIENCE & INFORMATION TECHNOLOGY
Page 23: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

16 Computer Science & Information Technology

40. Ans: 4Sol: The order of the B+ tree is N*8+(n–1)*12<=4096 N<=205 Root with 1 node and 205 pointers. Level 1 with

205 nodes and 42025 pointers. Level 2 with 42025 nodes and 8615125 pointers. To store 1 million records 3 levels are sufficient. To retrieve any record in the database using index at every level access 1 block and 1 in the data file and total of 4 block accesses.

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

41. Ans: 99Sol: The weight of M.S.T for 'n' vertices for the given

graph based on the given condition is n−1. So weight of MST for n = 100 vertices we have

100 − 1= 99

42. Consider the following C functions.

int func1(int n) { static int i=0; if(n > 0) { ++i;

fun1(n–1); } return(i);}

int fun2(int n) { static int i=0; if(n>0) {

i=i+fun1(n);

fun2(n–1); } return (i); }

The return value of fun2(5) is ________.

42. Ans: 55Sol:

fun2(5)

i = i + fun1(5) 55

ireturn

fun2(4)

fun2(3) i = i + fun1(4)

5

9

fun2(2)

i = i + fun1(3)

12 fun2(1)

i = i + fun1(2)

14

i = i + fun1(1)

15 40

26

14

5 14

0 5 9 12 14 i

0 5 14 26 40 55 i

43. For n > 2, let a∈{0, 1}n be a non-zero vector. Suppose that x is chosen uniformly at random from Z{0, 1}n. Then, the probability that a xi i

i

n

1=/ is an

odd number is _____.43. Ans: 1/2

Sol: ( ....... ...... ( )a x a x a x a x 1i i i i n n

i

n

2 2

1

� � � �=

/

Each of the terms on the R. H. S is either 0 or 1 If a is a non-zero vector and 'x' is random vector,

then the number of ways, we can write the sum (1) = (2n −1) 2n

The number of ways we can write sum (1) with odd

number of 1's (So that the sum is odd) ( )

2

2 1 2n n

��

∴The required probablity ( )

( )

2 1 2

2

2 1 2

2

1n n

n n

� �

Page 24: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

17 Computer Science & Information Technology

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

If RR

R3

2

1= , what is the value stored in R3?

(a) 0x83400000 (b) 0x40800000 (c) 0xC8500000 (d) 0xC080000044. Ans: (d)Sol: R1=0x42200000= 0100 0010 0010 0000 0000.......0 In single precision floating point format(IEEE-754)

a number is represented as follows:-

S

1-bit 8-bits 23-bits

32-bits

E M

From above value R1 S=0(+ve value) E = 10000100=132 M = 0100...0 value of R1 = +(1.01 * 2132–127 ) bias=127 = +1.01 * 25 = +101000 = +40 R2=0xC1200000=1100 0001 0010 0000...........0 same as above format of number S=1(–ve value) E= 10000010=130 M=010......0 Value of R2 = –(1.01 * 2130–127 ) = –(1.01 * 23) = –(1010) = –10 ( )R

R

R3

2

1

10

404 100 2� � �

� �� ��

Implicit normalization ⇒ –(1.00*22) E=2+127 = 129=10000001 M=000.......0 S=1(–ve) 32 - bit value in IEEE-754 single

precision=11000000100000....0 Hexadecimal ⇒ 0xC0800000

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

a

b

c

z

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

(a) z = Ʃ(2, 4, 5, 6, 7) (b) z = Ʃ(1, 4, 5, 6, 7) (c) z = Ʃ(0, 1, 3, 7) (d) z = Ʃ(2, 3, 5)45. Ans: (b)Sol: Z a b c� �

Z = a(1) (1) + (1) b c [ ] [ ] [ ]Z a b b c c a a b c� � � � �

[ ] [ ]Z ab ab c c a b c abc� � � � �

Z= a b c + a b c + a b c + a b c + a b c + a b c + a b c

Here abc got two times but x+x = x hence write only one time

Z a b c a b c a b c a b c a b c

10 0 10 1 1 1 0 1 11 0 01

m m m m m4 5 6 7 1

� � � � �

X \ Z Z X

Z = Ʃm [ 1, 4, 5, 6, 7] Hence option (b) is correct.

46. Let G = (V, E) be a directed, weighted graph with weight function w: E→R. For some function f: V →R, for each edge (u, v) ∈E, define w'(u, v) as w(u, v)+f(u) − f(v).

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

"The shortest paths in G under w are shortest paths under w' too, ______".(a) if and only if ∀u∈V, f(u) is negative(b) if and only if ∀u∈V, f(u) is positive(c) if and only if f(u) is the distance from s to u

int he graph obtained by adding a new vertex s to G and edges of zero weight from s to every vertex of G

(d) for every f: V →R

Page 25: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

18 Computer Science & Information Technology

46. Ans: (c)Sol:

xs u

v

w(u,v)

f(v)

f(u) = x

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

Now w1 (u, v) = w(u, v)+ f(u) − f(v) w1 (u,v) = w(u,v)+x (here f(v)=0 as there is no edge from s to v) The shortest path in 'G' under 'w' are shortest path

under w1 too.

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

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

(a) ∃x (p(x) ∧ W) ≡ ∃x p(x) ∧W (b) ∀x(p(x)) ∨ W ≡ ∀xp(x) ∨W (c) ∃x (p(x) → W) ≡ ∀x p(x) →W (d) ∀x(p(x)) → W) ≡ ∀x p(x) →W47. Ans: (d)Sol: (a) LHS ⇔ ∃x (p(x) ˄W) ⇔{∃xp(x)}˄∃x W≡{∃xp(x)}˄W=RHS ∴It is valid (b) If x is not free then ∀x{W∨p(x)} ⇔W ∨∀x p(x) is valid (c) LHS ⇔∃x {~p(x) ∨W} ⇔{∃x ~p(x)} ∨∃x W ≡ ∀x p(x) →W (d) ∀x {p(x) →W} ⇔{∀x ~p(x) ∨W} using E16

⇔{∀x ~p(x)} ∨W using (b) ≡ {∃x p(x)} → W using E16

≠RHS ∴It is invalid

48. Consider the following language. L = { x ∈{a, b}* | number of a's in x is divisible by

2 but not divisible by 3} The minimum numer of states in a DFA that accepts

L is ______.48. Ans: 6Sol: L = {x | x ∈(a+b)*, na (x) is divisible by 2 but not

divisible by 3}b

a a a

a

a a

b b b b b

6 states required in min DFA.

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

Processes P1 P2 P3 P4

Burst time (in ms) 8 7 2 4

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

49. Ans: 5.25Sol: SJF: GANTT chart

P3

0 2 6 13 21

P4 P2 P1

Process P1 P2 P3 P4

Completion time 21 13 2 6

Turnaround time 21 13 2 6

Page 26: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

19 Computer Science & Information Technology

Average turnaround time . secm

4

21 13 2 610 5� � � � �

RR: GANTT chartP1

0 4 8 10 14 18 21

P2 P2P3 P4 P1

Process P1 P2 P3 P4

Completion time 18 21 10 14

Turnaround time 18 21 10 14

Average turnround time . secm

4

18 21 10 1415 75� � � � �

Difference = 15.75 − 10.5 = 5.25

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

(a) Θ(n log k) (b) Θ(k log n) (c) Θ(log n) (d) Θ(log n+k)50. Ans: (d)Sol: In general to find all elements in the range, it takes

Θ(log n+s) where s is the number of elements reported. In this problem s = k. So Θ(log n+k)

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

(a) Θ(|E| + |V|) (b) Θ(|E| |V|) (c) Θ(|V|) (d) Θ(|E| log |V|)51. Ans: (c)Sol: Examine the path in T from u to v. If any vertex

on this path has weight larger than that of the new edge, then 'T' is no longer an MST, we can modify 'T' to obtain a new MST by removing the max weight edge on this path and replacing it with new edge.

The running time for tree traversal is O(v) and required changes to 'T' can be done in constant time.

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

Rule 1: P.i=A.i+2, Q.i=P.i+A.i and A.s=P.s+Q.s Rule 2: X.i=A.i+Y.s and Y.i=X.s+A.i which one of the following is TRUE? (a) Neither Rule 1 nor Rule 2 is L-attributed. (b) Only Rule 1 is L-attributed (c) Both Rule 1 and Rule-2 are L-attributed (d) Only Rule2 is L-attributed.52. Ans: (b)Sol: Rule 1: A→PQ{ P.i = A.i + 2, Q.i = P.i + A.i, A.s = P.s + Q.s } Rule 2: A→XY{ X.i = A.i + Y.s, Y.i = X.s + A.i } In Rule 1, i depends on parent or left sibling s depends on children So, Rule1 is L-attributed In Rule 2, X.i computation depends on Y.s(right

sibling) So, Rule 2 is not L-attributed ∴ Only Rule 1 is L-attributed

53. Consider a relational table R that is in 3NF, but not in BCNF. Which one of the following statements is TRUE?(a) A cell in R holds a set instead of an atomic value.(b) R has a nontrivial functional dependency

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

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

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

Page 27: COMPUTER SCIENCE & INFORMATION TECHNOLOGY

ACE Engineering Publications Hyderabad Delhi Pune Bhubaneswar Bengaluru Chennai Vijayawada Vizag Tirupati Kolkata Ahmedabad

20 Computer Science & Information Technology

53. Ans: (d)Sol: A relation schema R is in 3NF if there is a non trivial

functional; dependency of the form x→a holds then either x is a super key or a is prime attribute of R

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

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

Which one of the following is TRUE? (a) A2 and A3 are mapped to the same cache set. (b) A1 and A4 are mapped to different cache sets. (c) A3 and A4 are mapped to the same cache set. (d) A1 and A3 are mapped to the same cache set.54. Ans: (a)Sol: Word size = 32-bits = 4Bytes Main memory size = 16MB = 16M × 1B = 224× 1B Main memory address = 24-bits Cache size = 64kb Block size = 256Bytes = 28 Bytes ⇒Byte offset = 8-bits Number of blocks in cache

B

kb

256

64256= =

Number of sets in cache 4

25664 2

6= = = ⇒set offset = 6-bits In set associative mapping, main memory address is

divided into 3 fields as follows:

Tag

10-bits 6-bits

24-bits

8-bits

Set offset Byte offset

A1 = 0x42C8A4 = 0100001011 001000 10100100

A2 = 0x546888 = 0101010001 101000 10001000

A3 = 0x6A289e= 0110101000 101000 10011100

A4 = 0x5E4880= 0101111001 001000 10000000

A1 and A4 maps to same set A2 and A3 maps to same set

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

55. Ans : 44KBSol: Threshold given = 32 kb MSS = 2kb So Threshold = 16 ms Each round Min (c w, Rw) ( , )Min cw 50

CW = Congestion Window RW = Receiver Window = Advertisment window

= 50kb Each RTT = 6 ms At t = 0 started At t = t + 60 ⇒There are rounds

6

6010=

As per slow start, upto threshold, CW grows exponentials and later lineraly

switch other to linear

,

,

&

After One RTT CW MSS

Two RTT CW MSS

Three RTT CW MSS

Four RTT CW MSS

Exponential now

2

4

8

16

===

=

_

`

a

bbbbbbbbbbbb

5 = 176 = 187 = 198 = 209 = 2110 = 22 MSS

= 22 × 2 = 44kb So min (CW, RW) MIN (44, 50) = 44kb

Page 28: COMPUTER SCIENCE & INFORMATION TECHNOLOGY