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

1. interchange

2.searching

4.None of These

1.15

2.8

3.1

4.4

1.. stable

2.consistent

3.external

4.linear

1.k-way

2.balanced

3.polyphase

## 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

1. n-p

2. n-p+1

3. n-p+2

4.p

1. all "0"

2.all "1"

3.both 0&1

4.different

1.7

2.6

3.10

4.5

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).

1.arrays

2.records

3.pointers

4.none

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

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

1.tree

2. hash table

3.stack

4.graph

1. insertion

2.exchange

3.selection

4.deletion

1. bubble sort

2.selection sort

3.insertion sort

1.n2

2.n-1

3.nlogn

4.logn

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

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

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

1.6

2.5

3.7

4.8

1.11

2.12

3.13

4.14

1.merge

3.shell

4.selection

1.o(nlogn)

2.o(n2)

3. o(n)

4.None of These

1. Î˜(n)

2.Î˜(n log n)

3.Î˜(n2)

4.Î˜(n2 log n)

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

1.bubble sort

2.selection sort

3.insertion sort

4.all of them

1. bubble sort

2.selection sort

3.insertion sort

4.merge sort

1. bubble sort

2.selection sort

3.insertion sort

4.merge sort

1.sorting

2.searching

3.function

4.complexity

1.n

2.n-1

3.n+2

4. n-2

1.linear probing

2.chaining

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

1. balanced

2.polyphase

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

1. pointer

2.primary key

3.secondary key

4.function

## More MCQS

##### 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!