TRUE/FALSE Quiz Questions with Answers in Data Structures and Algorithms, Data Structures interview questions
Data Structures and Algorithms TRUE / FALSE Questions – Set 04
1. The time complexity of adding 5 to each element of a array of N numbers is O(N).
(a)
TRUE (b)
FALSE
View Answer
Answer:
TRUE
The
time complexity will be O(N) because each element will be accessed only once
to add number 5.

2. Let us suppose that there is a variable declaration int x = 50, *ptr. Then, the statement *ptr = &x is a valid statement in main() function.
(a)
TRUE (b)
FALSE
View Answer
Answer:
FALSE
*ptr
is a pointer, &x
is the address of x.
The
correct way to assign the address to the pointer variable is, ptr = &x.

3. Minimum and maximum height of a binary heap with N keys will be ⌊ log_{2}N ⌋.
(a)
TRUE (b)
FALSE
View Answer
Answer:
TRUE
The
height of binary heap with N keys will be floor(log_{2}N).
Binary heapA binary heap is a heap data structure that takes the form of a binary tree. They are useful in the implementation of priority queues. The properties of binary heap are;

4. Inserting an element to the beginning of an array (that is A[0] element) is more difficult than inserting an element to the beginning of a linked list.
(a)
TRUE (b)
FALSE
View Answer
Answer:
TRUE
Inserting
an element at the beginning of an array is easy only if array is empty. Otherwise,
we need to move all the other elements that are stored in that array to
create space. Hence, it is difficult to insert an element at the beginning of
an array.
To insert an element at the beginning of a linked list is comparatively easy. We need to create a node and link the node to the head node. 
5. The largest value in a binary search tree is always stored at the root of the tree.
(a)
TRUE (b)
FALSE
View Answer
Answer:
FALSE
An
important reason that BSTs are widely used is that they allow us to keep the
keys in order.
A
binary search tree is a
binary tree with the following properties:

***********
No comments:
Post a Comment