Redpine Infotech Placement: Sample Questions 2 - 3 of 19

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

Question 2

Edit

Describe in Detail

Essay▾

Explain two problems related to in order and post order traversal.

Explanation

Given Order Travel, Root, Left Subtree and Right Subtree

Inorder Traversal

  • Algorithm:
    • Traverse the left sub tree, i.e.. . , call inorder (left-sub tree)
    • Visit the root
    • Traverse the right sub tree, i.e.. . , call inorder (right-sub tree)
  • Uses of Inorder
    • Binary search trees, inorder traversal provides nodes in non-decreasing order.
    • To get nodes of BST in non-increasing order, a variation of inorder traversal where inorder traversal is reversed can be used.

    Ex

In Order Travel (Left, Root, Right)
  • In order travel (left, root, right) : 4, 2,5, 1,3

Post Order

  • Algorithm:
    • Traverse the left sub tree, i.e.. . , call Postorder (left-sub tree)
    • Traverse the right sub tree, i.e.. . , call Postorder (right-sub tree)
    • Visit the root.
  • Use of Postorder:
    • Used to delete the tree.
    • To get the postfix expression of expression tree.

Ex

Postorder (Left, Right, Root)

Postorder (Left, Right, Root) : 4 5 2 3 1

Question 3

Question

MCQ▾

What are the different types of IPC mechanisms?

Choices

Choice (4)

a.

Indirect communication (mailbox)

b.

Synchronous/Asynchronous communication (Naming.) .

c.

Context switching

d.

Direct communication (messages)

Answer

d.

Explanation

  • IPC mechanisms are a set of programming interfaces that allow a programmer to coordinate activities among different program processes or threads.
  • Threads can run concurrently in an operating system.
  • For example, they allow a program to handle many user requests at the same time each with different thread.
  • Direct communication is an IPC mechanism.
  • Each process that wants to communicate must name the recipient or sender of the communication.
  • Send and receive primitives are defined as bellow:
    • Send (P, message) - send a message to process P.
    • Receive (Q, message) - Receive a message from process Q.

Developed by: