1. What process locates a specific set of characters in a data set?

a. data collection
b. data analysis
c. pattern matching
d. iteration

2. What is an example of a branching control structure?

a. for loop
b. if…then
c. while loop
d. do loop

3. How do we generally alter the parameter to get to the base case?

a. adding one to the parameter
b. decrementing the parameter
c. setting the parameter to zero
d. incrementing the parameter

4. When performing a recursion, how do you describe the act of a function calling itself?(1 point)

a. forward phase
b. recursive case
c. base case
d. backward phase

5. The following code is for a Python function to represent a recursive function to find the factorial of an integer

def factorial(x):
if x == 1:
return 1
else:
return (x * factorial(x-1))
num = 3

print("The factorial of", num, "is", factorial(num))

Which code reflects the recursive case?

a. else:
return (x * factorial(x - 1))

b. if x == 1:
return 1

c. num = 3

d. print("The factorial of", num, "is", factorial(num))

1. The process that locates a specific set of characters in a data set is c. pattern matching.

2. An example of a branching control structure is b. if…then.

3. To alter the parameter to get to the base case, we generally use b. decrementing the parameter.

4. When performing recursion, the act of a function calling itself is referred to as b. recursive case.

5. The code that reflects the recursive case in the given Python function is a. else: return (x * factorial(x - 1)).

1. The process that locates a specific set of characters in a data set is called pattern matching. To perform pattern matching, you can use various techniques such as regular expressions or string searching algorithms like the Knuth-Morris-Pratt algorithm. These techniques involve comparing the characters in the data set to a specific pattern or set of characters you are looking for.

2. An example of a branching control structure is the if...then statement. In programming, the if...then statement allows you to execute a certain block of code only if a specified condition is true. It provides a way to make decisions and control the flow of the program based on different conditions.

3. To alter the parameter to get to the base case in recursion, the common approach is to decrement the parameter. The base case represents the termination condition for the recursive function. By decrementing the parameter, you are moving towards reaching the base case and eventually ending the recursive process.

4. When a function calls itself in recursion, it is referred to as the recursive case. In recursion, a problem is divided into smaller subproblems, and this division is typically done by calling the same function again with a smaller input. The recursive case represents the part of the code where the function calls itself to solve the smaller subproblem.

5. The code that reflects the recursive case in the given Python function is:

a. else:
return (x * factorial(x-1))

In this code, when the value of x is not equal to 1, the function calls itself with the parameter x-1. This recursive call allows the function to solve a smaller subproblem by calculating the factorial of the smaller value of x.