In a table of student information, what do the rows and columns represent?
7 Data Structures for Problem Solving Online Quiz Questions
Use this free practice quiz with 20 questions to review 7 Data Structures for Problem Solving, test your knowledge, and prepare for your next test or exam.
A record groups related fields that describe one entity.
- A
True
- B
False
A list has four elements. What is the final valid zero-based index?
- A
0
- B
2
- C
3
- D
4
What collection operation processes elements one at a time?
In the school-system example, the students variable uses an outer containing one for each student.
Why can inserting an element near the beginning of an array-like contiguous sequence be costly?
- A
It automatically changes every element into a record.
- B
It may require other elements to shift positions.
- C
It prevents the collection from being traversed.
- D
It converts the sequence into a database table.
Which operations are supported by strings according to the material? Select all that apply.
- A
Indexing
- B
Sorting records by a database key
- C
Searching
- D
Replacing
A contact application must frequently find a contact by username and eventually search, sort, filter, and persist millions of contacts. Which two structures best match these requirements? Select all that apply.
- A
A dictionary keyed by username for frequent username lookup
- B
A list solely because contacts are stored as text
- C
A stack because contacts are records
- D
A database table with suitable indexes for large persistent data
A program changes a student's existing grade from 95 to 98. Which collection operation is being performed?
In the sequence [10, 20, 30], position 1 is the , and 20 is the stored at that position.
When a table may be reordered, an algorithm should identify the student to update by a stable key rather than by the student's current position.
- A
True
- B
False
Which approach is recommended for efficient construction of a large string from many pieces?
- A
Repeatedly concatenate directly to the same large string
- B
Collect pieces in a list and join them once
- C
Store every character in a database table before combining them
- D
Replace all strings with records
Assigning a value to an existing dictionary key replaces the value previously associated with that key.
- A
True
- B
False
In Python, if word = "Structure", what value does word[1:4] produce?
- A
truct
- B
tru
- C
trucT
- D
ruct
What is the result of this Python expression? scores = [72, 88, 91, 64]; passing = [score for score in scores if score >= 70]
- A
[64, 72, 88]
- B
[72, 88, 91, 64]
- C
[72, 88, 91]
- D
[88, 91]
A program has student = {"id": 1042, "name": "Ada Lovelace", "grade": 95}. What is the effect of executing student["grade"] = 98?
- A
The value of
student["grade"]becomes 98. - B
A new key named
"grade2"is created with value 98. - C
The dictionary becomes invalid because an existing key cannot be assigned.
- D
The value of
student["name"]becomes 98.
Given a students table with unique id values, what does this SQL statement do? UPDATE students SET grade = 98 WHERE id = 1042;
- A
Every student's grade is changed to 98.
- B
Only the first row in the table is changed.
- C
The row with grade 1042 is changed to 98.
- D
The row with
id1042 is changed to 98.
What property of strings means that an operation such as concatenation creates a new string instead of changing the original string in place?
What is the arithmetic average of the list [72, 88, 91, 64]? Enter the value as a number.
Consider this Python code:\n\na = [1, 2]\nb = a\nb.append(3)\n\nWhat are the final values of a and b, why do they have those values, and how would you change the code so that appending to b does not change a?