Foundations of Comp Sci Quizzes

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/147

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 2:50 PM on 6/17/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

148 Terms

1
New cards

Binary tree

Which type of tree is a tree in which each node has zero, one, or two children?

2
New cards

Node

What is a common name of a class a programmer would define to implement a linked list?

3
New cards

It has numeric values associated with the edges.

What distinguishes a weighted graph from other types of graphs?

4
New cards

A collision occurs.

What happens when a hash function returns the same output for different inputs in a hash table?

5
New cards

O(1)

What is the time complexity of a lookup operation in a hash table when there are no collisions?

6
New cards

A tree where each node has zero, one, or two children, and all left descendants are less than the node

What is a binary search tree?

7
New cards

The new node becomes the root.

What is the first step when inserting a new node into a binary search tree that does not have a root?

8
New cards


Ascending order

Which order will the output be in when performing in-order traversal on a binary search tree?

9
New cards

Binary search

Which type of search algorithm is coded by defining the first and last index positions of an ordered list so that the middle position can be calculated?

10
New cards


Merge sort algorithm

Which type of sorting algorithm divides data recursively in two parts until each list has only one element?

11
New cards


Quicksort

Which type of sorting algorithm uses a partition technique called pivot?

12
New cards

To sort an unsorted collection of elements in order

What is the primary purpose of sorting algorithms in computer science?

13
New cards

By going through the list and swapping where necessary

How does bubble sort ensure that the highest value reaches the last position in the list?

14
New cards

The lower value

Which value is shifted to the left in an insertion sort?

15
New cards

Get

Method used to remove and return an element from a SImpleQueue.

16
New cards

Push it to the stack

What should be done when an opening symbol such as ('(', '[', or '{') is found within a stack when checking the correctness of parentheses.

17
New cards

A stack-like behavior

What does the LifoQueue class from Python's queue module provide?

18
New cards

O(V + E)

The time complexity of the breadth-first search algorithm when applied to graphs.

19
New cards

O(n)

The time complexity of the breadth-first search algorithm when applied to binary trees?

20
New cards

When the queue is empty

When would a user stop iterating through the nodes in Breadth-First Search?

21
New cards


The index for the partition element

What does the partition function return when implementing Quicksort in Python?

22
New cards

O(log n)

What is the space complexity of Quicksort?

23
New cards

O(n log n)

What is the time complexity of Quicksort

24
New cards

When first_index is equal to last_index

What is the base condition for the recursive calls to stop in the Quicksort algorithm?

25
New cards

The first row

What does 'arr[0]' return if 'arr' is a 2D numpy array?

26
New cards

2

What is the result of the following operation: np.array([[1, 2], [3, 4]])[0][1]?

27
New cards

np.zeros((3, 3))

How could someone create a 2D NumPy array with dimensions 3x3 filled with zeros?

28
New cards

data[0:2, 0:2]

What is the correct way to select a sub-array from the first two rows and first two columns of a 2D array named "data"?

29
New cards

data.cumsum()

How can you calculate the cumulative sum of the elements in a NumPy array named "data"?

30
New cards

np.median(data)

What is the correct way to calculate the 50th percentile (median) of a NumPy array named "data"?

31
New cards

np.median(arr)

Which NumPy method is an example used to find the middle value of the NumPy array np?

32
New cards

A concatenated list is produced.

What is the expected output of using + between two lists?

33
New cards

print(numpy_array[6:11])

What code would print a sub array of the elements at indices 6 through 10 in numpy_array?

34
New cards

np.array(list)

What is the correct way to create a NumPy array from a Python list?

35
New cards

Only values of a single type.

What type of values can a NumPy array contain?

36
New cards

It selects elements corresponding to True in the boolean array.

What is the result of using a boolean array for subsetting a NumPy array?

37
New cards

The entire second row

What is the result of subsetting a NumPy array using array[1, :]?

38
New cards


array[0:2, 0:2]

How can someone subset the first two rows and the first two columns of a 2D NumPy array?

39
New cards

array[1, 2]

Which code snippet is a correct way to perform subsetting on a 2D numpy array to get a single element?

40
New cards

numpy.random.rand

What is the name of the function in NumPy used for generating random numbers?

41
New cards

They can perform calculations faster.

What is a consequence of NumPy arrays being able to contain only one data type?

42
New cards

A NumPy array containing booleans indicating if each element meets the condition

What is the result of using the greater than sign '>' on a NumPy array?

43
New cards

Because it assumes all elements are of a single type

What is the primary reason NumPy can perform calculations so quickly?

44
New cards


A new list with the elements concatenated

What is the output of 'python_list + python_list' if 'python_list' is a regular Python list?

45
New cards

np.array(heights)

How is a NumPy array created from a Python list named 'heights'?

46
New cards


np.median(data)

Which NumPy function can be used to summarize a dataset with a single value representing its central tendency?

47
New cards

It reduces computation time for large datasets

What is the primary benefit of NumPy's speed advantage in numerical computations?

48
New cards

It controls the standard deviation of the output.

'''python

scores = np.random.normal(1.75, 0.20, 5000)

'''

What is the role of the second parameter in the above line of code?

49
New cards

