0% found this document useful (0 votes)
84 views4 pages

CSE 211 - QUIZ Question

The document discusses arrays and various operations on arrays like insertion, deletion, searching. It also discusses data structures like stacks, sorting algorithms like bubble sort, searching algorithms like linear search and binary search. Key terms defined include array, base address, sorting, searching. Sample questions with answers are provided about arrays, stacks, searching and sorting algorithms.

Uploaded by

Nahid Hasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views4 pages

CSE 211 - QUIZ Question

The document discusses arrays and various operations on arrays like insertion, deletion, searching. It also discusses data structures like stacks, sorting algorithms like bubble sort, searching algorithms like linear search and binary search. Key terms defined include array, base address, sorting, searching. Sample questions with answers are provided about arrays, stacks, searching and sorting algorithms.

Uploaded by

Nahid Hasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

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.)
 For(i=pos;i>=1;i--) { A[i] = A[i+1]; }
 For(i=N; i>=pos;i--) { A[i] = A[i+1]; }
 For(i=N; i>=pos;i--) { A[i+1] = A[i] }
 For(i=pos ; i
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.)

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


 For(i=pos;i
 For(i=pos-1;i
 None

What is the contents of the array after the execution of the


following program :-
for(i=1;i<=6;i++)
 {
   for(j=i+1 ; j<= 6; j++)
   {
      if(a[i] == a[j])
      {
         a[j] = 0;
      }
}

Same
10,10, 20, 20, 30, 40

10,0 20, 0, 30, 40

10,30, 20, 0, 0, 40

A Stack follows the principle of

LIFO

FIFO

BOTH A and B
NONE
What is the advantage of linear search
Fast
Time consuming
Needs a sorted array
Does not needs a sorted array
ALL

What is the disadvantage of a binary search

Fast
Time consuming
Needs a sorted array
Does not needs a sorted array
ALL
If the search item lies in the upper half in case of binary
search which is the correct set of statements.
Top = mid + 1;
Top = mid - 1;
Bot = mid + 1;
Bot = mid - 1;

Which of the following data structure is non-linear type?


Strings
Stacks
Lists
None of above

An array is a 

Consecutive group of memory locations that share the same type


Non consecutive group of memory locations that have different
types
Non consecutive group of memory locations that share the same
type
Simple data structure containing identical types

The memory address of the first element of an array is called


Foundation address
Base address
First address
Floor address

For a binary search algorithm to work, it is necessary that the


array (list) must be

In a heap
Popped out of stack
Sorted
Unsorted

On average, a sequential search algorithm would make N/2


number of comparisons for a list of size N.
True
False

The following best describes which algorithm? The elements


are compared and swapped if the first is found to be greater
than the second.

Binary search algorithm


Linear search algorithm
Bubble sorting algorithm
 Elements in an array are accessed
a) randomly
b) sequentially
c) exponentially
d) logarithmically

------------------ is a step by step procedure for calculation


Program
Algorithm
Greedy Method
Problem

You might also like