• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Gate IT 2008

Question 71

A binary tree with n > 1 nodes has n1, n2 and n3 nodes of degree one, two and three respectively. The degree of a node is defined as the number of its neighbors.
Starting with the above tree, while there remains a node v of degree two in the tree, add an edge between the two neighbors of v and then remove v from the tree. How many edges will remain at the end of the process?
  • 2 * n1 - 3
  • n2 + 2 * n1 - 2
  • n3 - n2
  • n2 + n1 - 2

Question 72

A CFG G is given with the following productions where S is the start symbol, A is a non-terminal and a and b are terminals.
S→aS∣A
A→aAb∣bAa∣ϵ
Which of the following strings is generated by the grammar above?
  • aabbaba
  • aabaaba
  • abababb
  • aabbaab

Question 73

A CFG G is given with the following productions where S is the start symbol, A is a non-terminal and a and b are terminals.
S→aS∣A
A→aAb∣bAa∣ϵ
For the correct answer in Q75, how many steps are required to derive the string and how many parse trees are there?
  • 6 and 1
  • 6 and 2
  • 7 and 2
  • 4 and 2

Question 74

Consider a computer with a 4-ways set-associative mapped cache of the following characteristics: a total of 1 MB of main memory, a word size of 1 byte, a block size of 128 words and a cache size of 8 KB. The number of bits in the TAG, SET and WORD fields, respectively are:
  • 7, 6, 7
  • 8, 5, 7
  • 8, 6, 6
  • 9, 4, 7

Question 75

Consider a computer with a 4-ways set-associative mapped cache of the following character­istics: a total of 1 MB of main memory, a word size of 1 byte, a block size of 128 words and a cache size of 8 KB. While accessing the memory location 0C795H by the CPU, the contents of the TAG field of the corresponding cache line is
  • 000011000
  • 110001111
  • 00011000
  • 110010101

Question 76

Consider the code fragment written in JAVA below : 

Java
void f (int n)
{ 
  if (n <=1)  {
   System.out.print(n);
  }
  else {
   f (n/2);
   System.out.print(n%2);
  }
}

What does f(173) print?

  • 010110101

  • 010101101

  • 10110101

  • 10101101

Question 77

Consider the code fragment written in C below : 

C
void f (int n)
{
    if (n <= 1)  {
        printf (\"%d\", n);
    }
    else {
        f (n/2);
        printf (\"%d\", n%2);
    }
}
 

Which of the following implementations will produce the same output for f(173) as the above code? P1 

C
void f (int n)
{
    if (n/2)  {
        f(n/2);
    }
    printf (\"%d\", n%2);
}
 

P2 

C
void f (int n)
{
    if (n <=1)  {
        printf (\"%d\", n);
    }
    else {
        printf (\"%d\", n%2);
        f (n/2);
    }
}
  • Both P1 and P2

  • P2 only

  • P1 only

  • Neither P1 nor P2

Question 78

Host X has IP address 192.168.1.97 and is connected through two routers R1 and R2 to an­other host Y with IP address 192.168.1.80. Router R1 has IP addresses 192.168.1.135 and 192.168.1.110. R2 has IP addresses 192.168.1.67 and 192.168.1.155. The netmask used in the network is 255.255.255.224. 


Given the information above, how many distinct subnets are guaranteed to already exist in the network?
 

  • 6
     

  • 3
     

  • 2
     

  • 1
     

Question 79

Host X has IP address 192.168.1.97 and is connected through two routers R1 and R2 to an­other host Y with IP address 192.168.1.80. Router R1 has IP addresses 192.168.1.135 and 192.168.1.110. R2 has IP addresses 192.168.1.67 and 192.168.1.155. The netmask used in the network is 255.255.255.224.
Which IP address should X configure its gateway as?
  • 192.168.1.67
  • 192.168.1.110
  • 192.168.1.135
  • 192.168.1.155

Question 80

Which of the following is TRUE?

  • The cost of searching an AVL tree is θ (log n) but that of a binary search tree is O(n)

  • The cost of searching an AVL tree is θ (log n) but that of a complete binary tree is θ (n log n)

  • The cost of searching a binary search tree is O (log n ) but that of an AVL tree is θ(n)

  • The cost of searching an AVL tree is θ (n log n) but that of a binary search tree is O(n)

There are 82 questions to complete.

Last Updated :
Take a part in the ongoing discussion