AP CSP WRITTEN RESPNSES Flashcards

1
Q

Identify an expected user of your program. Describe one way your program’s design meets the needs of the user.

A

An expected user of my program would most likely be a person who is looking to play a fun number guessing game. The user would most likely enjoy working with numbers and guessing games based on luck.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe one piece of documentation that would be appropriate to include with or in your program.
Describe the intended purpose of this documentation by identifying who would use it and what they would do with it.

A

Comments are one piece of documentation that would be appropriate to include in my program.
Comments allow a programmer to add information in the source code that other programmers/developers
could see. One person that would benefit from the comments would be a developer who is using my
program. I could provide comments to identify what each function accomplishes within my program. This
would allow the person to know what my function does without having to trace the code to figure it out.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Explain how you used or could have used feedback, testing, or reflection in the development of your program.

A

I could have used feedback in program in a couple of ways in the development of my program. First, I
could use feedback from a user to see if they understand how to use the program. I could see if my
instructions are clear and they understand what values they should input. The second way is that I could
use a user’s feedback to see if the output makes sense to them. This will allow me to see if I need to refine
my output to help the user better understand certain functionalities and parts of my program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe the problem that your program was created to address or the creative expression it pursues.

A

It allows users to provide the user entertainment with a simple guessing game.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain how you used or could have used testing in the development of your program.

A
  • I could of have used testing in a couple of ways in the development of my program. One way I could
    have used testing is to check for any misunderstanding that a user might have with the instructions or
    values they should input. Another way I could have used testing is to check the program for various input
    to make sure that it doesn’t crash and to confirm if the outputs match the inputs.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Explain how you used or could have used reflection in the development of your program.

A
  • I could have used reflection in the development of my program to help identify any changes that could be
    made. I can use the results from feedback and testing to see if there are aspects of my program that can
    lead to confusion, misuse, or incorrect outputs. I can also reflect on the changes I have made by reviewing
    my program documentation to see if a change I made could have caused an issue or lead to a misunderstanding of how to use the program
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Consider the first iteration statement included in the Procedure section of your Personalized Project Reference. Identify the number of times the body of your iteration statement will execute. Describe a condition or error that would cause your iteration statement to not terminate and cause an infinite loop. If no such condition or error exists, explain how the loop could be modified to cause an infinite loop.

A

The body of the iteration statement will execute 3 or 4 times, this will depend on the random integer chosen. In order to create an infinite loop, the return statement will have to be taken out, as a return within a function causes it to stop, and return to the main code. Therefore, it will continue to run if you replace it with print listing1 rather than returning listing1.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Consider the first conditional statement in the Procedure section of your Personalized Project Reference. Write an equivalent Boolean expression for this conditional statement.

A

if (not=”hard”) and if (not=”medium”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Consider the code segment in part (ii) of the List section of your Personalized Project Reference that shows how your list is being used. Explain in detailed steps how this code segment works. Your explanation must be detailed enough for someone else to write the code segment.

A

the code calls to the option of which the user uses

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Consider the procedure included in part (i) of the Procedure section of your Personalized Project Reference. Describe a change to your procedure that will result in a run-time error. Explain why this change will result in a run-time error.

A

x1 = 0
y1 = r.randint(3,4)
while (int(x1) < int(y1)):
changing x1=5 will cause a runtime error because if x1=1 it will be greater than y1 automatically

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Consider the procedure identified in part (i) of the Procedure section of your Personalized Project Reference. Write a call to your procedure with specific argument(s) that you could use for testing this procedure. Describe the program functionality that is related to this call.

A

The specific call would be remove(“1”). The remove function will remove values from the list based on
the comparison to a value. The comparison options are equal, less than, or greater than. The argument
value of “1” represents removing values using the equal to comparison. This call will allow me to test this
specific functionality.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Consider the procedure identified in part (i) of the Procedure section of your Personalized Project Reference. Identify a strategy, other than using test cases, that you can use to test the correctness of your procedure. Describe how you would use this strategy.

A

One strategy that I could have used to test my code other than using test cases is code tracing. I could
create a list and let num equal “1”, then “2”, then “3”. I could trace through the code using these values to
see if the lines of code analyze the correctness of the users input lists. I could also ask a fellow coder to complete the process too, then we could compare our
results

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Consider the procedure identified in part (i) of the Procedure section of your Personalized Project Reference. Passing different values as arguments to a procedure can cause different segments of code to execute. Based on one of your arguments, describe where you could insert output statements in your procedure to test whether a block of code is executed or not.My procedure remove has one parameter called diff. If the argument is equal to “easy” then the first
conditional statement would be true and the code in the statement should execute. I could insert a print
statement with the message “next step guess” below the statement if(option == “easy”): so I can confirm if the
argument option is equal to “easy” the code will execute.

A

My procedure remove has one parameter called diff. If the argument is equal to “easy” then the first
conditional statement would be true and the code in the statement should execute. I could insert a print
statement with the message “next step guess” below the statement if(option == “easy”): so I can confirm if the
argument option is equal to “easy” the code will execute.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Suppose you are provided with a procedure called isEqual (value1, value2). The procedure returns True if the two parameters value1 and value2 are equal in value and returns false otherwise. Using the list you identified in the List section of your Personalized Project Reference, explain in detailed steps an algorithm that uses isEqual to count the number of times a certain value appears in your list. Your explanation must be detailed enough for someone else to write the program code.

A
  1. Create a for loop that runs through the list
  2. Use an if statement with isEqual as the condition comparing the two values
  3. Create a variable outside the for and set it to 0
  4. Have the variable increase by 1 inside the if
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Consider the list identified in the List section of your Personalized Project Reference. Explain how you would need to adjust this part of your program if the list was not included in your code.

A

Because the list is user inputted I would need to create another random list using ra.list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Consider the procedure identified in part (i) of the Procedure section of your Personalized Project Reference. Procedures are often used to organize larger problems into subproblems or smaller tasks. Identify the subproblem being solved or task that is being accomplished by your procedure. Explain how the procedure is used to accomplish the overall functionality of your program.

A

This procedure/function solves optimizes my code by consoldiating the difficulty leval. When called it allows the use tot input their desired diffuclty and based on ther choice creates a random list which then the user will play a game with

17
Q

Consider the procedure identified in part (i) of the Procedure section of your Personalized Project Reference. Explain how your program could be written differently if one of your parameters was removed from your procedure.

A

If there was no parameter, the variable “diff” could be accessed inside the function by using global.