All elements will be converted to string.

What is the expected result if one float element in a NumPy array is converted to a string?

50
New cards

It is equipped with a digital signature.

Feature that causes a device driver to be a 'signed' driver?

51
New cards

data[2, 3]

What is the correct way to select the element in the third row and fourth column of a 2D array named "data"?

52
New cards

del list[0]

Which Python code will delete the first value in a list (list name list)?

53
New cards

Binary search is much more efficient than Linear search.

What is the relative level of complexity when comparing Linear search to Binary search?

54
New cards

Unallocated

How would a new hard drive that has never been used be indicated in the Windows Disk Management Utility?

55
New cards

Delete it.

What should be done if the node to be deleted in a binary search tree has no children?

56
New cards

Left subtree, current node, right subtree

Which sequence reflects the order of visitation for an in-order traversal of a binary tree?

57
New cards

left subtree, Right subtree, current node

Which sequence reflects the order of visitation for an post-order traversal of a binary tree?

58
New cards

Current node, left subtree, right subtree

Which sequence reflects the order of visitation for an pre-order traversal of a binary tree?

59
New cards

O(n^2)

Which notation describes the complexity of n operations within a pair of nested loops?

60
New cards

Embedded OS

What is the type of operating system found on a kiosk, bank cash machine, or industrial machine?

61
New cards

It separates the rows and columns in the array.

What is the purpose of the comma in the following code snippet?
 
```python
import numpy as np
np_x = np.array(x)
np_x[:, 0]
```

62
New cards

The elements are pasted together, generating a longer list.

What happens when two Python lists are added  together using the '+' operator?

63
New cards

"dat"

What is the result of print(msg[-10:-7]) be when msg = "Updating Now"?

64
New cards

The current node becomes current node's left child.

What happens if the search value is less than the current node's data during a search operation?

65
New cards

Files will inherit the permissions of the parent folder

What is the result of creating files in a read-only folder?

66
New cards

The lowest value

What is the pointer looking for as it moves through the list in a selection sort?

67
New cards

array[-1, :]

How can a user subset the last row of a 2D NumPy array?

68
New cards

import numpy as np

How is the NumPy package imported into a Python session?

69
New cards

The element in the second row and second column

What does array[1, 1] return in a 2D NumPy array?

70
New cards

capitalize()

Which Python method will replace the first letter of a string with a capital letter and convert all other letters to lowercase?

71
New cards

An error

What will be the result of adding an integer to a string in Python?

72
New cards

DIR

What command in the command prompt in Windows allow a user to display the file list of their current directory?

73
New cards

To specifies the new value 

What is the purpose of the second input in the method stateNames.replace("ca", "CA")?

74
New cards

np.array([[1, 2], [3, 4]])

How can a 2D NumPy array be created from a list of lists in Python?

75
New cards

x = 99

Which Python statement correctly assigns the value 99 to a variable?

76
New cards

One

How many different data types are allowed in a given NumPy array?

77
New cards

File extension

What indicates the type of file or the application that can be used to access it?

78
New cards

The shell

Which component of the operating system is responsible for accepting user commands?

79
New cards

np.median(np_stats[:, 0])

What Python code would return the median height in np_stats where np_stats = np.array([[6.1,200],[5.5,130],[5.9,155]])?

80
New cards

The advanced security

What is one advantage of FreeBSD over Linux?

81
New cards

With square brackets

How can a Python list be built?

82
New cards

pow()

Which function would allow the user to calculate a number squared?

83
New cards

print(5 - 3)

Which Python code will print the results of 3 subtracted from 5?

84
New cards

O(n^2)

What is the time complexity of a selection sort algorithm?

85
New cards

O(n^2)

What is the time complexity of a insertion sort algorithm?

86
New cards

O(n^2)

What is the time complexity of a bubblesort algorithm?

87
New cards

O(n log n)

What is the time complexity of a quicksort algorithm?

88
New cards

O(n log n)

What is the time complexity of a mergesort algorithm?

89
New cards

An element-wise sum of the arrays.

What is the result of adding two NumPy arrays together using the '+' operator?

90
New cards

type(variable)

What is the method for checking the data type of a variable in Python?

91
New cards

Linked List

Which type of data structure could be Singly or Doubly?

92
New cards

[]

What is the slicing outcome of client_locations[2:2] from client_locations = ["TX", "AZ", "UT", "NY"]?

93
New cards

Lists

What does the NumPy package provide an alternative to in Python?

94
New cards

The head

What is the first element of each node in a linked list?

95
New cards

The kernel

Which component of the operating system is responsible for acting as the interface between applications and the hardware itself?

96
New cards

Files

What are smallest units of storage that can be stored on any storage medium from a general user's perspective?

97
New cards

np.array([2, 4, 6, 8, 10])

What is the correct way to create a NumPy array with values ranging from 2 to 10 in increments of 2?

98
New cards

The number of rows and columns in the array

What does the shape attribute of a numpy array indicate?

99
New cards

Array([24])

What is the expected output of the following code? 
 
numpy_array[numpy_array > 23] where numpy_array = ([21,20,21,24,22])

100
New cards

Compare the first and second elements

What is the first step in the insertion sort algorithm?