|
Data Structures Interview Questions and Answers
How do you assign an address
to an element of a pointer array ?
We can assign a memory address to an element of a pointer array by using the
address operator, which is the ampersand (&), in an assignment statement such as
ptemployee[0] = &projects[2];
Run Time Memory Allocation
is known as ?
Allocating memory at runtime is called a dynamically allocating memory. In this,
you dynamically allocate memory by using the new operator when declaring the
array, for example : int grades[] = new int[10];
What method is used to place
a value onto the top of a stack?
push() method, Push is the direction that data is being added to the stack.
push() member method places a value onto the top of a stack.
What method removes the
value from the top of a stack?
The pop() member method removes the value from the top of a stack, which is then
returned by the pop() member method to the statement that calls the pop() member
method.
What does isEmpty() member
method determines?
isEmpty() checks if the stack has at least one element. This method is called by
Pop() before retrieving and returning the top element.
What is a queue ?
A Queue is a sequential organization of data. A queue is a first in first out
type of data structure. An element is inserted at the last position and an
element is always taken out from the first position.
What is the relationship
between a queue and its underlying array?
Data stored in a queue is actually stored in an array. Two indexes, front and
end will be used to identify the start and end of the queue.
When an element is removed front will be incremented by 1. In case it reaches
past the last index available it will be reset to 0. Then it will be checked
with end. If it is greater than end queue is empty.
When an element is added end will be incremented by 1. In case it reaches past
the last index available it will be reset to 0. After incrementing it will be
checked with front. If they are equal queue is full.
Which process places data at
the back of the queue?
Enqueue is the process that places data at the back of the queue.
Page Numbers :
1
2
3
4
5
6
7
Have a Question ?
post your questions here. It
will be answered as soon as possible.
Check
Structs Interview
Questions for more Structs Interview Questions with answers
Check
Object Oriented Interview
Questions for more Object Oriented Interview Questions with answers
|