You are on page 1of 13

Sample paper of gate

Let the clock cycles required for various operations be as follows: Register to/from memory transfer : 3 clock cycles ADD with both operands in register : 1 clock cycle Instruction fetch and decode : 2 clock cycles per word The total number of clock cycles required to execute the program is Options Correct Answer A) 29 B) 24 C) 23 D) 20 B The order of an internal node in a B+ tree index is the maximum number of children it can have. Suppose that a child pointer takes 6 bytes, the search field value takes 14 bytes, and the block size is 512 bytes. What is the order of the internal node? A) 24 B) 25 C) 26 D) 27 C The Boolean function x, y, + xy + x, y A) x, + y, B) x + y C) x + y, D) x, + y D In an MxN matrix such that all non-zero entries are covered in a rows and b columns. Then the maximum number of non-zero entries, such that no two are on the same row or column, is A) a + b B) max {a, b} C) min {M-a, N-b} D) min {a, b}

Options Correct Answer 3 Options Correct Answer

Options

Correct Answer

A The relation scheme Student Performance (name, courseNo, rollNo, grade) has the following functional dependencies: name, courseNo grade rollNo, courseNo grade name rollNo rollNo name The highest normal form of this relation scheme is A The minimum number of page frames that must be allocated to a running process in a virtual memory environment is determined by A) the instruction set architecture B) page size C) physical memory size D) number of processes in memory D Consider the following program segment for a hypothetical CPU having three user registers Rl, R2 and R3. Instruction Operation Instruction Size (in words)

Correct Answer 6 Options Correct Answer

MOV Rl,5000 ; Rl Memory[5000] 2 MOV R2,(R1) ; R2 Memory[(Rl)] 1 7 ADD R2,R3 HALT ; R2 R2 + R3 ; Machine halts 1 1 MOV 6000, R2 ; Memory[6000] R2 2

Consider that the memory is byte addressable with size 32 bits, and the program has been loaded starting from memory location 1000 (decimal). If an interrupt occurs while the CPU has been halted after executing the HALT instruction, the return address (in decimal) saved in the stack will be Options Correct Answer 8 Options Correct Answer A) 1007 B) 1020 C) 1024 D) 1028 A Let G be a simple graph with 20 vertices and 100 edges. The size of the minimum vertex cover of G is 8. Then, the size of the maximum independent set of G is A) 12 B) 8 C) Less than 8 D) More than 12 A

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) ; B)

Options

A) log m m2

C) m1/2 Correct Answer C

D) m1/3

10

Consider the following C program main () { int x, y, m, n ; scanf ("%d %d", &x, &y); / * Assume x > 0 and y > 0 * / m = x; n = y ; while ( m ! = n) { if (m > n) m = m n; else n=n-m;} printf("%d",n); } The program computes

Options Correct Answer 11 Options Correct Answer

A) x + y, using repeated subtraction B) x mod y using repeated subtraction C) the greatest common divisor of x and y D) the least common multiple of x and y C The best data structure to check whether an arithmetic expression has balanced parentheses is a A) queue B) stack C) tree D) list B A Priority-Queue is implemented as a Max-Heap. Initially, it has 5 elements. The level-order traversal of the heap is given below: 10, 8,5,3,2 Two new elements 1 and 7 are inserted in the heap in that order. The level-order traversal of the heap after the insertion of the elements is

12

Options Correct Answer

A) 10,8,7,5,3,2,1 B) 10,8,7,2,3,1,5 C) 10,8,7,1,2,3,5 D) 10,8,7,3,2,1,5 D Consider the following C program segment struct CellNode { struct CellNode *leftChild ; int element; struct CellNode *rightChild ; }; int DoSomething (struct CellNode *ptr) { int value = 0 ; if (ptr ! = NULL) { if (ptr->leftChild ! = NULL) value = 1 + DoSomething (ptr - > leftChild) ; if (ptr - > rightChild ! = NULL) value = max (value, 1 + DoSomething (ptr - > rightChild)) ; } return (value); } The value returned by the function DoSomething when a pointer to the root of a non-empty tree is passed as argument is

13

Options Correct Answer 14 Options Correct Answer 15 Options Correct Answer

