28
GATE questions-Information Technology By ravi on July 28th, 2008 Read this page in hindi 1 A subnet has been assigned a subnet mask of 255.255.255.192. What is the maximum number of hosts that can belong to this subnet? Options A) 14 B) 30 C) 62 D) 126 Correct Answer C 2. Which one of the following is NOT shared by the threads of the same process ? Options A) Stack B) Address Space C) File Descriptor Table D) Message Queue Correct Answer A 3 The following C function takes two ASCII strings and determines whether one is an anagram of the other. An anagram of a string s is a string obtained by permuting the letters in s. int anagram (char *a, char *b){ int count [128], j; for (j = 0;j < 128; j++) count[j] = 0; j = 0; while (a[J] && b[J]){ A; B; } for (j = 0;j < 128; j++) if(count[j]) return 0; return 1; } Choose the correct alternative for statements A and B. Options A) A : count [a[j]]++and B : count[b[j]]- B) A : count [a[j]]++and B : count[b[j]]++ C) A : count [a[j++]]++and B : count[b[j]]- D) A : count [a[j]]++and B : count[b[j++]]- Correct Answer A 4 Let M = (K, å, d, s, F) be a finite state automaton, where K = {A, B}, å = {a, b}, s = A, F = {B}, d(A, a) = A, d(A, b) = B, d(B,a) = B and d(B, b) = A A grammar to generate the language accepted by M can be specified as G = (V, å, R, S), where V = K È S, and S = A Which one of the following set of rules will make L(G) = L(M) ? Options

GATE Questions

Embed Size (px)

Citation preview

Page 1: GATE Questions

GATE questions-Information TechnologyBy ravi on July 28th, 2008 Read this page in hindi

1 A subnet has been assigned a subnetmask of 255.255.255.192. What is the maximum number of hosts that can belong to this subnet?OptionsA) 14 B) 30C) 62 D) 126Correct Answer C

2. Which one of the following is NOT shared by the threads of the same process ?OptionsA) Stack B) Address SpaceC) File Descriptor Table D) Message QueueCorrect Answer A

3 The following C function takes two ASCII strings and determines whether one is an anagram of the other. An anagram of a string s is a string obtained by permuting the letters in s.int anagram (char *a, char *b){int count [128], j;for (j = 0;j < 128; j++) count[j] = 0;j = 0;while (a[J] && b[J]){A;B;}for (j = 0;j < 128; j++) if(count[j]) return 0;return 1;}Choose the correct alternative for statements A and B.OptionsA) A : count [a[j]]++and B : count[b[j]]- B) A : count [a[j]]++and B : count[b[j]]++C) A : count [a[j++]]++and B : count[b[j]]- D) A : count [a[j]]++and B : count[b[j++]]-Correct Answer A

4 Let M = (K, å, d, s, F) be a finite state automaton, whereK = {A, B}, å = {a, b}, s = A, F = {B},d(A, a) = A, d(A, b) = B, d(B,a) = B and d(B, b) = AA grammar to generate the language accepted by M can be specified as G = (V, å, R, S), where V = K È S, and S = AWhich one of the following set of rules will make L(G) = L(M) ?OptionsA) {A ® aB, A ® bA, B ® bA, B ® aA, B ® e} B) {A ® aA, A ® bB, B ® aB, B ® bA, B ® e}C) {A ® bB, A ® aB, B ® aA, B ® bA, B ® e} D) {A ® aA, A ® bA, B ® aB, B ® bA, A ® e}Correct Answer B

5 Which one of the following regular expressions is NOT equivalent to the regular expression (a + b + c)* ?Options

Page 2: GATE Questions

A) (a* + b* + c*)* B) (a*b*c*)*C) ((ab)* + c*)* D) (a*b* + c*)*Correct Answer C

6 Let G be a weighted undirected graph and e be an edge with maximum weight in G. Suppose there is a minimum weight spanning tree in G containing the edge e. Which of the following statements is always TRUE?OptionsA) There exists a cutset in G having all edges of maximum weight. B) There exists a cycle in G having all edges of maximum weight.C) Edge e cannot be contained in a cycle. D) All edges in G have the same weight.Correct Answer C

7 A software organization has been assessed at SEI CMM Level 4. Which of the following does the organization need to practice beside Process Change Management and Technology Change Management in order to achieve Level 5 ?OptionsA) Defect Detection B) Defect PreventionC) Defect Isolation D) Defect PropagationCorrect Answer B

8 A CPU has only three instructions II, 12 and 13, which use the following signals in time steps T1-T5:I1: T1: Ain, Bout, CinT2: PCout, BinT3: Zout, AinT4: PCin, BoutT5: EndI2: Tl: Cin, Bout, DinT2: Aout,BinT3: Zout, AinT4: Bin, CoutT5: EndI3: Tl: Din, outT2: Din,BoutT3: Zout, AinT4: Dout,AinT5: EndWhich of the following logic functions will generate the hardwired control for the signal Ain?OptionsA) T1.I1 + T2.I3 + T4 . I3 + T3 B) (T1 + T2 + T3) . I3 + T1.I1C) (T1 + T2 ) . I1 + (T2 + T4) . I3 + T3 D) (T1 + T2 ) . I2 + (Tl + T3) . I1+ T3Correct Answer A

9 Suppose that two parties A and B wish to setup a common secret key (D-H key) between themselves using the Diffle-Hellman key exchange technique. They agree on 7 as the modulus and 3 as the primitive root. Party A chooses 2 and party B chooses 5 as their respective secrets. Their D-H key isOptionsA) 3 B) 4

Page 3: GATE Questions

C) 5 D) 6Correct Answer C

