Data structure/Data Structure and Algorithms (DSA) set 2 Sample Test,Sample questions

Question:
  The selection sort is basically a method of repeated

1. interchange

2.searching

3.position adjustment

4.None of These


Question:
 A sorted file contains 16 items. Using binary search, the maximum number of comparisons to search for an item in this file is

1.15

2.8

3.1

4.4


Question:
 A sorting technique that guarantees that records with the same primary key occurs in the same order in the sorted list as in the original unsorted list is said to be

1.. stable

2.consistent

3.external

4.linear


Question:
 A ______ merge sort uses a constant number of input merge files and the same number of output merge files.

1.k-way

2.balanced

3.polyphase

4.radix


Question:
 Best and the worst case timing complexities of insertion sort are_________.

1. A. o(n2), o(n2)

2.o(n log n), o(n2)

3.o(n), o(n2)

4.o(n), o(n3)


Question:
 Give output of the following programint main(){inta[]={2,3,4,5,6};printf("%d",2[a]);}

1. compilation error

2.run time error

3.4

4.2


Question:
 Give timing complexities of three sorting algorithms bubble sort,selection sort,insertion sort respectively.

1.0(log n), 0(log n), o(log n)

2.o(n2), o(n2), o(n2)

3.o(n2), o(n log n), o(n log n)

4.o(n log n), o(n2), o(n log n)


Question:
 If two different keys yield the same hash address, it is called _______ .

1.binary search

2.sequential search

3.collision

4.rotation


Question:
 In bubble sort,for a file of size n,after p iterations number of records in proper position is____

1. n-p

2. n-p+1

3. n-p+2

4.p


Question:
 let x be the adjacency matrix of a graph .G with no self loop.The entries along the principle diagonal of x are

1. all "0"

2.all "1"

3.both 0&1

4.different


Question:
 The number of comparisons required to sort 5 numbers in ascending order using bubble sort are

1.7

2.6

3.10

4.5


Question:
 The smallest element of an array’s index is called its

1.lower bound

2.upper bound

3.range

4.extraction


Question:
 Where do we use the operator --> ?

1. to access a member of structure

2.to access member of union

3.to access an array

4.both(a) and(b).


Question:
 Which of the following data structure can't store the non-homogeneous data element?

1.arrays

2.records

3.pointers

4.none


Question:
 Which of the following sorting method is the slowest?

1.o(1)

2.o(log2n)

3.o(n)

4. o(n2)


Question:
. A sort which compares adjacent elements in a list and switches wherever necessary is _______

1. insertion sort

2.bubble sort

3.selection sort

4. none of these


Question:
a character when enter is pressed

1.0 or 1

2.-1, 0 or 1

3.a character

4.nothing


Question:
A sort which compares adjacent elements in a list and switches where necessary is

1. insertion sort.

2.heap sort

3.quick sort

4.bubble sort


Question:
A sort which iteratively passes through a list to exchange the first element with any element less than it and then repeats with a new first element is called

1. insertion sort

2.selection sort

3.heap sort

4. quick sort


Question:
A sorting algorithm is stable if

1. its time complexity is constant irrespective of the nature of input

2. preserves the original order of records with equal keys

3.its space complexity is constant irrespective of the nature of input

4. it sorts any volume of data in a constant time


Question:
A variable P is called pointer if__
A. 

1.p contains the address of an element in data

2.p points to the address of first element in data

3.p can store only memory address

4.p contain the data and the address of data


Question:
A ______ is a data structure use foe a storage of a records.

1.tree

2. hash table

3.stack

4.graph


Question:
By using which of the following methods sorting is not possible?

1. insertion

2.exchange

3.selection

4.deletion


Question:
Examples of sorting algorithms are

1. bubble sort

2.selection sort

3.insertion sort

4.(a),(b),and ©


Question:
Given a file size n the number of times a given file is passed through in bubble sort is____

1.n2

2.n-1

3.nlogn

4.logn


Question:
how many vlue can held by an array A(-1…m,1…m)?

1. m

2.m^2

3.m(m+1)

4.m(m+2)


Question:
If s1 is "ABC" and s2 is "DEF" then strcat(s1,s2)will give the following result.

1. s1="abcdef" and s2="def"

2. s1="abcdef" and s2="def"

3.s1="abc" and s2="abcdef"

4.s1="abc" and s2="abcdef"


Question:
If the input array is unsorted, then only a linear ______ can be used.

1.binary search

2.sequential search

3.indexed search

4.jump search


Question:
In bubble sort,for a file of size n,during each pth pass the number of last records left out are___

1. n-p

2.n-p+1

3.p

4.p-1