A) The number of leaf nodes in the tree B) The number of nodes in the tree C) The number of internal nodes in the tree D) The height of the tree D An organization has a class B network and wishes to form subnets for 64 departments. The subnet mask would be A) 255.255.0.0 B) 255.255.64.0 C) 255.255.128.0 D) 255.255.252.0 D Suppose the round trip propagation delay for a 10 Mbps Ethernet having 48-bit jamming signal is 46.4 s. The minimum frame size is: A) 94 B) 416 C) 464 D) 512 C Consider the following C program segment:

16

char p [ 20];

char * s = "string" ; int length = strlen (s) ; for (i = 0 ; i < length; i++) p[ i ] = s [length - i] ; print f ("%s", p) ; The output of the program is Correct Answer A Consider the grammar S (S) | a Let the number of states in SLR(1), LR(1) and LALR(1) parsers for the grammar be n1, n2 and n3 respectively. The following relationship holds good A) n1< n2 < n3 B) n1= n3 < n2 C) n1= n2 = n3 D) n1 n3 n2 B Consider the following C function: int f (int n) { static int i = 1; if (n >= 5) return n; n = n + i; i ++; return f (n); } The value returned by f(1) is A) 5 B) 6 C) 7 D) 8 C Consider the following code fragment: if (fork ( ) = = 0) 19 {a = a + 5; print f (%d, %d / n, a, and a); } else {a - 5; print f ( %d, %d / n, a,& a); } Let u, v be the values printed by the parent process, and x, y be the values printed by the child process. Which one of the following is TRUE? Options Correct Answer A) u = x + 10 and v = y B) u = x + 10 and v y C) u + 10 =x and v = y D) u + 10 = x and v y B

17

Options Correct Answer

18

Options Correct Answer

20

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)? A) 2 B) 3 C) 4 D) 6 B

Options Correct Answer

freshersw orld.co

Enter your search terms

Submit search

form

Search

Web

freshersworld.com
1 en ISO-8859-1 ISO-8859-1 active

pub-7447756575 GALT:#008000;G

Defence Careers | GATE | GRE | MBA | Scholarships | Freshers Directory | Higher Studies | Build Resume | BPO jobs | Interview Tips Contact US|Tell A Friend|| Advertise with Us | FAQ| Sign Up | President's Note Consider the following C function void swap (int a, int b) { int temp ; temp = a ; a= b; b = temp ; } In order to exchange the values of two variables x and y. Options A) call swap (x, y) B) call swap (&x, &y) C) swap (x, y) cannot be used as it does D) swap (x, y) cannot be used as the parameters not return any value are passed by value Your Answer (Not Answered) Correct Answer B 2 A 5 stage pipelined CPU has the following sequence of stages: IF - Instruction fetch from instruction memory, RD - Instruction decode and register read, EX - Execute: ALU operation for data and address computation, MA - Data memory access - for write access, the register read at RD stage is used, WB - Register write back. Consider the following sequence of instructions: I1 : L R0, 1oc1; R0 <= M[1oc1] I2 : A R0, R0; R0 <= R0 + R0 I3: A R2, R0; R2 <= R2 - R0 Let each stage take one clock cycle. What is the number of clock cycles taken to complete the above sequence of instructions starting from the fetch of I1? Options

A) 8 B) 10 C) 12 D) 15 Your Answer (Not Answered) Correct Answer A 3 The address resolution protocol (ARP) is used for Options B) Finding the IP address of the default A) Finding the IP address from the DNS gateway C) Finding the IP address that corresponds to D) Finding the MAC address that corresponds a MAC address to an IP address Your Answer (Not Answered) Correct Answer D 4 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? Options A) 8, 8 B) 120, 8 C) 960, 8 D) 960, 120 Your Answer (Not Answered) Correct Answer C 5 Consider a direct mapped cache of size 32 KB with block size 32 bytes. The CPU generates 32 bit addresses. The number of bits needed for cache indexing and the number of tag bits are respectively Options A) 10, 17 B) 10, 22 C) 15, 17 D) 5, 17 Your Answer (Not Answered) Correct Answer A 6 Which one of the following is a key factor for preferring B+ -trees to binary search trees for indexing database relations? Options A) Database relations have a large number of B) Database relations are sorted on the records primary key + C) B -trees require less memory than binary D) Data transfer from disks is in blocks search trees Your Answer (Not Answered) Correct Answer D 7 The goal of structured programming is to Options B) be able to infer the flow of control from the A) have well indented programs compiled code C) be able to infer the flow of control from D) avoid the use of GOTO statements the program text Your Answer (Not Answered) Correct Answer C 8 The tightest lower bound on the number of comparisons, in the worst ease, for comparison-based sorting is of the order of Options A) n B) n2 C) n log n D) n log2 n Your Answer (Not Answered) Correct Answer B 9 Consider the following two problems on undirected graphs a: Given G(V, E), does G have an independent set of size |V| -4? b: Given G(V, E), does G have an independent set of size 5? Which one of the following is TRUE? Options A) is in P and is NP-complete B) is NP-complete and is in P