10 Consider the following message M = 1010001101. The cyclic redundancy check (CRC) for this message using the divisor polynomial x5 + x4 + x2 + 1 is :OptionsA)01110 B) 01011C) 10101 D) 10110Correct Answer C

11 Which of the following statements is FALSE regarding a bridgeOptionsA) Bridge is a layer 2 device B) Bridge reduces collision domainC) Bridge is used to connect two or more LAN segments D) Bridge reduces broadcast domainCorrect Answer D

12 What is the availability of a software with the following reliability figures?Mean Time Between Failure (MTBF) = 25 daysMean Time To Repair (MTTR) = 6 hoursOptionsA) 1% B) 24%C) 99% D) 99.009%Correct Answer B

13 In a population of N families, 50% of the families have three children, 30% of the families have two children and the remaining families have one child. What is the probability that a randomly picked child belongs to a family with two children?OptionsA)3/23 B)6/23C)3/10 D)3/5Correct Answer B

15 A student wishes to create symbolic links in a computer system running Unix. Three text files named “file 1”, “file 2” and “file 3” exist in her current working directory, and the student has read and write permissions for all three files. Assume that file 1 contains information about her hobbies, file 2 contains information about her friends and file 3 contains information about her courses. The student executes the following sequence of commands from her current working directoryIn -s file 1 file 2In -s file 2 file 3Which of the following types of information would be lost from her file system?(I) Hobbies (II) Friends (III) CoursesOptionsA) (I) and (II) only B) (II) and (III) onlyC) (II) only D) (I) and (III) onlyCorrect Answer B

Page 4: GATE Questions

16 A channel has a bit rate of 4 kbps and one-way propagation delay of 20 ms. The channel uses stop and wait protocol. The transmission time of the acknowledgementframe is negligible. To get a channel efficiency of at least 50%, the minimum frame size should beOptionsA) 80 bytes B) 80 bitsC) 160 bytes D) 160 bitsCorrect Answer D

17 Consider an XML file called intro.xml and a document type defintion (DTD) file intro. dtd as follows:intro.xml

Welcome to XML

intro.dtd

A validating parser will classify intro.xml asOptionsA) Well-formed and validated B) Well-formed but not validatedC) Validated but not well-formed D) Neither validated not well-formedCorrect Answer A

18 In an inventory management system implemented at a trading corporation, there are several tables designed to hold all the information. Amongst these, the following two tables hold information on which items are supplied by which suppliers, and which warehouse keeps which items along with the stock-level of these items.Supply = (supplierid, itemcode)Inventory = (itemcode, warehouse, stocklevel)For a specific information required by the management, following SQL query has been writtenSelect distinct STMP supplieridFrom Supply as STMPWhere not unique (Select ITMP . supplieridFrom Inventory, Supply as ITMPWhere STMP . supplierid = ITMP . supplieridAnd ITMP . itemcode = Inventory . itemcodeAnd Inventory . warehouse = ‘Nagpur’);For the warehouse at Nagpur, this query will find all suppliers whoOptionsA) do not supply any item B) supply exactly one itemC) supply one or more items D) supply two or more itemsCorrect Answer D

19 In a depth-first traversal of a graph G with n vertices, k edges are marked as tree edges. The number of connected components in G isOptionsA) k B) k+1C) n-k-l D) n-kCorrect Answer C

Page 5: GATE Questions

20 Which of the following statements is TRUE about CSMA/CDOptionsA) IEEE 802.11 wireless LAN runs CSMA/CD protocol B) Ethernet is not based on CSMA/CD protocolC) CSMA/CD is not suitable for a high propagation delay network like satellite network D) There is no contention in a CSMA/CD network

Correct Answer C

GATE questions-Inforamtion TechnologyBy ravi on July 28th, 2008 Read this page in hindi

1 Which one of the following is NOT shared by the threads of the same process ?OptionsA) Stack B) Address SpaceC) File Descriptor Table D) Message Queue

Correct Answer A

2 In a population of N families, 50% ofthe families have three children, 30% ofthe families have two children and the remaining families have one child. What is the probability that a randomly picked child belongs to a family with two children?OptionsA)323B)623C)310D)35

Correct Answer B

3 Let P be a non-deterministic push-down automaton (NPDA) with exactly one state, q, and exactly one symbol, Z, in its stack alphabet. State q is both the starting as well as the accepting state of the PDA. The stack is initialized with one Z before the start ofthe operation of the PDA. Let the input alphabet of the PDA be å . Let L(P) be the language accepted by the PDA by reading a string and reaching its accepting state. Let N(P) be the language accepted by the PDA by reading a string and emptying its stack.Which of the following statements is TRUE?OptionsA) L(P) is necessarily å * but N(P) is not necessarily å*. B) N(P) is necessarily å* but L(P) is not necessarily å*.C) Both L(P) and N(P) is necessarily å*. D) Neither L(P) nor N(P) are necessarily å*.

Page 6: GATE Questions

Correct Answer D

4 A subnet has been assigned a subnet mask of 255.255.255.192. What is the maximum number of hosts that can belong to this subnet?OptionsA) 14 B) 30C) 62 D) 126

Correct Answer C5 Suppose that two parties A and B wish to setup a common secret key (D-H key) between themselves using the Diffle-Hellman key exchange technique. They agree on 7 as the modulus and 3 as the primitive root. Party A chooses 2 and party B chooses 5 as their respective secrets. Their D-H key isOptionsA) 3 B) 4C) 5 D) 6Correct Answer C

