3i Infotech Placement: Sample Questions 1223 - 1225 of 1245

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 1223

Edit

Describe in Detail

Essay▾
  1. main ()
  2. {
  3.     printf ( “%d” out);
  4. }
  5. intout =100;

Explanation

Compiler error: undefined symbol out in function main.

In a program

Table Showing the Program
  1. main ()
  2. {
  3.     printf ( “%d” out);
  4. }
  5. intout =100;
Print the value of out

The rule is that a variable is available for use from the point of declaration.

Even though is a global variable, it is not available for main.

Hence an error.

Question 1224

Edit

Describe in Detail

Essay▾

Which methods in the Object class are declared as final?

Explanation

Following methods are Final:

  • GetClass () :

    Returns the runtime class of an object.

  • Notify () :

    Wakes up a single thread that is waiting on this object՚s monitor.

  • NotifyAll () :

    Wakes up all threads that are waiting on this object՚s monitor.

  • wait () :

    Causes current thread to wait until another thread invokes the notify () method or the notifyAll () method for this object.

Question 1225

Edit

Describe in Detail

Essay▾

Draw the balanced B-tree of order 3 created by inserting the following data arriving in sequence 92 24 6 7 11 8 22 4 5 16 19 20 78

Explanation

For creating balanced Binary Tree read the first array element, create a new node with data and put it in queue. Do the below operations until the queue is empty.

  • Dequeue the data (Node) from queue and populate its left and Right child with data from array.
  • put the Left and Right child created in step 1 in Queue.

    For solving the problem, sort the array first now on this sorted array:

  • Get the middle element of the array and make it as Root of Binary Search Tree:
  • After getting the middle of array, it is divided into 2 parts, left half and right half.
    • Middle element of Left half will become Left child of Root Node (created in step 1)
    • Middle element of Right half will become Right child of Root Node (created in step 1)
  • Do above step recursively for left half and right half.
    • Get the middle of left half and make it left child of the root created in step 1.
    • Get the middle of right half and make it right child of the root created in step 1.
The Balanced B-Tree of Order 3
The Balanced Binary Tree

Developed by: