C949/ WGU C949 - DATA STRUCTURES AND ALGORITHMS PRE-ASSESSMENT, Exams of Nursing

C949/ WGU C949 - DATA STRUCTURES AND ALGORITHMS PRE-ASSESSMENT WITH COMPLETE QUESTIONS AND CORRECT DETAILED ANSWERS (VERIFIED ANSWERS) GRADED A+

Typology: Exams

2025/2026

Available from 06/01/2026

Wiseman1
Wiseman1 🇺🇸

4.5

(2)

2.6K documents

1 / 39

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Page 1 of 39
C949/ WGU C949 - DATA STRUCTURES AND
ALGORITHMS PRE-ASSESSMENT WITH
COMPLETE QUESTIONS AND CORRECT
DETAILED ANSWERS (VERIFIED ANSWERS)
GRADED A+
Which sequence of letters represents preorder traversal of the
nodes of this tree?
A.)
A B C D E F G H I
B.)
A B C D F E G I H
C.)
B A D F C I G E H
D.)
B F D I G H E C A -
✔✔✔
correct answer > B
An array soc of size 1009 is used where the index is an integer in
[0,1008] and the hash-function key%1009.
Where will the data associated with the key given by the last 4
social security digits '2023' be stored?
A.)
In soc[4]
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27

Partial preview of the text

Download C949/ WGU C949 - DATA STRUCTURES AND ALGORITHMS PRE-ASSESSMENT and more Exams Nursing in PDF only on Docsity!

C949/ WGU C949 - DATA STRUCTURES AND

ALGORITHMS PRE-ASSESSMENT WITH

COMPLETE QUESTIONS AND CORRECT

DETAILED ANSWERS (VERIFIED ANSWERS)

GRADED A+

Which sequence of letters represents preorder traversal of the nodes of this tree? A.) A B C D E F G H I B.) A B C D F E G I H C.) B A D F C I G E H D.) B F D I G H E C A - ✔✔✔ correct answer > B An array soc of size 1009 is used where the index is an integer in [0,1008] and the hash-function key%1009. Where will the data associated with the key given by the last 4 social security digits '2023' be stored? A.) In soc[4]

B.) In soc[5] C.) In soc[1009] D.) In soc[2023] - ✔✔✔ correct answer > B A stack s, a queue q, and a max value priority queue p each have a single 3 in them. Next s.push(4), q.push(4), and p.push(4) are executed. What is the triple (s.pop(), q.pop(), p.pop())? A.) (3,4,4) B.) (4,3,3) C.) (4,3,4) D.) (4,4,3) - ✔✔✔ correct answer > C This stack reads left to right with the top to the right: 'green' 'yellow' 'blue' 'red'

'blue' C.) 'purple' 'green' 'yellow' 'blue' 'red' D.) 'green' 'yellow' 'blue' 'red' 'purple' - ✔✔✔ correct answer > A Which command helps to speed up comparisons using dictionary keys during a dictionary (d) lookup in this pseudocode clip? h = hash(key) for pair in d: if h == pair[0]: return pair[1] A.) 0(1) B.) pair[0]

C.) pair[1] D.) hash(object) - ✔✔✔ correct answer > D What does the method any(b) return in Python if b is a dictionary? A.) Returns False if the dictionary is empty. B.) Method any() does not exist for the dictionary. C.) Returns True if any key of the dictionary is true. D.) Returns True if all keys of the dictionary are true. - ✔✔✔ correct C Which Java method is used to read bytes from a standard file? A.) Java.mp.In B.) Java.io.StdArrayIO C.) Java.lang.BinaryStdIn D.) Java.io.FileInputStream - ✔✔✔ correct answer > D Which command will retrieve an item from the top of the stack? A.) Pop() B.) Deque() answer >

C.) When the programmer needs to delete some of its data items D.) When the program needs to quickly modify the contents of its data structures - ✔✔✔ correct answer > B What is the logical first step in an algorithm that extracts all the positive values from a given list of numbers? A.) Initialize the result to 0 B.) Set the current number to 0 C.) Initialize the result to an empty list D.) Check that the given list contains at least one number - ✔✔✔ C What is displayed when n = 2 in this pseudocode? for(int i = 2; i <= n; i++)D for(j = 0; j <= n;)D display j; j = j + n/2; the division is integer division, decimal part neglected } } correct answer >

A.) 0, 1, 2

B.) 1, 0, 2

C.) 1, 2, 0