6 We have two designs D1 and D2 for a synchronous pipeline processor. D1 has 5 pipeline stages with execution times of 3 nsec, 2 nsec, 4 nsec, 2 nsec and 3 nsec while the design D2 has 8 pipeline stages each with 2 nsec execution time. How much time can be saved using design D2 over design D1 for executing 100 instructions?OptionsA) 214 nsec B) 202 nsecC) 86 nsec D) -200 nsecYour Answer (Not Answered)Correct Answer A

7 Let P be a singly linked list. Let Q be the pointer to an intermediate node x in the list. What is the worst-case time complexity of the best-known algorithm to delete the node x from the list ?OptionsA) O(n) B) O(log2 n)C) O(log n) D) O(1)Your Answer (Not Answered)Correct Answer A

8 The number (123456)8 is equivalent toOptionsA) (A72E)16 and (22130232)4 B) (A72E)16 and (22131122)4C) (A73E)16 and (22130232)4 D) (A62E)16 and (22120232)4Your Answer (Not Answered)Correct Answer D

9 A channel has a bit rate of 4 kbps and one-way propagation delay of 20 ms. The channel uses stop and wait protocol. The transmission time of the acknowledgementframe is negligible. To get a channel efficiency of at least 50%, the minimum frame size should beOptionsA) 80 bytes B) 80 bits

Page 7: GATE Questions

C) 160 bytes D) 160 bitsYour Answer (Not Answered)Correct Answer D

10 A network with CSMA/CD protocol in the MAC layer is running at 1 Gbps over a 1 km cable with no repeaters. The signal speed in the cable is 2 x 108 m/sec. The minimum frame size for this network should beOptionsA) 10000 bits B) 10000 bytesC) 5000 bits D) 5000 bytesYour Answer (Not Answered)Correct Answer A

11

A table has fields F1, F2, F3, F4, F5 with the following functional dependencies

F1 ® F3 F2 ® F4 (F1 . F2) ® F5

In terms of Normalization, this table is inOptionsA) 1 NF B) 2 NFC) 3 NF D) None of theseYour Answer (Not Answered)Correct Answer A

12 In a particular Unix OS, each data block is of size 1024 bytes, each node has 10 direct data block addresses and three additional addresses: one for single indirect block, one for double indirect block and one for triple indirect block. Also, each block can contain addresses for 128 blocks. Which one of the following is approximately the maximum size of a file in the file system?OptionsA) 512 MB B) 2 GBC) 8 GB D) 16 GBYour Answer (Not Answered)Correct Answer D

13 On a TCP connection, current congestion window size is Congestion Window = 4 KB. The window size advertised by the receiver is Advertise Window = 6 KB. The last byte sent by the sender is LastByteSent = 10240 and the last byte acknowledged by the receiver is LastByteAcked = 8192. The current window size at the sender isOptionsA) 2048 bytes B) 4096 bytesC) 6144 bytes D) 8192 bytesYour Answer (Not Answered)Correct Answer B

14 Choose the correct option to fill the ?1 and ?2 so that the program prints an input string in reverse order. Assume that the input string is terminated by a new line character.#includevoid wrt_it (Void);

Page 8: GATE Questions

int main (void){printf(“Enter Text”);printf(“/n”);wrt_it( );printf(“/n”);return 0;}void wrt_it (void){int c;if (?1)wrt_it( );?2}OptionsA) ?1 is getchar( ) != “/n”?2 is getchar(c); B) ?1 is (c=getchar( )) !=”/n”?2 is getchar(c);C) ?1 is c != “/n”?2 is putchar(c); D) ?1 is (c = getchar( )) !=”/n”?2 is putchar(c);Your Answer (Not Answered)Correct Answer D

15 How many pulses are needed to change the contents of a 8-bit upcounter from 10101100 to 00100111 (rightmost bit is the LSB)?OptionsA) 134 B) 133C) 124 D) 123Your Answer (Not Answered)Correct Answer B

16 In a computer system, four files of size 11050 bytes, 4990 bytes, 5170 bytes and 12640 bytes need to be stored. For storing these files on disk, we can use either 100 byte disk blocks or 200 byte disk blocks (but can’t mix block sizes). For each block used to store a file, 4 bytes of bookkeeping information also needs to be stored on the disk. Thus, the total space used to store a file is the sum of the space taken to store the file and the space taken to store the bookkeeping information for the blocks allocated for storing the file. A disk block can store either book keeping information for a file or data from a file, but not both.What is the total space required for storing the files using 100 byte disk blocks and 200 byte disk blocks respectively?OptionsA) 35400 and 35800 bytes B) 35800 and 35400 bytesC) 35600 and 35400 bytes D) 35400 and 35600 bytesYour Answer (Not Answered)Correct Answer C

Page 9: GATE Questions

17 A 20 Kbps satellite link has a propagation delay of 400 ms. The transmitter employs the “go back n ARQ” scheme with n set to 10. Assuming that each frame is 100 bytes long, what is the maximum data rate possible?OptionsA) 5 Kbps B) 10 KbpsC) 15 Kbps D) 20 KbpsYour Answer (Not Answered)Correct Answer D

18 A binary search tree contains the numbers 1, 2, 3, 4, 5, 6, 7, 8. When the tree is traversed inpre-order and the values in each node printed out, the sequence of values obtained is 5, 3, 1, 2, 4, 6, 8, 7. If the tree is traversed in post-order, the sequence obtained would beOptionsA) 8, 7, 6, 5, 4, 3, 2, 1 B) 1, 2, 3, 4, 8, 7, 6, 5C) 2, 1, 4, 3, 6, 7, 8, 5 D) 2, 1, 4, 3, 7, 8, 6, 5Your Answer (Not Answered)Correct Answer D