C) Both and are NP-complete D) Both and are in P Your Answer (Not Answered) Correct Answer C 10 Consider the languages L1 = {wwR | w {0, 1}*} L2 = {w# wR | w {0, 1}*}, where # is a special symbol L3 = {ww | w {0, 1}*} Which one of the following is TRUE? Options A) L1 is a deterministic CFL B) L2 is a deterministic CFL C) L3 is a CFL, but not a deterministic CFL D) L3 is a deterministic CFL Your Answer (Not Answered) Correct Answer B 11 Let G be a simple graph with 20 vertices and 100 edges. The size of the minimum vertex cover of G is 8. Then, the size of the maximum independent set of G is Options A) 12 B) 8 C) Less than 8 D) More than 12 Your Answer (Not Answered) Correct Answer A 12 A and B are the only two stations on an Ethernet. Each has a steady queue of frames to send. Both A and B attempt to transmit a frame, collide, and A wins the first backoff race. At the end of this successful transmission by A, both A and B attempt to transmit and collide. The probability that A wins the second backoff race is Options A) 0.5 B) 0.625 C) 0.75 D) 1.0 Your Answer (Not Answered) Correct Answer A 13 Consider the grammar EE+n|Exn|n For a sentence n + n x n, the handles in the right-sentential form of the reduction are Options A) n, E + n and E + n x n B) n, E + n and E + E x n C) n, n + n and n + n x n D) n, E + n and E x n Your Answer (Not Answered) Correct Answer D 14 Consider the grammar with the following translation rules and E as the start symbol. E E1 # T {E.value = E1.value * T.value } | T {E.value = T.value } T T1 & F { T.value = T1.value + F.value } | F {T.value = F.value} F num {F.value = num.value } Compute E. value for the root of the parse tree for the expression: 2 # 3 & 5 # 6 & 4. Options A) 200 B) 180 C) 160 D) 40 Your Answer (Not Answered) Correct Answer C 15 Let A be a sequence of 8 distinct integers sorted in ascending order. How many distinct pairs of sequences, B and C are there such that (i) each is sorted in ascending order, (ii) B has 5 and C has 3 elements, and (iii) the result of merging B and C gives A? Options A) 2 B) 30 C) 56 D) 256 Your Answer (Not Answered) Correct Answer D 16 Which one of the following is true for a CPU having a single interrupt request line and a single interrrupt grant line? Options A) Neither vectored interrupt nor multiple B) Vectored interrupts are not possible but

interrupting devices are possible. multiple interrupting devices are possible. C) Vectored interrupts and multiple D) Vectored interrupt is possible but multiple interrupting devices are both possible. interrupting devices are not possible. Your Answer (Not Answered) Correct Answer B 17 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? Options A) AE, BE B) AE, BE, DE C) AEH, BEH, BCH D) AEH, BEH, DEH Your Answer (Not Answered) Correct Answer D 18 In a network of LANs connected by bridges, packets are sent from one LAN to another through intermediate bridges. Since more than one path may exist between two LANs, packets may have to be routed through multiple bridges. Why is the spanning tree algorithm used for bridge-routing? Options A) For shortest path routing between LANs B) For avoiding loops in the routing paths C) For fault tolerance D) For minimizing collisions Your Answer (Not Answered) Correct Answer B 19 Suppose T(n) = 2T (n/2) + n, T(0) = T(1) = 1 Which one of the following is FALSE? Options A) T(n) = O(n2 ) B) T(n) = (n log n) C) T(n) = (n2) D) T(n) = O(n log n) Your Answer (Not Answered) Correct Answer B 20 Consider the following C program segment struct CellNode { struct CellNode *leftChild ; int element; struct CellNode *rightChild ; }; int DoSomething (struct CellNode *ptr) { int value = 0 ; if (ptr ! = NULL) { if (ptr->leftChild ! = NULL) value = 1 + DoSomething (ptr - > leftChild) ; if (ptr - > rightChild ! = NULL) value = max (value, 1 + DoSomething (ptr - > rightChild)) ; } return (value); } The value returned by the function DoSomething when a pointer to the root of a non-empty tree is passed as argument is Options

