# The Data Structure Trivia Exam: Quiz!

20 Questions | Total Attempts: 2035  Settings  Do you have any idea what the data structure is? Data structure is a method that applies the appropriate structure and syntax to store and organize information. This quiz asks you what an array is, how to delete an item from an array which loop is correct, how to identify the underflow condition for a stack, and how to identify the correct set of statements. This great quiz will assist you with learning about data structure.

• 1.
An Array is what kind of data structure.
• A.

Linear

• B.

Non- Linear

• C.

Complex

• D.

All the above

• E.

None

• 2.
While inserting an item in an array of integers which loop is right, where pos is the pos at which insertion is to be made(assume array starts from 1 and N is the max no. of items in the array.)
• A.

For(i=pos;i>=1;i--) { A[i] = A[i+1]; }

• B.

For(i=pos ; i

• C.

For(i=N; i>=pos;i--) { A[i] = A[i+1]; }

• D.

For(i=N; i>=pos;i--) { A[i+1] = A[i] }

• E.

For(i=N; i

• 3.
To delete an item from an array which loop is correct, where p is the position of deletion( assume array starts from 1 and N is the max no. of items in the array.)
• A.

For(i=N;i>=pos;i--) { a[i] = a[i+1]; }

• B.

For(i=pos;i

• C.

For(i=pos;i

• D.

For(i=pos-1;i

• E.

None

• 4.
What is the contents of the array after the execution of the following program :-int a[] = {10,30, 20, 10, 30, 40};for(i=1;i<=6;i++) {   for(j=i+1 ; j<= 6; j++)   {      if(a[i] == a[j])      {         a[j] = 0;      }}
• A.

Same

• B.

10,10, 20, 20, 30, 40

• C.

10,0 20, 0, 30, 40

• D.

10,30, 20, 0, 0, 40

• E.

40, 30 ,10, 0, 0, 0

• 5.
A Stack follows the principle of
• A.

LIFO

• B.

FIFO

• C.

BOTH A and B

• D.

None

• 6.
With every push in the stack the   top
• A.

Decrements by one

• B.

Increments by one

• C.

Stays there itself

• D.

Its always a 0

• E.

None

• 7.
Identify the UnderFlow condition for a Stack
• A.

If( top < 1)

• B.

If(top > 1)

• C.

If(top > N)

• D.

If( top < N)

• E.

None

• 8.
Identify the OverFlow condition for a Queue
• A.

If(REAR > N)

• B.

If(REAR < = FRONT)

• C.

If(REAR < 0)

• D.

If(FRONT > REAR)

• E.

NONE

• 9.
To Delete an item from a Queue identify the correct set of statements :-
• A.

Q[REAR] = item; REAR ++;

• B.

Item = Q[FRONT]; FRONT++;

• C.

Item = Q[REAR]; FRONT ++;

• D.

Item = Q[FRONT]; REAR ++;

• E.

NONE

• 10.
To Insert an item from a stack identify the correct set of statements :-
• A.

top++; S[top] = Item;

• B.

Item = S[top]; top--;

• C.

S[item] = Top; item ++;

• D.

S[top] = item; top++;

• E.

None

• 11.
Which Data structure is best suited for the UNDO operation in Windows
• A.

Stack

• B.

Queues

• C.

Both Stack and Queues

• D.

Arrays

• E.

None

• 12.
Which data structure is best suited to print the documents in the printer
• A.

Stacks

• B.

Queues

• C.

Both Stacks and Queues

• D.

Arrays

• E.

None

• 13.
Which one is the Application of Stack
• A.

Polished Notations

• B.

Storing return addresses of function calls

• C.

Reversing a String

• D.

Recursion

• E.

All of the Above

• 14.
Write the postfix notation of A + B * C / D
• A.

ABCD+*/

• B.

AB*/CD+

• C.

ABC*D/+

• D.

ABCD*+/

• E.

A+B*C/D

• 15.
Write the prefix notation of A + B * C / D
• A.

/*+ABCD

• B.

+/*DCBA

• C.

+/*BCDA

• D.

ABCD+*/

• E.

/*+BDCA

• 16.
Find the value of the postfix expression :- ABCD ^*-  (IF A = 150, B=10, C=2 D=3)
• A.

70

• B.

80

• C.

150

• D.

0

• E.

1500

• 17.
Find the postfix expression of the following :- A OR B AND !C
• A.

ABC! AND OR

• B.

AB AND C! OR

• C.

ABC! AND OR

• D.

A AND B !C OR

• E.

NONE

• 18.
What is the advantage of a linear search?
• A.

Fast

• B.

Time consuming

• C.

Needs a sorted array

• D.

Does not needs a sorted array

• E.

ALL

• 19.
What is the disadvantage of a binary search?
• A.

Fast

• B.

Time consuming

• C.

Needs a sorted array

• D.

Does not needs a sorted array

• E.

ALL

• 20.
If the search item lies in the upper half in case of binary search which is the correct set of statements.
• A.

Top = mid + 1;

• B.

Top = mid - 1;

• C.

Bot = mid + 1;

• D.

Bot = mid - 1;

• E.

None

Related Topics Back to top