19 The language [0n 1n 2n |1 £ n £ 106] isOptionsA) regularB) context-free but not regular.C) context-free but its complement is not context-free. D) not context-free.Your Answer (Not Answered)Correct Answer A

20The following C function takes a singly-linked list of integers as a parameter and rearranges the elements of the list. The list is represented as pointer to a structure. The function is called with the list containing the integers 1, 2, 3, 4, 5, 6, 7 in the given order. What will be the contents of the list after the function completes execution?struct node {int value; struct node *next;};void rearrange (struct node *list) {struct node *p, *q;int temp;if (!list \\ !list ® next) return;p = list; q = list ® next;while (q) {temp = p ® value;p ® value = q ® value;q ® value = temp;p = q ® next;q = p ? p ® next : 0;}}OptionsA) 1, 2, 3, 4, 5, 6, 7 B) 2, 1, 4, 3, 6, 5, 7C) 1, 3, 2, 5, 4, 7, 6 D) 2, 3, 4, 5, 6, 7, 1

Page 10: GATE Questions

Your Answer (Not Answered)Correct Answer B

GATE Information Technology Question Papers-3By admin on September 18th, 2008 Read this page in hindiInformation Technology papers 03 Questions And Answers

1 The availability of a complex software is 90%. Its Mean Time Between Failure (MTBF) is 200 days. Because of the critical nature of the usage, the organization deploying the softwarefurther enhanced it to obtain an availability of 95%. In the process, the Mean Time To Repair (MTTR) increased by 5 days.What is the MTBF of the enhanced softwareOptionsA) 205 days B) 300 daysC) 500 days D) 700 daysYour Answer ( Not Answered )Correct Answer C

2 A line L in a circuit is said to have a stuck-at-0 fault if the line permanently has a logic value 0. Similarly a line L in a circuit is said to have a stuck-at-1 fault if the line permanently has a logic value 1. A circuit is said to have a multiple stuck-at fault if one or more lines have stuck at faults. The total number of distinct multiple stuck-at faults possible in a circuit with N lines isOptionsA) 3 N B) 3 N -1C) 2 N -1 D) 2 NYour Answer ( Not Answered )Correct Answer C

3 Which of the following statements is TRUE about the regular expression 01*0?OptionsA) It represents a finite set of finite strings. B) It represents an infinite set of finite strings.C) It represents a finite set of infinite strings. D) It represents an infinite set of infinite strings.Your Answer ( Not Answered )Correct Answer B

4 In a population of N families, 50% of the families have three children, 30% of the families have two children and the remaining families have one child. What is theprobability that a randomly picked child belongs to a family with two children?OptionsA)323B)623C)3

Page 11: GATE Questions

10D)35Your Answer ( Not Answered )Correct Answer B

5 We have two designs D1 and D2 for a synchronous pipeline processor. D1 has 5 pipeline stages with execution times of 3 nsec, 2 nsec, 4 nsec, 2 nsec and 3 nsec while the design D2 has 8 pipeline stages each with 2 nsec execution time. How much time can be saved using design D2 over design D1 for executing 100 instructions?OptionsA) 214 nsec B) 202 nsecC) 86 nsec D) -200 nsecYour Answer ( Not Answered )Correct Answer A

6 The numbers 1, 2,…. n are inserted in a binary search tree in some order. In the resulting tree, the right subtree of the root contains p nodes. The first number to be inserted in the tree must beOptionsA) p B) p + 1C) n – p D) n – p + 1Your Answer ( Not Answered )Correct Answer D

7 In a computer system, four files of size 11050 bytes, 4990 bytes, 5170 bytes and 12640 bytes need to be stored. For storing these files on disk, we can use either 100 byte disk blocks or 200 byte disk blocks (but can’t mix block sizes). For each block used to store a file, 4 bytes of bookkeeping information also needs to be stored on the disk. Thus, the total space used to store a file is the sum of the space taken to store the file and the space taken to store the bookkeeping information for the blocks allocated for storing the file. A disk block can store either book keeping information for a file or data from a file, but not both.What is the total space required for storing the files using 100 byte disk blocks and 200 byte disk blocks respectively?OptionsA) 35400 and 35800 bytes B) 35800 and 35400 bytesC) 35600 and 35400 bytes D) 35400 and 35600 bytesYour Answer ( Not Answered )Correct Answer C

8 Which of the following commands or sequences of commands will rename a file x to file y in a Unix system ?I. mv y, xII. mv x, yIII. cp y, x (rm x)IV. cp x, y (rm x)OptionsA) II and III B) II and IV

Page 12: GATE Questions

C) I and III D) II onlyYour Answer ( Not Answered )Correct Answer B

9 Let n = p 2 q, where p and q are distinct, prime numbers. How many numbers m satisfy 1 £ m £ n and gcd (m, n) = 1? Note that gcd (m, n) is the greatest common divisor of m and n.OptionsA) p(q – 1) B) pqC) (p 2 – 1) (q – 1) D) p(p – 1) (q – 1)Your Answer ( Not Answered )Correct Answer D

10 Let A be a set with n elements. Let C be a collection of distinct subsets of A such that for any two subsets S 1 and S 2 in C, either S 1 Ì S 2 or S 2 Ì S 1 . What is the maximum cardinality of C?OptionsA) n B) n + 1C) 2 n-1 + 1 D) n!Your Answer ( Not Answered )Correct Answer C

11Consider two tables in a relational database with columns and rows as follows:Table: Student Table: DepartmentRoll_no Name Dept_id Dept_id Dept_name1 ABC 1 1 A2 DEF 1 2 B3 GHI 2 3 C4 JKL 3Roll_no is the primary key of the Student table, Dept_id is the primary hey of the Department table and Student. Dept_id is a foreign key from Department. Dept_id What will happen if we try to execute the following two SQL statements?

