wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Segundo Parcial EDL

Total questions: 93

Worksheet time: 2hrs 32mins

Name
Class
Date
1.

Only top element can be accessed in stack

a)

TRUE

b)

FALSE

2.

Stacks have LIFO ordering

a)

TRUE

b)

FALSE

3.

The postfix form of the expression (A+ B)*(C*D- E)*F / G is?

a)

AB + CDE * - * F *G /

b)

AB+ CD*E - FG /**

c)

AB + CD* E - F **G /

d)

AB + CD* E - *F *G /

4.

LIFO stands for

a)

List of Outputs

b)

Last in First Out

c)

First in Last Out

d)

None of them

5.

Act of adding values into a stack is called

a)

Popping

b)

Polling

c)

Pushing

d)

None

6.

The postfix form of A*B+C/D is?

a)

*AB/CD+

b)

AB*CD/+

c)

A*BC+/D

d)

ABCD+/*

7.

Which of the following statement(s) about stack data structure is/are NOT correct?

a)

Stack data structure can be implemented using linked list

b)

New node can only be added at the top of the stack

c)

Stack is the FIFO data structure

d)

The last node at the bottom of the stack has a NULL link

8.

If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a time, in what order will they be removed?

a)

ABCD

b)

DCBA

c)

DCAB

d)

ABDC

9.

Which of the following application generally use a stack?

a)

Parenthesis balancing program

b)

Syntax analyzer in compiler

c)

Keeping track of local variables at run time

d)

All of the above

10.

Consider the following operation performed on a stack of size 5.


Push(1);

Pop();

Push(2);

Push(3);

Pop();

Push(4);

Pop();

Pop();

Push(5);


After the completion of all operation, the no of element present on stack are

a)

1

b)

2

c)

3

d)

4

11.

In the stack, If user try to remove element from the empty stack then it called as ___________.

a)

Overflow of Stack

b)

Empty Collection

c)

Underflow of Stack

d)

Garbage Collection

12.

Process of Removing element from the stack is called as __________.

a)

Pop

b)

Push

c)

Create

d)

Postfix

13.

User push 1 element in the stack having already five elements and having stack size as 5 then stack becomes ___________.

a)

Overflow

b)

User Flow

c)

Underflow

d)

Crash

14.

In order to keep track of current topmost element of the stack we need to maintain one variable.

a)

Yes

b)

No

c)

Both Yes and No

d)

None of the answer

15.

Select a real life situation implement stack

a)

All of the answers

b)

The cars a garage the first car in will be the last car out of the garage

c)

The batteries in a flashlight

d)

The person wear bangles

16.
The elements are removal from a stack in .......... order.
a)
Reverse
b)
Hierarchical
c)
Alternative
d)
 Sequential
17.

What is the value of the postfix expression 6 3 2 4 + – *

a)

1

b)

40

c)

74

d)

-18

18.

Which one of the following is an application of Stack Data Structure?

a)

Managing function calls

b)

The stock span problem

c)

Arithmetic expression evaluation

d)

All of the above

19.

List of data in which element can be inserted and removed at the same end is called as __________.

a)

array

b)

stack

c)

linked list

d)

queue

20.

Which of them is an abstract data structure (ADT)?

a)

Stacks

b)

Functions

c)

Queues

d)

Both A and C

21.

If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in what order will they be removed?

a)

ABCD

b)

DCBA

c)

DCAB

d)

ABDC

22.

a QUEUE in a computer acts just like people queuing for a bus - the first person in queue is going to be the first to get on the bus.

a)

True

b)

False

23.

A Queue uses a front and rear pointer?

a)

True

b)

False

24.
Which of these data structures is FIFO
a)
Stack
b)
Queue
c)
Binary Tree
d)
Double linked list
25.

The type of expression in which operator succeeds its operands is?

a)

a) Infix Expression

b)

b) Prefix Expression

c)

c) Postfix Expression

d)

d) Both Prefix and Postfix Expressions

26.

What is the infix equivalent for the following postfix expression?


3 5 6 + *

a)

5 + 6 * 3

b)

5 + (3 * 6)

c)

(5 + 6) * 3

d)

5 (+ 6 * 3)

27.

A FIFO structure implemented as a ring where the front and rear pointers can wrap around the end of the start of the array.

a)

Linear Queue

b)

Circular Queue

c)

Priority Queue

28.
What kind of Data structure would you expect to find utilised to store operations in a CPU?
a)
Stack
b)
Queue
c)
List
d)
Tree
29.

In linked list implementation of a queue, from where is the item deleted?

a)

At the head of link list

b)

At the centre position in the link list

c)

At the tail of the link list

d)

None of the mentioned

30.

In a circular queue, how do you increment the rear end of the queue?

a)

rear++

b)

(rear+1) % Number of Item

c)

(rear % Number of Item)+1

d)

rear–

31.

What is the term for inserting into a full queue known as?

a)

overflow

b)

underflow

c)

null pointer exception

d)

all of the mentioned

32.

Let the following circular queue can accommodate maximum six elements with the following data


front = 2 rear = 4

queue = _______; L, M, N, ___, ___


What will happen after ADD O operation takes place?

a)

front = 2 rear = 5

queue = ______; L, M, N, O, ___

b)

front = 3 rear = 5

queue = L, M, N, O, ___

c)

front = 3 rear = 4

queue = ______; L, M, N, O, ___

d)

front = 2 rear = 4

queue = L, M, N, O, ___

33.

A circular queue is implemented using an array of size 10. The array index starts with 0, front is 6, and rear is 9. The insertion of next element takes place at the array index.

a)

0

b)

7

c)

9

d)

10

34.

What is the reason for using a "circular queue" instead of a regular one?

a)

running time of enqueue() is improved

b)

reuse empty spaces

c)

you can traverse all the elements more efficiently

d)

none of the above

35.

In Queue Insertion & Deletion take place at ________________.

a)

same end

b)

first end

c)

different end

d)

last end

36.

One difference between a queue and a stack is:

a)

Queues require dynamic memory, but stacks do not

b)

Stacks require dynamic memory, but queues do not.

c)

Queues use two ends of the structure; stacks use only one.

d)

Stacks use two ends of the structure, queues use only one.

37.

If the numbers 5, 10, 3, 42 are enqueued onto a queue in that order, what does dequeue return?

a)

5

b)

10

c)

3

d)

42

38.

Queue can be implemented using a list?

a)

True

b)

False

39.

A queue of characters currently contained a,b,c,d. What would be the contents of queue after the following operationDELETE, ADD W, ADD X, DELETE, ADD Y.

a)

A,B,C,W,Y

b)

A,B,C,D,W

c)

C,D,W,X,Y

d)

W,Y,X,C,D

40.

If front=rear ,then the queue is?

a)

full

b)

undeflow

c)

overflow

d)

empty

41.

Which the following is not true about queue?

a)

An ordered collection of items where the addition of new items happens at one end

b)

The simplest example of a queue is the typical line that we all participate in from time to time.

c)

As an element enters the queue it starts at the rear and makes its way toward the front, waiting until that time when it is the next element to be removed.

d)

An ordered collection of items where the addition of new items and the removal of existing items always takes place at the same end

42.

Suppose you have the following series of queue operations.

q = Queue();

q.enqueue('hello');

q.enqueue('dog');

q.enqueue(3);

q.dequeue();

What items are left on the queue?

a)

'hello', 'dog'

b)

'dog', 3

c)

'hello', 3

d)

'hello', 'dog', 3

43.

Suppose you have the following series of queue operations.

q = Queue();

q.enqueue('hello');

q.enqueue('dog');

q.dequeue();

q.enqueue('3');

q.dequeue();

What items are the output?

a)

hellodog

b)

hello

c)

doghello

d)

hellodog3

e)

3

44.

Suppose you have the following series of queue operations.

q = Queue();

q.enqueue(1);

q.enqueue(10);

q.enqueue(100);

q.dequeue();

q.dequeue();

What items are the output?

a)

10010

b)

101

c)

110

d)

10010

45.

A Queue can only store 6 data items. The Queue is sent 4 data items: Bert, Cynthia, Cedric and Albert. Where does the "Front" pointer point?

a)

Bert

b)

Cynthia

c)

Cedric

d)

Albert

46.

In a Queue Data Structure...

a)

New elements may only be added to the end of the queue

b)

Elements may only be retrieved from the front of the queue.

c)

Elements may only be retrieved from the end of the queue.

d)

New elements may only be added to the front of the queue

47.

Select ALL the situations that a Queue data structure would be used?

a)

Printer in a room full of computers

b)

Characters typed on a keyboard

c)

Back Button

d)

Undo Button

48.

Which is the correct operation for:

"Add a item to the rear of the queue."

a)

enQueue(item)

b)

Append.Queue(item)

c)

enQueue()

d)

AddItem(EnQueue())

49.

Which is the correct operation for:

"Remove the rear item from the queue and return it"

a)

dQueue()

b)

de.Queue(Item)

c)

deQueue()

d)

item.remove()

e)

Cant be performed on a Queue Data Structure.

50.

Which is the correct operation for:

"Add a item to the front of the queue."

a)

enQueue(item)

b)

Append.Queue(item)

c)

enQueue()

d)

AddItem(EnQueue())

e)

Cant be performed on a Queue.

51.

Select operations that can be performed on a Queue Data Structure...

a)

isEmpty()

b)

pop()

c)

push()

d)

isFull()

e)

Append(Item)

52.

Where would pointers be pointing if...

  1. Eli leaves the Queue
  2. Adam joins the Queue
a)

front = 0 rear = 3

b)

front = 1 rear = 4

c)

front = 2 rear = 3

d)

front = 0 rear = 4

e)

front = 0 rear = 4

53.

Where would pointers be pointing if...

  1. Eli leaves the Queue.
  2. Hanna joins the Queue.
  3. Adam joins the Queue.
  4. Jason leaves the Queue.
a)

front = 0 rear = 5

b)

front = 1 rear = 4

c)

front = 2 rear = 4

d)

front = 0 rear = 4

e)

front = 2 rear = 5

54.

What would happen if...

deQueue()

enQueue(Hanna)

enQueue(Steve)

enQueue(Jack)

a)

front = 1 rear = 0

*and Steve would be unable to be added to position 0.

b)

front = 1 rear = 5

*and Jack would be unable to be added to position 0

c)

front = 0 rear = 5

d)

front = 0 rear = 4

e)

front = 1 rear = 4

55.
What is returned as a result of the call mystery(4,6)?
a)
2
b)
3
c)
4
d)
1
56.
Which of the following is the best definition of a recursive method?
a)
A method that iterates itself exactly 5 times.
b)
A method that invokes itself by name within the method.
c)
A method that will never iterate infinitely.
d)
A method that cannot be called more than once.
57.
What is the returned value of recMethod(5)?
a)
68
b)
70
c)
75
d)
82
58.
What is printed as a result of the call stringMaker("COMPSCI")?
a)
COMPSCI
COMPSC
COMPS
COMP
COM
CO
C
b)
COMPSCI
OMPSCI
MPSCI
PSCI
SCI
CI
I
c)
CO
COM
COMP
COMPS
COMPSC
COMPSCI
d)
C
CO
COM
COMP
COMPS
COMPSC
COMPSCI
59.
Will recursion(5) iterate infinitely? 
a)
Yes
b)
No
60.
What value is returned as a result of the call mysterious(x)?
a)
x * (x+1)
b)
2x
c)
2(x-1)
d)
x+1
61.
What is the returned value of digits(-24684)?
a)
20
b)
18
c)
24
d)
23
62.
Which expression represents the result of calling recurs(11,4)? 
a)
x + y
b)
x * y
c)
xy-2
d)
yx+2
63.
Will recursive(50) iterate infinitely?
a)
Yes
b)
No
64.
What is the value of concatenation("Recursion")?
a)
Rcrion
b)
 Rcrio
c)
Rron
d)
Recson
65.

Recursion is:

a)

is a computer programming technique involving the use of a procedure, subroutine, function, or algorithm that calls itself in a step having a termination condition.

b)

is a computer programming technique involving the use of a procedure, subroutine, function, or algorithm that calls other function in a step.

c)

is a computer programming technique involving the use of a procedure, subroutine, function, or algorithm that calls itself in a step having no termination condition.

d)

None of the above

66.

In recursion a base case is:

a)

The most simplistic code of a program

b)

is a non-recursive function

c)

Is a problem that we know the answer to

d)

What stops the recursion from continuing on forever

67.

In recursion the sequence of smaller problems must eventually converge on?.

a)

an even smaller problem

b)

sorting algorithm

c)

the base case

d)

the main function of your program

68.

Which one is not a reason to use recursion?.

a)

One of the sub-tasks to be solved is nothing more than a simpler version of the same problem you are trying to solve in first place

b)

Code is generally shorter and easier to write than iterative code.

c)

Recursion is most useful for tasks that can be defined in terms of similar sub-tasks

d)

Low computational complexity

69.

Recursion is very efficient

a)

True

b)

False

70.

There is not overhead in the use of recursion

a)

True

b)

False

71.

The data structure used to implement recursive function calls _____________

a)

Stack

b)

Linked list

c)

Queue

d)

Array

72.
Which type of sort algorithm is this?
a)
Bubble
b)
Merge
c)
Insertion
73.
Speed of sort depends on how unordered the list is.
a)
Bubble sort
b)
Insertion sort
c)
Bubble sort and insertion sort
74.
Does not cope well with very large lists.
a)
Bubble sort
b)
Insertion sort
c)
Bubble sort and insertion sort
75.
Doesn’t use much memory.
a)
Bubble sort
b)
Insertion sort
c)
Bubble sort and insertion sort
76.

We are sorting the following list in ascending order:


5 4 2 9 3 1 8


What does the list look like after ONE pass of the selection sort algorithm?

a)

1 2 4 3 8 5 9

b)

1 4 2 9 3 5 8

c)

1 5 4 2 9 3 8

d)

4 5 2 9 3 1 8

77.

The Selection Sort algorithm repeatedly finds the smallest value in the list, then swaps it into its sorted position.

a)

True

b)

False

78.

Why might a sorting algorithm be needed before a search?

a)

Data is less when sorted

b)

Data cannot be searched if it not sorted

c)

Data can be retrieved faster and easier when sorted

d)

Data must always be sorted before it is searched

79.

What sorting algorithm is this?

a)

Merge Sort

b)

Heap Sort

c)

Quicksort

d)

Bubble Sort

80.

What sorting algorithm is this?

a)

Insertion Sort

b)

Sort of lame

c)

Selection Sort

d)

Bubble Sort

81.

What sorting algorithm is this?

a)

Insertion Sort

b)

Selection Sort

c)

Quicksort

d)

Bubble Sort

82.

Merge sort and Quicksort are [blank] sorting algorithms. (Hint: Three words)

(a)  

83.

Which sorting algorithm is this?

a)

Quicksort

b)

Divide Sort

c)

Merge Sort

d)

Match Sort

84.

Quicksort uses a [blank] to help partition the array into two.

(a)  

85.

What sorting algorithm is this?

a)

Bubble Sort

b)

Insertion Sort

c)

Selection Sort

d)

None of the above

86.

Which sorting algorithm is efficient when it comes to using less space?

a)

Merge Sort

b)

Quicksort

87.

In which of the following cases, binary search algorithm is used?​

a)

To search an element in an unordered list.​

b)

To search an element in a list of few elements.

c)

To search an element in any ordered list with large number of elements.​

88.

How does a binary search algorithm works?​

a)

Dividing the list into halves until the item is matched with one in the list.​

b)

Starts with the first element and checks the next element consecutively until a match is found.

c)

​ None of the above​

89.

An array with 32 elements is input to a binary search algorithm. How many maximum number of comparisons are performed?​

a)

32

b)

16

c)

8

d)

5

90.

An array with 32 elements is input to a linear search algorithm. How many maximum number of comparisons are performed?​

a)

32

b)

16

c)

8

d)

5

91.

Under which of the following conditions, binary search algorithm terminates?​

a)

Item_found=true​

b)

lower_bound <= upper_bound​

c)

lower_bound > upper_bound

d)

​ A or C

92.

What is the disadvantage of binary search algorithm?​

a)

It takes longer time when compared to linear search algorithm​

b)

It works only on sorted lists​

c)

It is very complex to understand​

93.

In a binary search the statement

int middle = (left + right) / 2;

calculates

a)

the element in the remaining list that has a greater value than the value being sought

b)

the element in the remaining list that has a smaller value than the value being sought

c)

the element in the remaining list to be checked for the value being sought

d)

None of the above