3i Infotech Papers: Sample Questions 1154 - 1156 of 1245

Examrace Placement Series prepares you for the toughest placement exams to top companies.

Question number: 1154

» Languages » Java

Essay Question▾

Describe in Detail

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

Dfine In-Order Algorithm

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

Define Pre-Order Traversal

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

Define Post-Order Traversal

Define Post-order Traversal

Question number: 1155

» Languages » C & C Plus Plus

Short Answer Question▾

Write in Short

What is a NULL Pointer? Whether it is same as an uninitialized pointer?

Explanation

  • Null pointer does not point to anything in the memory.

  • Null is defined as (void*) 0.

  • Uninitialized pointer on the other hand is pointing to memory location but the pointer values are not assigned.

Question number: 1156

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

Which bit wise operator is suitable for turning on a particular bit in a number?

Explanation

Understanding of XOR operator

Understanding of XOR Operator

Understanding of XOR operator

  • Bitwise OR operator sets a one in each bit position where one of its operands has a 1 ‘bit’. That is, output of bitwise OR is 1 if at least one of the two operands has bit 1 in corresponding position.

  • To set a bit in the position, just OR it with the operand with the bit set.

  • Bitwise OR operator is denoted by ‘| ’

Bitwise OR operation of 12 and 25