(i) update Student set Dept_id = Null where Roll_on = 1

(ii) update Department set Dept_id = Null where Dept_id = 1OptionsA) Both (i) and (ii) will failB) (i) will fail but (ii) will succeedC) (i) will succeed but (ii) will failD) Both (i) and (ii) will succeedYour Answer ( Not Answered )Correct Answer B

12 Let M = (K, å , G , D , s, F) be a pushdown automaton, whereK = {s, f}, F = {f}, å = {a, b}, G = {a} andD = {((s, a, e ), (s, a)), ((s, b, e ), (s, a)), (( s, a, e ), (f, e )), ((f, a, a ), (f, e )), ((f, b, a), (f, e ))}Which one of the following strings is not a member of L(M)?Options

Page 13: GATE Questions

A) aaa B) aababC) baaba D) babYour Answer ( Not Answered )Correct Answer C

13 Let P be a non-deterministic push-down automaton (NPDA) with exactly one state, q, and exactly one symbol, Z, in its stack alphabet. State q is both the starting as well as the accepting state of the PDA. The stack is initialized with one Z before the start of the operation of the PDA. Let the input alphabet of the PDA be å . Let L(P) be the language accepted by the PDA by reading a string and reaching its accepting state. Let N(P) be the language accepted by the PDA by reading a string and emptying its stack.Which of the following statements is TRUE?OptionsA) L(P) is necessarily å * but N(P) is not necessarily å *. B) N(P) is necessarily å * but L(P) is not necessarily å *.C) Both L(P) and N(P) is necessarily å *. D) Neither L(P) nor N(P) are necessarily å *.Your Answer ( Not Answered )Correct Answer D

14

Let p, q, r and s be four primitive statements. Consider the following arguments:

P: [ ( Ø p Ú q) Ù (r ® s) Ù (p Ú r) ] ® ( Ø s ® q)

Q: [ ( Ø p Ú q) Ù (q ® (p ® r)) ] ® Ø r

R: [ ((q Ù r) ® p) Ù ( Ø q Ú p) ] ® r

S: [ p Ù (p ® r) Ù (q Ú Ø r) ] ® q

Which of the above arguments are valid?OptionsA) P and Q only B) P and R onlyC) P and S only D) P, Q, R and SYour Answer ( Not Answered )Correct Answer C

15 Assume that the delivered lines of code L of a software is related to the effort E in person months and duration t in calendar months by the relation L P* (E/B) 1/3 * t 4/3 , where P and B are two constants for the software process and skills factor. For a software project, the effort was estimated to be 20 person months and the duration was estimated to be 8 months. However, the customer asked the project team to complete the software project in 4 months. What would be the required effort in person months?OptionsA) 10 B) 40C) 160 D) 320Your Answer ( Not Answered )Correct Answer D

16 Traceroute reports a possible route that is taken by packets moving from some host A to some other host B. Which of the following options represents the technique used by traceroute to identify these hosts

Page 14: GATE Questions

OptionsA) By progressively querying routers about the next router on the path to B using ICMP packets, starting with the first router B) By requiring each router to append the address to the ICMP packet as it is forwarded to B. The list of all routers en-route to B is returned by B in an ICMP reply packetC) By ensuring that an ICMP reply packet is returned to A by each router en-route to B, in the ascending order of their hop distance from A D) By locally computing the shortest path from A to BYour Answer ( Not Answered )Correct Answer C

17Consider a list of recursive algorithms and a list of recurrence relations as shown below. Each recurrence relation corresponds to exactly one algorithm and is used to derive the time complexity of the alogrithm.Recursive Algorithm Recurrence RelationP. Binary search I. T(n) = T(n-k) + T(k) + cnQ. Merge sort II. T(n) = 2T(n -1) + 1R. Quick sort III. T(n) = 2T(n/2) + cnS. Tower of Hanoi IV. T(n) = T(n/2) + 1Which of the following is the correct match between the algorithms and their recurrence relations?OptionsA) P-II, Q-III, R-IV, S-I B) P-IV, Q-III, R-I, S-IIC) P-III, Q-II, R-IV, S-I D) P-IV, Q-II, R-I, S-IIIYour Answer ( Not Answered )Correct Answer B

18 A function f defined on stacks of integers satisfies the following properties.f( f )= 0 and f(push(S, i)) = max (f(S),0) + i for all stacks S and integers i. If a stack S contains the integers 2, -3, 2, -1, 2 in order from, bottom to top, what is f(S)?OptionsA) 6 B) 4C) 3 D) 2Your Answer ( Not Answered )Correct Answer C

19 Consider the following C program which is supposed to compute the transpose of a given 4×4 matrix M. Note that, there is an X in the program which indicates some missing statements. Choose the correct option to replace X in the program.#include#define ROW 4#defme COL 4int M[ROW][COL] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};main( ){int i, j, t;for (i=0; i<4; ++i){X

Page 15: GATE Questions

}for (i=0; i<4; ++i) for (j=0; j<4; ++j)printf("%d", M[i][j]);}OptionsA) for(j=0; j<4; ++j){t = M[i][j];M[i][j] = M[j][i];M[j][i] = t;} B) for(j=0; j<4; ++j){M[i][j] = t;t = M[j][i];M|j][i] = M[i][j];}C) for(j=i; j<4; ++j){t = M[j][i];M[i][j] = M[j][i];M[j][i] = t;} D) for(j=i; j<4; ++j]){M[i][j] = t;t = M[j][i];M[j][i] = M[i][j];}Your Answer ( Not Answered )Correct Answer C