A) The number of leaf nodes in the tree B) The number of nodes in the tree C) The number of internal nodes in the tree D) The height of the tree Your Answer (Not Answered) Ans d 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) ; Options B) A) log m m2

C) m1/2 D) m1/3 Your Answer (Not Answered) Correct Answer C 2 The problems 3-SAT and 2-SAT are Options A) both in P B) both NP-complete C) NP-complete and in P respectively D) undecidable and NP-complete respectively Your 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? Options A) AE, BE B) AE, BE, DE C) AEH, BEH, BCH D) AEH, BEH, DEH Your 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? Options A) 2 B) 3 C) 4 D) 5 Your 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 are Options A) 8, 16 B) 10, 12 C) 9, 13 D) 8, 11 Your 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 Options A) 4 B) 6 C) 7 D) 9

Your 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: Options A) n = d1d2... dm-i and rev = dmdm-1.dm-i+1 B) n = dm-i+1...dm-1dm (or) rev = dm-i...d2d1 D) n = d1d2...dm (or) rev = dm...d2d1 C) n rev Your 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] 2 MOV R2,(R1) ; R2 Memory[(Rl)] 1 ADD R2,R3 HALT ; R2 R2 + R3 ; Machine halts 1 1 MOV 6000, R2 ; Memory[6000] R2 2

Let the clock cycles required for various operations be as follows: Register to/from memory transfer : 3 clock cycles ADD with both operands in register : 1 clock cycle Instruction fetch and decode : 2 clock cycles per word The total number of clock cycles required to execute the program is Options A) 29 B) 24 C) 23 D) 20 Your Answer (Not Answered) Correct Answer B 9 Consider an operating system capable of loading and executing a single sequential 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 ? Options A) 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 and kernel-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 kernel Which of the above statements are true? Options A) (ii), (iii) and (iv) only B) (ii) and (iii) only C) (i), and (iii) only D) (i) and (ii) only Your Answer (Not Answered) 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? Options A) P3 is decidable if P1 is reducible to P3 B) P3 is undecidable if P3 is reducible to P2 C) P3 is undecidable if P2 is reducible to D) P3 is decidable if P3 is reducible to P2s P3 complement Your Answer (Not Answered) Correct Answer A 12 Which one of the following are essential features of an object-oriented programming language? (i) Abstraction and encapsulation (ii) Strictly-typedness (iii) Type-safe property coupled with sub-type rule (iv) Polymorphism in the presence of inheritance Options A) (i) and (ii) only B) (i) and (iv) only C) (i), (ii) and (iv) only D) (i), (iii) and (iv) only Your 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? Options A) 8, 8 B) 120, 8 C) 960, 8 D) 960, 120 Your 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 ? Options A) I, II, and IV only B) II, III, and IV only D) IV only C) II and IV only Your Answer (Not Answered) Correct Answer D 15 How many distinct binary search trees can be created out of 4 distinct keys? Options

A) 5 B) 14 C) 24 D) 42 Your 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 value Options A) (i) only B) (ii) only C) (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 in Options A) TCP, but not UDP B) TCP and UDP C) UDP, but not TCP D) Neither TCP, nor UDP Your 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)? Options A) 2 B) 3 C) 4 D) 6 Your Answer (Not Answered) Correct Answer B 19 Postorder traversal of a given binary search tree, T produces the following sequence of keys 10, 9, 23, 22, 27, 25, 15, 50, 95, 60, 40, 29 Which one of the following sequences of keys can be the result of an inorder traversal of the tree T? Options A) 9, 10, 15, 22, 23, 25, 27, 29, 40, 50, 60, 95 B) 9, 10, 15, 22, 40, 50, 60, 95, 23, 25, 27, 29 C) 29, 15, 9, 10, 25, 22, 23, 27, 40, 60, 50, 95 D) 95, 50, 60, 40, 27, 23, 22, 25, 10, 9, 15, 29 Your 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? Options A) f and g should both be onto functions. B) f should be onto but g need not be onto C) g should be onto but f need not be onto D) both f and g need not be onto Your Answer (Not Answered) Correct Answer B

You might also like