Question:
In ______ method of hashing, selected digit are extracted from the key and used as the address.

1. subtraction

2.digit extraction

3.rotation

4.folding


Question:
One of the statement is false

1. A. tree is an abstract data type

2.array is a linear data structure

3. typedef is derived data type

4.float is built in data type


Question:
Sorting is useful for_________

1.report genration

2.minimizing the storage needed

3.making searching easier and efficient

4.responding to queries easily


Question:
The average case complexity of Insertion Sort is

1.o(2n)

2. o(n3)

3. o(n2)

4.o(2n)


Question:
The difference between linear array and a record is_____

1. an array is suitable for homogeneous data but the data items in a record may have different data type

2.. in a record,theremay not be a natural ordering in opposed ti linear array

3.a record form a hierarchical structure but a linear array does not

4.All of the above


Question:
The function strcmp(s1,s2)will return -1 if____

1.s1>s2

2. s1=s2

3. s1<s2

4.function does not return -1.


Question:
The getch() library function returns___

1.a character when any key is pressed

2.a character when enter is pressed

3.displays a character on the screen when any key is pressed

4.None of these


Question:
The number of interchanges required to sort 5, 1, 6, 2 4 in ascending order using Bubble Sort is

1.6

2.5

3.7

4.8


Question:
The number of swappings needed to sort the numbers 8, 22, 7, 9, 31, 19, 5, 13 in ascending order, using bubble sort is

1.11

2.12

3.13

4.14


Question:
The ______ sort algorithm is called diminishing increment sort.

1.merge

2.radix

3.shell

4.selection


Question:
Total number of comparision in bubble sort is____

1.o(nlogn)

2.o(n2)

3. o(n)

4.None of These


Question:
What is the number of swaps required to sort n elements using selection sort, in the worst case?

1. Θ(n)

2.Θ(n log n)

3.Θ(n2)

4.Θ(n2 log n)


Question:
Which is the simplest file structure?

1. sequential

2.indexed

3.random

4.bubble


Question:
Which of the following sorting methods will be the best if number of swappings done, is the only measure of efficienty?

1. bubble sort B. C. D. merge sort

2.selection sort

3.insertion sort

4.insertion sort


Question:
Which of the following sorting methods would be most suitable for sorting a list which is almost sorted

1.bubble sort

2.selection sort

3. insertion sort

4.merge sort


Question:
Which sorting algorithm can exploit the partially sorted data in a list?

1.bubble sort

2.selection sort

3.insertion sort

4.all of them


Question:
You are asked to sort 15 randomly generated numbers. You should prefer

1. bubble sort

2.selection sort

3.insertion sort

4.merge sort


Question:
You want to check whether a given set of items is sorted. Which of the following sorting methods will be most efficient if it is already in sorted order?

1. bubble sort

2.selection sort

3.insertion sort

4.merge sort


Question:
__ refers to the operation of finding the location of a given item in a collection of items.

1.sorting

2.searching

3.function

4.complexity


Question:
__passes are required to sort n data using bubble sort.

1.n

2.n-1

3.n+2

4. n-2


Question:
___ method of collision resolution involves maintaining two tables in memory.

1.linear probing

2.chaining

3.quadratic probing

4.double hashing


Question:
____ is a attribute of a sort, indicating that data with equal keys maintain their relative input order in the output.

1. sort order

2.sort stability

3.sort efficiency

4.collision


Question:
____ is a merge sort that sorts a data stream using repeated merges.

1. balanced

2.polyphase

3.radix

4.k-way


Question:
_____ hashing method is used in combination with other methods.

1.subtraction

2.digit extraction

3.rotation

4.division


Question:
_____ is a search for data that uses an index to locate the item.

1. binary search

2.sequential search

3.indexed search

4.jump search


Question:
______ is a field whose values uniquely determine the records in the file.

1. pointer

2.primary key

3.secondary key

4.function


More MCQS

  1. Data Structures and algorithms MCQ Questions
  2. Data Structure -Abstract Data Types
  3. Data Structure Questions and Answers Singly Linked
  4. Data Structures &algorithms MCQ Questions
  5. Data Structure Multiple Choice Questions and Answers
  6. Data Structure (DS) MCQ Set 1
  7. Data Structure (DS) MCQ Set 2
  8. Data Structure and Algorithms (DSA) set 1
  9. Data Structure and Algorithms (DSA) set 2
  10. Data Structure and Algorithms (DSA) set 3
  11. Data Structure and Algorithms (DSA) set 4
  12. Data Structure and Algorithms (DSA) set 5
  13. Linear Data Structures - List
Search
Olete Team
Online Exam TestTop Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on Online Exam Testwebsite is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!