Languages [3i Infotech Placement]: Sample Questions 425 - 427 of 546

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

Question 425

Edit

Describe in Detail

Essay▾

Find the output of the following program

  1. int ⚹p, ⚹q;
  2. p =(int ⚹) 1000;
  3. q =(int ⚹) 2000;
  4. printf ( “%d” (q-p));

Explanation

Table of Find the Output the Program
int ⚹ p, ⚹ q;Declare pointer p and pointer q
p = (int ⚹) 1000;p is assigned value of after casing to integer pointer
q = (int ⚹) 2000;q is assigned value of after casing to integer pointer
printf ( “% d” (q-p) ) ;Subtract

Output

Question 426

Edit

Describe in Detail

Essay▾

What do you meant by active and passive objects?

Explanation

  • Active Objects:-
    • Active objects instigates a threaded interaction responsible for handling control to other objects that is it is a client.
    • For objects implemented as parallel processes the internal object state may be changed by the object itself and not simply by external calls.
  • Passive Objects:-
    • Passive objects passively wait for the message to be processed waiting for request from another object for its services, that is it is a server.
    • The object is implemented as a parallel process with entry points corresponding to object operations. If no calls are made to it, the object suspends itself.

Question 427

Languages
Edit

Describe in Detail

Essay▾

What are the traverses in binary tree?

Explanation

In-Order Traversal:

  • The left subtree is visited first, then the root and later the right sub-tree.
  • Outputs sorted key values in ascending order.

Algorithm

  • Recursively traverses left subtree.
  • Visit root node.
  • Recursively traverse right subtree.
Dfine In-Order Algorithm

Pre-order Traversal:

  • Root node is visited first, then the left subtree and finally the right subtree.

Algorithm:

  • Visit root node.
  • Recursively traverse left subtree.
  • Recursively traverse right subtree.
Define Pre-Order Traversal

Post-order Traversal

  • The root node is visited last, hence the name.
  • First we traverse the left subtree, then the right subtree and finally the root node.

Algorithm:

  • Recursively traverse left subtree.
  • Recursively traverse right subtree.
  • Visit root node.
Define Post-Order Traversal

Developed by: