Professional Documents
Culture Documents
هياكل البيانات DS data structure c++ ميد تيرم
هياكل البيانات DS data structure c++ ميد تيرم
منير: األستاذ
1 السؤال
2.1) After execution of the following statements, what value does the variable q contain? int *p,
*q; p = new int; q = p; delete p; p = NULL;
the address of p
2 السؤال
//--------------------------------------------
N->next = NULL;
N->info = data;
if (rear == NULL)
front=rear=N;
else
rear->next = N;
rear = ____;
rear->next
next
temp
Raer-<next
True
4 السؤال
array
queue
stack
linked-list
5 السؤال
first-in, last-out,
6 السؤال
ab{cde{fg}hi{jkl}
ab{cde{fghi}j}kl}
{abc{de}{fg}hij}kl
{ab{cde{fgh}ijkl}
1.2) Which of the following operations is performed more efficiently by doubly linked list than
by linear linked list?
7 السؤال
1.2) The item that is removed first from a stack is called the __ of the stack.
A. front
B. base
C. prime
D. top
8 السؤال
1.2) The __ operation of the stack adds an item to the top of the stack.
createStack
push
pop
getTop
9 السؤال
10 السؤال
stack
queue
tree
3 السؤال
data structure
module
method
11 السؤال
1.2) Which of the following code fragments deletes the item at the front of a queue
represented by a circular array?
4 السؤال
1.2) A linked list contains components, called __, which are linked to one another.
nodes
arrays
vectors
references
5 السؤال
1.2) The members of a node structure can be accessed with the __ operator.
[]
&
->
At
2.1) Imagine you have an empty stack of integers, S, with 5 elements size, and two integer
numbers x and y.
Stack S;
int x=2,y=8;
S.push(y-x);
S.push(y+x);
x= y+S.pop();
while(!S.full())
S.push(++x);
if (S.pop()>7)
y= S.pop();
23
21
24
25
13 السؤال
enqueue
dequeue
None
getFront
14 السؤال
Easier computations
15 السؤال
enqueue
isEmpty
pop
getFront
8 السؤال
2.1) If the elements “A”, “B”, “C” and “D” are placed in a queue and are removed one at a time,
in what order will they be removed?
ABCD
DCBA
ACBD
ABDC
24
12
44
32
10 السؤال
void push(int x)
t->data=x;
t->next=NULL;
if (top == NULL)
top=t;
else {
t->next= top;
_______;
top=top
top = top->next
top = t
top = temp
18 السؤال
//------------------------------------------------------------------------
char pop()
top=top-> _______;
free(top1);
return ch;
top1
top
stack
next
11 لسؤال
//-------------------------------------------
New->item=info;
New->next=cr;
cr=____ ;
return *cr;
cr
New
next
cr->next
13 السؤال
isEmpty
enqueue
dequeue
getFront
21 السؤال
1.2) The insertion operation of the linked list can insert new items ___
22 السؤال
1.2) To delete a node N from a linear linked list, you will need to __.
set the pointer next in the node that precedes N to point to the node that follows N
set the pointer next in the node that follows N to point to the node that precedes N
18 السؤال
1.2) Which of the following C++ statements insert a new node, pointed to by newPtr, into an
empty queue represented by a linear linked list?
newPtr->next = backPtr;
19 السؤال
2.1) Which of the following statements deletes the first node of a linear linked list that has 10
nodes?
head->next = cur->next;
head = head->next;
prev->next = cur->next;
head = NULL;
23 السؤال
has a next pointer that points to the first node of the list
cannot store any data
24 السؤال
1.2) The insertion operation of the linked list can insert new items __.
none
22 السؤال
isEmpty
createStack
destroyStack
push
2.1) Imagine you have an empty stack of integers, S, with 5 elements size, and two integer
numbers x and y.
Stack S;
int x=2,y=8;
S.push(y-x);
S.push(y+x);
x= y+S.pop();
while(!S.full())
S.push(x--);
if (S.pop()>7)
y= S.pop();
16
15
18
17
24 السؤال
1.2) Which of the following statement is invalid with respect to balancing symbols?
{(A+B) + [C+D]}
[{A+B}-{C-[D+E]}]
[(A+B) + (C-D)]
((A+B) + (C+D)
25 السؤال
1.2) The __ operation of the stack retrieves the top of the stack, but does not change the stack.
createStack
push
pop
getTop