WGU C949 - Data Structures And Algorithms exam with 100% correct answers 2024
WGU C949 - Data Structures And Algorithms exam with 100% correct answers 2024 A program can modify the elements of an existing list. True or False - answerTrue The size of a list is determined when the list is created and can not change. True or False - answerFalse All elements of a list must have the same type. True or False - answerFalse The statement del my_list[2] produces a new list without the element in position 2. True or False. - answerFalse The statement my_list1 + my_list2 produces a new list. True or False - answerTrue Assume that my_list is [0, 5, 10, 15]. What value is returned by sum(my_list)? - answer30 Assume that my_list is [0, 5, 10, 15]. What value is returned by max(my_list)? - answer15 Assume that my_list is [0, 5, 10, 15]. What value is returned by any(my_list)? - answerTrue Assume that my_list is [0, 5, 10, 15]. What value is returned by all(my_list)? - answerFalse Assume that my_list is [0, 5, 10, 15]. What value is returned by min(my_list)? - answer0 Given the list nums = [[10, 20, 30], [98, 99]], what does nums[0][0] evaluate to? - answer10 Given the list nums = [[10, 20, 30], [98, 99]], what does nums[1][1] evaluate to? - answer99 Given the list nums = [[10, 20, 30], [98, 99]], what does nums[0] evaluate to? - answer[10,20,30] Create a nested list nums whose only element is the list [21, 22, 23]. - answernums = [[21,22,23]] 1) Assume the following list has been created: scores = [[75,100,82,76], [85,98,89,99], [75,82,85,5]] Write an indexing expression that gets the element from scores whose value is 100. - answerscores[0][1] scores = [[75,100,82,76], [85,98,89,99], [75,82,85,5]] How many elements does scores contain? (The result of len(scores)). - answer3 that are lists. Assume that the following code has been evaluated: nums = [1,1,2,3,5,8,13]. What is the result of nums[1:5]? - answer[1,2,3,5] nums = [1,1,2,3,5,8,13]. What is the result of nums[5:10]? - answer[8,13] nums = [1,1,2,3,5,8,13]. What is the result of nums [3:-1]? - answer[3,5,8 Given the following code: nums = [0,25,50,75,100]: The result of evaluating nums[0:5:2] is [25, 75]. - answerFalse [0,50,100]. Indexs 0 through 5 stepping 2. nums = [0,25,50,75,100] The result of evaluating nums[0:-1:3] is [0, 75]. - answerTrue. Index 0 going backwards stepping 3. Consider the following program: nums = [10, 20, 30, 40, 50] for pos, value in enumerate(nums): tmp = value / 2 if (tmp % 2) == 0: nums[pos] = tmp What's the final value of nums[1]? - answer10 Iterating over a list and deleting elements from the original list might cause a logical program error. - answerTrue A programmer can iterate over a copy of a list to safely make changes to that list. - answerTrue Twice the value of each element in the list variable x. - answer[i*2 for i in x] The absolute value of each element in x. Use the abs() function to find the absolute value of a number. - answer[abs(i) for i in x
Written for
- Institution
- WGU C949
- Course
- WGU C949
Document information
- Uploaded on
- February 8, 2024
- Number of pages
- 19
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
wgu c949 data structures and algorithms exam wit
Also available in package deal