# Parallel Array | Data Structure MCQs

1.

Which of the following can be called a parallel array implementation?

A.)
```  firstName  = ['Joe','Bob','Frank','Hans']
lastName   = ['Smith','Seger','Sinatra','Schultze']
heightInCM = [169,158,201,199]

for i in xrange(len(firstName)):
print "Name:",firstName[i], lastName[i]
print "Height in CM:,",heightInCM[i]```
B.)
```firstName  = ['Joe','Bob','Frank','Hans']
lastName   = ['Smith','Seger']
heightInCM = [169,158]

for i in xrange(len(firstName)):
print "Name:",firstName[i], lastName[i]
print "Height in CM:,",heightInCM[i]```
C.)
``` firstName  = ['Joe','Bob']
lastName   = ['Smith','Seger','Sinatra','Schultze']
heightInCM = [169,158]

for i in xrange(len(firstName)):
print "Name:",firstName[i], lastName[i]
print "Height in CM:,",heightInCM[i]```
D.) None of these

All the arrays must have equal length, that is, contain same number of elements.

2.

To search for an element in a sorted array, which searching technique can be used?

A.) Linear Search
B.) Jump Search
C.) Binary Search
D.) Fibonacci Search

Binary Search

3.

What are some of the applications of sorted arrays?

A.) Commercial computing
B.) Priority Scheduling
C.) Discrete Mathematics
D.) All of the Above

Sorted arrays have widespread applications as all commercial computing involves large data which is very useful if it is sorted. It makes best use of locality of reference and data cache.

4.

A.) When a language does not support records, parallel arrays can be used
B.) Increased locality of reference
C.) Ideal cache behavior
D.) All of the above

In a record, if a field contains only 1 bit, extra space is needed to pad the bits, instead you can use parallel arrays to save space. Sequential access improves locality of reference and cache behavior.

5.

What are parallel arrays?

A.) Arrays of the same size
B.) Arrays allocated one after the other
C.) Arrays of the same number of elements
D.) Arrays allocated dynamically

Different arrays can be of different data types but should contain same number of elements. Elements at corresponding index belong to a record.

6.

What are some of the disadvantages of parallel arrays?

A.) Poor locality of reference for non-sequential access
B.) Very little direct language support
C.) Expensive to shrink or grow
D.) All of these

They share the drawbacks of arrays.

7.

What is a sorted array?

A.) Arrays sorted in numerical order
B.) Arrays sorted in alphabetical order
C.) Elements of the array are placed at equally spaced addresses in the memory
D.) All of these