D.) 0, 2, 1 - ✔✔✔ correct answer > A Given a set of numeric data and two declared variables: small and max, what is the logical first step in an algorithm that finds the smallest number? A.) Declaring a variable for small B.) Setting the variable equal to zero C.) Determining the maximum number D.) Checking that the list contains at least one number - ✔✔✔ D What is the logical last step in an algorithm that averages the high temperatures for 10 days and displays the average high temperature? A.) Printing the temperature B.) Declaring the variable temperature C.) Computing the average high temperature correct answer >

A.) 5

B.) 5

C.) 5

D.) 5

24 - ✔✔✔ correct answer > B How many times in this pseudocode is the function F called? Main Declare K as Integer K = 3 Set Result = F(K) Write Result End Program Function F(N) as Integer If N == 1 Then

Set F = 1 Else Set F = N * F(N - 1) Set N = N - 1 End If End Function A.) 1 B.) 3 C.) 4 D.) 6 - ✔✔✔ correct answer > B What is displayed in Step 5 if A = 15 and B = 5 in the pseudocode below? Step 1: Start Step 2: Read A, B Step 3: C= A*B Step 4: D=A/B Step5: Print C Step 6: Stop

for (int i = 0; i < N; i++) for (int j = 0; j < i; j++) count++; A.) 0 B.) 1 C.) 2 D.) 3 - ✔✔✔ correct answer > D At the end of obj, what is the time complexity of inserting in this pseudocode? void DynamicArrayAppend(DynamicArray *obj, const void *input) D if (obj->logicalSize == obj->capacity - 1) D obj->capacity *= 2; obj->internalArray = realloc(obj->internalArray, obj->capacity * obj->itemSize); } obj->logicalSize += 1; DynamicArraySet(obj, obj->logicalSize - 1, input); }

DynamicArray obj = DynamicArrayCreate(sizeof(int)); for (int i = 0; i < n; i++) D int number = rand() % 10; DynamicArrayAppend(obj, &number); } A.) O(1) or O(n) B.) O(-1) or O(n) C.) O(1) or O(nn) D.) O(2) or O(log n) - ✔✔✔ correct answer > A What is the time complexity of this pseudocode? double sumCol(double table[][], int numRows, int numCols, int col) D double cSum = 0; for (int row = 0; row < numRows; row++) D cSum += table[row][col]; }

What is the time complexity of this pseudocode? Algorithm Algo1(A)

Input: An array A storing n ≥ 1 integers

Output: The sum of the elements in A s=A[1] for i=1 to n do s=s+A[i] return s A.) O(n) B.) O(1) C.) O(log n) D.) O(n log n) - ✔✔✔ correct answer > A What is the time complexity of this pseudocode? Algorithm Algo3(A, B)

Input: Arrays A and B, each of them storing n ≥ 1 integers

Output: Count array B[i], where B[i] equals the sum of A[1] to A[i], i=1 to n

c= for i=1 to n do for j=1 to n do s=A[1] for k=1 to j do s=s+A[k] if B[i]=s then c=c+ return c A.) O(1) B.) O(n 3) C.) O(log n) D.) O(n log n) - ✔✔✔ correct answer > B What is an attribute of a bubble sort algorithm? A.) Considered an adaptive sort B.) Ideal for small number of n C.) Fast multiplication algorithm D.) Uses finding the closest pair of points - ✔✔✔ correct answer > B

B.) It is a sequence of elements in which insertion and deletion takes place at both ends. C.) It is a sequence of elements in which insertion can take place anywhere in the sequence and deletion takes place only at the front. D.) It is a sequence of elements in which insertions can take place only at the back end and deletions can take place only at the front end. - ✔✔✔ correct answer > D Which data structure allows inserting and deleting data elements at both the front and the rear? A.) Trees B.) Deques C.) Stacks D.) Queues - ✔✔✔ correct answer > B Which data structure allows elements to be inserted and deleted from one end and provides no direct access to the other end? A.) List B.) Deque C.) Stack

D.) Queue - ✔✔✔ correct answer > C What are the official indexes for the list list01 given this declaration? int[ ] list01 = D0, 2, 4, 6, 8, 10}; A.) 0, 1, 2, 3, 4, 5 B.) 0, 2, 4, 6, 8, 10 C.) 1, 2, 3, 4, 5, 6 D.) 2, 4, 6, 8, 10, 12 - ✔✔✔ correct answer > A Which abstract data type (ADT) has elements of the same type so that the elements can be retrieved based on the index or position? A.) List B.) Bag C.) Stack D.) Queue - ✔✔✔ correct answer > A