Docsity

WGU C949 Data Structures and Algorithms test questions, Exams of Advanced Education

Toggle sidebar
bg1
1
/
8
WGU C949 Data Structures and Algorithms test questions
1.
A functions whose cost scales linearly with the size of the input:
O(n)
2.
Iterating
over a collection of data once often indicates an
algorithm. (alphabet for-loop example):
O(n)
3. A functions whose cost scales logarithmically with the input size:
O(log n)
4.
Which type of function works by breaking down large problem
into smaller
and smaller chunks?: O(log n)
5.
As the size of the input grows the cost of the algorithm does
not increase at the same rate. The overall cost of performing an
operation on 1,000,000 items is only twice that of performing the
operation on 1,000 items.:
O(log n)
6. A function that exhibits quadratic growth relative to the input
size: O(n^2)
7. An example of this type of function is doubly nested loop: O(n^2)
8. Which type of function gets really expensive really quickly?:
O(n^2)
9.
A function that has two inputs that contribute to growth:
O(nm)
10.
An example of this type of function is when there is a
nested loop that iterates of two distinct collections of data:
O(nm)
11. Are Big-O cases used in the best or worst situations?: Worst
12.
Which statement is static?
readonly Contact[] contacts = new Contact[];
readonly Contact contacts = new Contacts[100];: readonly Contact
pf3
pf4
pf5
pf8

Partial preview of the text

Download WGU C949 Data Structures and Algorithms test questions and more Exams Advanced Education in PDF only on Docsity!

1 /

WGU C949 Data Structures and Algorithms test questions

  1. A functions whose cost scales linearly with the size of the input: O(n)
  2. Iterating over a collection of data once often indicates an algorithm. (alphabet for-loop example): O(n)
  3. A functions whose cost scales logarithmically with the input size: O(log n)
  4. Which type of function works by breaking down large problem into smaller and smaller chunks?: O(log n)
  5. As the size of the input grows the cost of the algorithm does not increase at the same rate. The overall cost of performing an operation on 1,000,000 items is only twice that of performing the operation on 1,000 items.: O(log n)
  6. A function that exhibits quadratic growth relative to the input size: O(n^2)
  7. An example of this type of function is doubly nested loop: O(n^2)
  8. Which type of function gets really expensive really quickly?: O(n^2)
  9. A function that has two inputs that contribute to growth: O(nm)
  10. An example of this type of function is when there is a nested loop that iterates of two distinct collections of data: O(nm)
  11. Are Big-O cases used in the best or worst situations?: Worst
  12. Which statement is static? readonly Contact[] contacts = new Contact[]; readonly Contact contacts = new Contacts[100];: readonly Contact

2 / contacts = new Con-tacts[100];

  1. A container where data is stored in nodes consisting of a single data item and a reference to the next node: Linked List
  2. A is a container where nodes of data are linked together into a list: Linked List
  3. Linking together complex nodes into a single structure: Linked List
  4. Each link in a chain for a linked lists is called a : node
  5. What two things do nodes contain?: 1. the value
  6. reference to next item in the list
  7. Give a coded example on how to create a 3 chained linked list of nodes.: Node head = new Node(1); head.Next = new Node(2); head.Next.Next = new Node(3);
  8. A list where we start at the first node and follow the chain of nodes iterating over each until we get to the end: Singly Linked List
  9. A list that builds on the singly linked list by adding reverse iteration.: Doubly Linked List
  10. Give a coded example on how to create a doubly linked list: Node node1 = new Node(1); Node node2 = new Node(2); Node node3 = new Node(3); node1.Next = node2; node2.Previous = node1; node2.Next = node3;

4 / is greater than or equal to the node's childrens' keys.: max heap

  1. A tree that maintains the simple property that a node's key is less than or equal to the node's childrens' keys.: min heap
  2. A data structure for representing connections among items, and consists of vertices connected by edges.: graph
  3. This represents an item in a graph.: vertex
  4. This represents a connection between two vertices in a graph.: edge
  5. A Last-in, First-out (LIFO) data container: Stack
  6. When something is retrieved from a stack, does it come from the top or bottom of the stack?: Top
  7. A First-in, First-out (FIFO) container: Queue
  8. When something is removed from a queue, does it come from the head or the tail?: Head
  9. When something is added to a queue, does it get added to the head or the tail?: Tail
  10. A queue-like container which is both First-in, First-out and Last-in, Last-out- : Doubly Ended Queue (deque)
  11. Which type of function allows for items to be added or removed from the beginning or end?: Doubly Ended Queue (deque)
  12. A data structure where nodes have parent-child (1:N) relationship: Tree
  13. Each node in a Tree has at least parent, but the number of children depends on the type of tree: one
  14. Every node in a tree has how many parents?: one
  15. Every part of a tree spawns how many children?: 0 or more
  16. Nodes that have no children are called what?: Leaf nodes
  17. How many data items does each node on a tree contain?: one
  18. At most how many children can each node have in a binary tree?: two
  19. The maximum number of children that each node can have:

5 / Degree

  1. The maximum amount of edges between that node and a leaf: Height
  2. When smaller values are added to this tree smaller values are added to the left: Binary Search Tree
  3. The smallest value in a binary search tree will be on the bottom most , while the largest value will be on the bottom most : left right
  4. The insertion complexity on average of a binary search tree: O(long n)
  5. The insertion complexity with the worst case of a binary search tree: O(n)
  6. The node is visited before it's children: Pre-order
  7. The left child is visited before the node, then the right child: In-order
  8. The left and right children are visited before the node: Post- order
  9. An example of why pre-order traversals are useful: To create an identical copy of a tree
  10. What are in-order traversals useful for?: Sorting trees from least to greatest
  11. What are post-order traversals useful for?: To delete every node in a tree
  12. The average case, best case and worst case for Traversal Complexity: O(n)
  13. Searching in Binary Search Tree: O(log n)
  14. How can a leaf node be removed from a tree?: Unlinking the node
  15. How can a node with One Child be removed from a tree?: Promote the child
  16. How can a node with Two Children be removed from a tree?: Move the successor's child up to the root node.

7 /

  1. Which method removes a key-value pair from a dictionary?: popitem();
  2. Which method removes all keys from a dictionary?: keys();
  3. There are 3 items in a stack, the next line of code is "push('item');". How many items are now in the stack?: 4
    1. Visit node
  4. Traverse left
  5. Traverse right: Preorder Traversal (Binary Tree)
  6. Cannot handle sets, lists or dictionaries: Hash Function
  7. A modulo hash function is used to map to indices 0 to 9. The hash function should be: key % : 10
  8. key % 1000 maps to indices 0 to .: 999
  9. A modulo hash function for a 50 entry hash table is: key % : 50
  10. A hash function computes a bucket index from an item's .: key
  11. A 100 element hash table has 100 .: buckets
  12. For a well- designed hash table, searching requires on average.: O(1)
  13. In a Hash Table keys need to be .: unique
  14. Given a hash table with 100 buckets and modulo hash function, in which bucket will HashInsert(table, item 334) insert item 334?: 34
  15. Given a hash table with 50 buckets and modulo hash function, in which bucket will HashSearch(table, 201) search for the item?: 1 (201%50)
  16. A hash table's items will be positive integers, and -1 will represent empty. A 5-bucket hash table is: -1, -1, 72, 93, -1. How

8 / many items are in the table?: 0