20Consider the following program module:int module1 (int x, int y)while (x!=y) {if(x > y)x = x – y;else y = y – x;}return x;}What is Cyclomatic complexity of the above module?OptionsA) 1 B) 2C) 3 D) 4Your Answer ( Not Answered )Correct Answer C

GATE – Sample Questions – CSE 3By admin on September 18th, 2008 Read this page in hindi

1.What does the following algorithm approximate? (Assume m > 1, Î > 0).x = m;

Page 16: GATE Questions

y-i;while (x – y > Î ){ x = (x + y) / 2 ;y = m/x ;}print (x) ;OptionsA) log m B)m 2C) m 1/2 D) m 1/3Your Answer ( Not Answered )Correct Answer C

2 The problems 3-SAT and 2-SAT areOptionsA) both in PB) both NP-completeC) NP-complete and in P respectively D) undecidable and NP-complete respectivelyYour Answer ( Not Answered )Correct Answer C

3 Consider a relation scheme R = (A, B, C, D, E, H) on which the following functional dependencies hold : (A ® B, BC ® D, E ® C, D ® A). What are the candidate keys of R?OptionsA) AE, BE B) AE, BE, DEC) AEH, BEH, BCH D) AEH, BEH, DEHYour Answer ( Not Answered )Correct Answer D

4 A circuit outputs a digit in the form of 4 bits. 0 is represented by 0000,1 by 0001,…, 9 by 1001. A combinational circuit is to be designed which takes these 4 bits as input and outputs 1 if the digit ³ 5, and 0 otherwise. If only AND, OR and NOT gates may be used, what is the minimum number of gates required?OptionsA) 2 B) 3C) 4 D) 5Your Answer ( Not Answered )Correct Answer C

5 If 73 x (in base-x number system) is equal to 54 y (in base-y number system), the possible values of x and y areOptionsA) 8, 16 B) 10, 12C) 9, 13 D) 8, 11Your Answer ( Not Answered )Correct Answer D

6 In a packet switching network, packets are routed from source to destination along a single path having two intermediate nodes. If the message size is 24 bytes and each packet contains a header of 3 bytes, then the optimum packet size is

Page 17: GATE Questions

OptionsA) 4 B) 6C) 7 D) 9Your Answer ( Not Answered )Correct Answer D

7 Consider the following program fragment for reversing the digits in a given integer to obtain a new integer. Let n = d 1 d 2 … d m .int n, rev;rev = 0;while (n > 0) {rev = rev * 10 + n % 10 ;n = n/10;}The loop invariant condition at the end of the ith iteration is:OptionsA) n = d 1 d 2 … d m-i and rev = d m d m-1 ….d m-i+1 B) n = d m-i+1 …d m-1 d m (or) rev = d m-i …d 2 d 1C) n ¹ rev D) n = d 1 d 2 …d m (or) rev = d m …d 2 d 1Your Answer ( Not Answered )Correct Answer A

8

Consider the following program segment for a hypothetical CPU having three user registers Rl, R2 and R3.

Instruction Operation Instruction Size (in words)MOV Rl,5000 ; Rl ¬ Memory[5000] 2MOV R2,(R1) ; R2 ¬ Memory[(Rl)] 1ADD R2,R3 ; R2 ¬ R2 + R3 1MOV 6000, R2 ; Memory[6000] ¬ R2 2HALT ; Machine halts 1Let the clock cycles required for various operations be as follows:Register to/from memory transfer : 3 clock cyclesADD with both operands in register : 1 clock cycleInstruction fetch and decode : 2 clock cycles per wordThe total number of clock cycles required to execute the program isOptionsA) 29 B) 24C) 23 D) 20Your Answer ( Not Answered )Correct Answer B

9 Consider an operating system capable of loading and executing a singlesequential user process at a time. The disk head scheduling algorithm used is First Come First Served (FCFS). If FCFS is replaced by Shortest Seek Time First (SSTF), claimed by the vendor to give 50% better benchmark results, what is the expected improvement in the I/O performance of user programs ?OptionsA) 50% B) 40%

Page 18: GATE Questions

C) 25% D) 0%Your Answer ( Not Answered )Correct Answer D

10 Consider the following statements with respect to user-level threads andkernel-supported threads(i) Context switch is faster with kernel-supported threads(ii) For user-level threads, a system call can block the entire process(iii) Kernel-supported threads can be scheduled independently(iv) User-level threads are transparent to the kernelWhich of the above statements are true?OptionsA) (ii), (iii) and (iv) only B) (ii) and (iii) onlyC) (i), and (iii) only D) (i) and (ii) onlyYour Answer ( Not Answered )Correct Answer A

11 Consider three decision problems P 1 , P 2 and P 3 . It is known that P 1 is decidable and P 2 is undecidable. Which one of the following is TRUE?OptionsA) P 3 is decidable if P 1 is reducible to P 3 B) P 3 is undecidable if P 3 is reducible to P 2C) P 3 is undecidable if P 2 is reducible to P 3D) P 3 is decidable if P 3 is reducible to P 2 s complementYour Answer ( Not Answered )Correct Answer A

12Which one of the following are essential features of an object-orientedprogramming language?(i) Abstraction and encapsulation

(ii) Strictly-typedness(iii) Type-safe property coupled with sub-type rule(iv) Polymorphism in the presence of inheritanceOptionsA) (i) and (ii) only B) (i) and (iv) onlyC) (i), (ii) and (iv) only D) (i), (iii) and (iv) onlyYour Answer ( Not Answered )Correct Answer B

