In the name of ALLAH, the most beneficient, the most merciful

Data Structures (CS301)

Subjective, Short Questions from Past Papers

 

Subjective Questions

Question

(Mid Term, Marks = 2, Lesson No. )

How can we calculate the height of tree?

Answer:

Question

(Mid Term, Marks = 2, Lesson No. )

What is meant by traversing of binary tree?

Answer:

Question

(Mid Term, Marks = 3, Lesson No. )

Explain the logic of the following function.
int& Fun(int& y)
{
y = y + 100;
return y;
}

Answer:

Question

(Mid Term, Marks = 3, Lesson No. )

Consider the following code snippet,

class BST_node
{
private:
char ch;
BST_node *BST_left;
BST_node *BST_right;
};
BST_node *bst, bt;

Correct the following statements,

bst BST_left = NULL;
bst BST_right = NULL;
bt->ch = 'A';

Answer:

Question

(Mid Term, Marks = 5, Lesson No. )

Perform the Preorder and Inorder traversal on the given below and show the result in both cases (you have to perform the traversal manually not using any programming language)

Answer:

Question

(Mid Term, Marks = 2, Lesson No. )

How can the dangling reference problem be avoided?

Answer:

Question

(Mid Term, Marks = 2, Lesson No. )

What is "level" in binary tree?

Answer:

Question

(Mid Term, Marks = 3, Lesson No. )

Draw a BST that is as tall as possible and contains the values '2', '6', '5', '4', '7', '9', '8'.

Answer:

Question

(Mid Term, Marks = 3, Lesson No. )

Define the following terms

1) Rference variables
2) Dangling variable
3) Const keyword

Answer:

Question

(Mid Term, Marks = 5, Lesson No. )

Show the result of inserting the values 35, 19, 41, 39, 37, 28, 31, 14 into an empty AVL Tree.
You have to show only the complete AVL tree, steps are not required.

Answer:

Question

(Mid Term, Marks = 5, Lesson No. )

Write down the algorithm (Steps) for level order traversing of a binary tree.

Answer:

Question

(Mid Term, Marks = 2, Lesson No. )

In which of the traversal methods, recursion can not be applied?

Answer:

Question

(Mid Term, Marks = 5, Lesson No. )

Show the result of inserting the values 10, 80, 12, 70, 90, 60, 13, 16, 95, 97 into an empty AVL Tree.
You have to show only the complete AVL tree, steps are not required.

Answer: