Exam 12: Sorting Data
Exam 1: The Craft of Programming50 Questions
Exam 2: The Javascript Language49 Questions
Exam 3: Objects, Events, and Graphical User Interfaces48 Questions
Exam 4: The Sequence Structure50 Questions
Exam 5: The Selection Structure50 Questions
Exam 6: The Repetition Structure50 Questions
Exam 7: Complex Conditions49 Questions
Exam 8: Modules and Functions50 Questions
Exam 9: Menus and Data Validation50 Questions
Exam 10: Arrays50 Questions
Exam 11: Building Programs50 Questions
Exam 12: Sorting Data30 Questions
Exam 13: Recursion50 Questions
Select questions type
The insertion sort algorithm builds a sorted array one element at a time.
Free
(True/False)
4.8/5
(29)
Correct Answer:
True
Sorting an array of data elements involves moving them around.
Free
(True/False)
4.9/5
(34)
Correct Answer:
True
In a(n) ____, the number of comparisons made in each pass is one less than the number of elements remaining to be sorted because an element must be compared with the element next to it.
Free
(Multiple Choice)
4.8/5
(36)
Correct Answer:
C
The following algorithm represents the logic of a(n) ____.
For maxElement = ARRAYSIZE - 1 To 1 Step - 1
For index = 0 To maxElement - 1
If someNums[index] > someNums[index + 1] Then
Temp = someNums[index]
SomeNums[index] = someNums[index + 1]
SomeNums[index + 1] = temp
End If
End For
End For
(Multiple Choice)
4.9/5
(35)
The programming logic for a bubble sort requires two loops: an outer loop for each pass through the array and an inner loop to compare elements during a pass.
(True/False)
5.0/5
(36)
You can make an ascending bubble sort move the smallest value to the leftmost location first, and then work toward the right of the array.
(True/False)
4.8/5
(43)
When sorting a selection sort in ascending order, the array is scanned for the smallest value on the first pass, and when its position is determined, it is swapped with the element at subscript [0].
(True/False)
4.8/5
(45)
The selection sort uses a nested While loop to compare and swap elements because an element is not placed until its correct position is determined.
(True/False)
5.0/5
(38)
A bubble sort is more efficient than a selection sort because only one swap is made in each pass.
(True/False)
4.8/5
(25)
A(n) ____ finds which element belongs in a particular position on each pass through the array and moves it there.
(Multiple Choice)
4.8/5
(39)
A(n) ____ builds a sorted array by determining where each element should be in the sorted part of the array and inserting it in that position while moving all other sorted elements over one position.
(Multiple Choice)
5.0/5
(32)
All sorting algorithms use an outer For loop to go through an array.
(True/False)
4.7/5
(34)
To reverse the order of array elements, you use the JavaScript method ____.
(Multiple Choice)
4.7/5
(46)
A(n) ____ is the most straightforward sorting algorithm but often the least efficient.
(Multiple Choice)
5.0/5
(39)
A(n) ____ involves comparing adjacent elements and swapping them, if needed, until all elements are in their correct positions.
(Multiple Choice)
4.9/5
(37)
Sorting is often done on arrays because sorted array elements can be referenced in memory and moved around more easily.
(True/False)
4.8/5
(38)
Which of the following swaps the values of someNums[0] and someNums[1], which currently contain the values 8 and 3, respectively?
(Multiple Choice)
4.9/5
(42)
Data in data structures, such as linked lists and binary trees, cannot be sorted.
(True/False)
4.8/5
(43)
Showing 1 - 20 of 30
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)