TCS Papers: Sample Questions 449 - 451 of 502

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

Question number: 449

» Languages » C & C Plus Plus

Short Answer Question▾

Write in Short

Write the equivalent pointer expression for referring the same element a [i] [j] [k] [l]?


  1. a[i] == *(a+i)
  2. a[i][j] == *(*(a+i)+j)
  3. a[i][j][k] == *(*(*(a+i)+j)+k)
  4. a[i][j][k][l] == *(*(*(*(a+i)+j)+k)+l)

Question number: 450

» Languages » C & C Plus Plus



Which of the following statement is correct?


Choice (4) Response


A reference is stored on stack.


A reference is stored on heap.


A reference is stored in a queue.


A reference is stored in a binary tree.




  • References are stored on stack because references just refer to any local variable- which is allocated on the stack.

  • So indirectly reference is stored in stack.

  • Example:

  1. #include<iostream>
  2. using namespace std;
  3. class abc
  4. {
  5.     int a = 0;
  6.     int &b = a;
  7.     int &c = b;
  8. };
  9. int main()
  10. {
  11.     cout<<"size is "<<sizeof(class abc)<<endl;
  12. }
  • Output:

    Size is 24

  • So, it gets space in stack

Question number: 451

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What are binary trees?


  • Binary trees extended the concept of linked lists.

  • A binary tree has two pointers, a left one and a right one. Each side can further branch into two additional nodes with each node having two pointers as well.

  • A “binary search tree” (BST) or “ordered binary tree” is a type of binary tree where the nodes are arranged in order: for each node, all elements in left subtree are less-or-equal to the node ( < =), and all the elements in right subtree are greater than the node ( > ).

Define the binary tree example

Define the Binary Tree Example

Given the image is define the binary tree example