13 Consider the following relation schema pertaining to a students database:Student ( rollno , name, address)Enroll ( rollno , courseno , coursename)where the primary keys are shown underlined. The number of tuples in the Student and Enroll tables are 120 and 8 respectively. What are the maximum and minimum number of tuples that can be present in (Student * Enroll), where ‘*’denotes natural join?OptionsA) 8, 8 B) 120, 8C) 960, 8 D) 960, 120Your Answer ( Not Answered )

Page 19: GATE Questions

Correct Answer C

14

Assume the following C variable declaration

int *A [10], B [10][10];

Of the following expressions

I A[2] II A [2] [3]

III B[l] IV B[2][3]

which will not give compile-time errors if used as left hand sides of assignment statements in a C program ?OptionsA) I, II, and IV only B) II, III, and IV onlyC) II and IV only D) IV onlyYour Answer ( Not Answered )Correct Answer D

15 How many distinct binary search trees can be created out of 4 distinct keys?OptionsA) 5 B) 14C) 24 D) 42Your Answer ( Not Answered )Correct Answer B

16 Given the following input (4322, 1334, 1471, 9679, 1989, 6171, 6173, 4199) and the hash function x mod 10, which of the following statements are true ?(i) 9679, 1989, 4199 hash to the same value(ii) 1471, 6171 hash to the same value(iii) All elements hash to the same value(iv) Each element hashes to a different valueOptionsA) (i) only B) (ii) onlyC) (i) and (ii) only D) (iii) or (iv)Your Answer ( Not Answered )Correct Answer C

17 Packets of the same session may be routed through different paths inOptionsA) TCP, but not UDP B) TCP and UDPC) UDP, but not TCP D) Neither TCP, nor UDPYour Answer ( Not Answered )Correct Answer B

18 The following numbers are inserted into an empty binary search tree in the given order: 10, 1, 3, 5, 15, 12, 16. What is the height of the binary search tree (the height is the maximum distance of a leaf node from the root)?OptionsA) 2 B) 3

Page 20: GATE Questions

C) 4 D) 6Your Answer ( Not Answered )Correct Answer B

19 Postorder traversal of a given binary search tree, T produces the following sequence of keys10, 9, 23, 22, 27, 25, 15, 50, 95, 60, 40, 29Which one of the following sequences of keys can be the result of an inorder traversal of the tree T?OptionsA) 9, 10, 15, 22, 23, 25, 27, 29, 40, 50, 60, 95 B) 9, 10, 15, 22, 40, 50, 60, 95, 23, 25, 27, 29C) 29, 15, 9, 10, 25, 22, 23, 27, 40, 60, 50, 95D) 95, 50, 60, 40, 27, 23, 22, 25, 10, 9, 15, 29Your Answer ( Not Answered )Correct Answer A

20 Let f: B ® C and g: A ® B be two functions and let h = f o g. Given that h is an onto function. Which one of the following is TRUE?OptionsA) f and g should both be onto functions. B) f should be onto but g need not be ontoC) g should be onto but f need not be onto D) both f and g need not be ontoYour Answer ( Not Answered )Correct Answer B

GATE QUESTION PAPER-COMP SCBy ravi on July 28th, 2008 Read this page in hindiQuestions And Answers

1 What does the following algorithm approximate? (Assume m > 1, Î > 0).x = m;y-i;while (x – y > Î){ x = (x + y) / 2 ;y = m/x ;}print (x) ;OptionsA) log m B)

m2

C) m1/2 D) m1/3Your Answer (Not Answered)Correct Answer C

2 The problems 3-SAT and 2-SAT areOptions

Page 21: GATE Questions

A) both in PB) both NP-completeC) NP-complete and in P respectively D) undecidable and NP-complete respectivelyYour Answer (Not Answered)Correct Answer C

3 Consider a relation scheme R = (A, B, C, D, E, H) on which the following functional dependencies hold : (A ® B, BC ® D, E ® C, D ® A). What are the candidate keys of R?OptionsA) AE, BE B) AE, BE, DEC) AEH, BEH, BCH D) AEH, BEH, DEHYour Answer (Not Answered)Correct Answer D

4 A circuit outputs a digit in the form of 4 bits. 0 is represented by 0000,1 by 0001,…, 9 by 1001. A combinational circuit is to be designed which takes these 4 bits as input and outputs 1 if the digit ³ 5, and 0 otherwise. If only AND, OR and NOT gates may be used, what is the minimum number of gates required?OptionsA) 2 B) 3C) 4 D) 5Your Answer (Not Answered)Correct Answer C

5 If 73x (in base-x number system) is equal to 54y (in base-y number system), the possible values of x and y areOptionsA) 8, 16 B) 10, 12C) 9, 13 D) 8, 11Your Answer (Not Answered)Correct Answer D

6 In a packet switching network, packets are routed from source to destination along a single path having two intermediate nodes. If the message size is 24 bytes and each packet contains a header of 3 bytes, then the optimum packet size isOptionsA) 4 B) 6C) 7 D) 9Your Answer (Not Answered)Correct Answer D

7 Consider the following program fragment for reversing the digits in a given integer to obtain a new integer. Let n = d1d2… dm.int n, rev;rev = 0;while (n > 0) {rev = rev * 10 + n % 10 ;n = n/10;}The loop invariant condition at the end of the ith iteration is:

Page 22: GATE Questions

OptionsA) n = d1d2… dm-i and rev = dmdm-1….dm-i+1 B) n = dm-i+1…dm-1dm (or) rev = dm-i…d2d1C) n ¹ rev D) n = d1d2…dm (or) rev = dm…d2d1Your Answer (Not Answered)Correct Answer A

8

Consider the following program segment for a hypothetical CPU having three user registers Rl, R2 and R3.

Instruction Operation Instruction Size (in words)MOV Rl,5000 ; Rl ¬ Memory[5000] 2MOV R2,(R1) ; R2 ¬ Memory[(Rl)] 1ADD R2,R3 ; R2 ¬ R2 + R3 1MOV 6000, R2 ; Memory[6000] ¬ R2 2HALT ; Machine halts 1Let the clock cycles required for various operations be as follows:Register to/from memory transfer : 3 clock cyclesADD with both operands in register : 1 clock cycleInstruction fetch and decode : 2 clock cycles per wordThe total number of clock cycles required to execute the program isOptionsA) 29 B) 24C) 23 D) 20Your Answer (Not Answered)Correct Answer B

9 Consider an operating system capable of loading and executing a singlesequential user process at a time. The disk head scheduling algorithm used is First Come First Served (FCFS). If FCFS is replaced by Shortest Seek Time First (SSTF), claimed by the vendor to give 50% better benchmark results, what is the expected improvement in the I/O performance of user programs ?OptionsA) 50% B) 40%C) 25% D) 0%Your Answer (Not Answered)Correct Answer D

10 Consider the following statements with respect to user-level threads andkernel-supported threads(i) Context switch is faster with kernel-supported threads(ii) For user-level threads, a system call can block the entire process(iii) Kernel-supported threads can be scheduled independently(iv) User-level threads are transparent to the kernelWhich of the above statements are true?OptionsA) (ii), (iii) and (iv) only B) (ii) and (iii) onlyC) (i), and (iii) only D) (i) and (ii) onlyYour Answer (Not Answered)

Page 23: GATE Questions

Correct Answer A

11 Consider three decision problems P1, P2 and P3. It is known that P1 is decidable and P2 is undecidable. Which one of the following is TRUE?OptionsA) P3 is decidable if P1 is reducible to P3 B) P3 is undecidable if P3 is reducible to P2C) P3 is undecidable if P2 is reducible to P3D) P3 is decidable if P3 is reducible to P2s complementYour Answer (Not Answered)Correct Answer A

12Which one of the following are essential features of an object-orientedprogramming language?(i) Abstraction and encapsulation

(ii) Strictly-typedness(iii) Type-safe property coupled with sub-type rule(iv) Polymorphism in the presence of inheritanceOptionsA) (i) and (ii) only B) (i) and (iv) onlyC) (i), (ii) and (iv) only D) (i), (iii) and (iv) onlyYour Answer (Not Answered)Correct Answer B

13 Consider the following relation schema pertaining to a students database:Student (rollno, name, address)Enroll (rollno, courseno, coursename)where the primary keys are shown underlined. The number of tuples in the Student and Enroll tables are 120 and 8 respectively. What are the maximum and minimum number of tuples that can be present in (Student * Enroll), where ‘*’denotes natural join?OptionsA) 8, 8 B) 120, 8C) 960, 8 D) 960, 120Your Answer (Not Answered)Correct Answer C

14

Assume the following C variable declaration

int *A [10], B [10][10];

Of the following expressions

I A[2] II A [2] [3]

III B[l] IV B[2][3]

which will not give compile-time errors if used as left hand sides of assignment statements in a C program ?OptionsA) I, II, and IV only B) II, III, and IV onlyC) II and IV only D) IV only

Page 24: GATE Questions

Your Answer (Not Answered)Correct Answer D

15 How many distinct binary search trees can be created out of 4 distinct keys?OptionsA) 5 B) 14C) 24 D) 42Your Answer (Not Answered)Correct Answer B

16 Given the following input (4322, 1334, 1471, 9679, 1989, 6171, 6173, 4199) and the hash function x mod 10, which of the following statements are true ?(i) 9679, 1989, 4199 hash to the same value(ii) 1471, 6171 hash to the same value(iii) All elements hash to the same value(iv) Each element hashes to a different valueOptionsA) (i) only B) (ii) onlyC) (i) and (ii) only D) (iii) or (iv)Your Answer (Not Answered)Correct Answer C

17 Packets of the same session may be routed through different paths inOptionsA) TCP, but not UDP B) TCP and UDPC) UDP, but not TCP D) Neither TCP, nor UDPYour Answer (Not Answered)Correct Answer B

18 The following numbers are inserted into an empty binary search tree in the given order: 10, 1, 3, 5, 15, 12, 16. What is the height of the binary search tree (the height is the maximum distance of a leaf node from the root)?OptionsA) 2 B) 3C) 4 D) 6Your Answer (Not Answered)Correct Answer B

19 Postorder traversal of a given binary search tree, T produces the following sequence of keys10, 9, 23, 22, 27, 25, 15, 50, 95, 60, 40, 29Which one of the following sequences of keys can be the result of an inorder traversal of the tree T?OptionsA) 9, 10, 15, 22, 23, 25, 27, 29, 40, 50, 60, 95 B) 9, 10, 15, 22, 40, 50, 60, 95, 23, 25, 27, 29C) 29, 15, 9, 10, 25, 22, 23, 27, 40, 60, 50, 95D) 95, 50, 60, 40, 27, 23, 22, 25, 10, 9, 15, 29Your Answer (Not Answered)

Page 25: GATE Questions

Correct Answer A

20 Let f: B ® C and g: A ® B be two functions and let h = f o g. Given that h is an onto function. Which one of the following is TRUE?OptionsA) f and g should both be onto functions. B) f should be onto but g need not be ontoC) g should be onto but f need not be onto D) both f and g need not be ontoYour Answer (Not Answered)Correct Answer B