ITSC 1213 CHECKPOINT 1-3 QUESTIONS AND
CORRECT ANSWERS
It is recommended that we write a skeleton (outline) of the logic before coding a full
function, why? - Answers - It prevents mixing all logic in one haphazard chunk, making
the code easier to modify or debug
Why is it crucial to define data (eg. [title, rating, playCount]) before writing code? -
Answers - It prevents hidden assumptions about field positions, so adding new fields
later does not silently break old logic.
True or False: Data definitions are only necessary in typed languages like Java and
serve no purpose in Python. - Answers - False
Which concept is described by: "What the function guarantees or ensures once it
completes, given valid inputs." - Answers - Postconditions
Roster that is a list of lists. In your need to change a student's first name so you do
something along the lines roster[0][1]to reference that information. Which of the
following is the best explanation of why this is risky? - Answers - Changing the data
structure can break old assumptions about which index stores the first name.
After you make changes to the implementation of a function, why is it important to re-run
any tests that were created? - Answers - Because each new change can introduce new
bugs, so re-running ensures nothing broke.
In the context of the Design Recipe, which concept is described by: "Conditions that
must be true or satisfied before the function runs, such as height in [1..300]." - Answers
- Preconditions
In the context of the Design Recipe, which concept is described by: "The function name,
parameters (with types), and return type—describing how the function is called and
what it returns." - Answers - Method signature
True or False: If all existing tests pass after implementation, it guarantees we have
covered every possible edge case and no bugs remain. - Answers - False
Step 0 of the Design Recipe emphasizes: fully clarifying the problem before coding.
Which answer best captures why this is necessary? - Answers - You might otherwise
make assumptions about data formats or requirements leading to major rewrites if they
turn out to be incorrect.
, Which of the following best captures the main benefit of writing a clear purpose
statement when creating functions/methods? - Answers - It ensures anyone using the
function knows what it does, what inputs are valid, and what output to expect.
Which reason below best explains why it's helpful to create examples before (or during)
implementation? - Answers - Having examples clarifies expected behavior making it
easier to spot logic errors and handle edge cases before writing all the code.
Which concept is described by: "Possible invalid inputs or exceptions, and how the
function handles them (e.g., raises ValueError)." - Answers - Error Cases
In the context of the Design Recipe, which concept is described by: "A concise
explanation of what the function does, clarifying its main role or behavior." - Answers -
Purpose Statement
True or False: Once all your tests pass, you have 100% certainty there are no bugs left
in the code. - Answers - False
True or False: Once you read the problem or project prompt, you have everything you
need to start coding without revisiting the prompt or clarifying details. - Answers - False
System.out.println("Roses are red, ") // Line 1;System.out.println("Violets are blue, ") //
Line 2;System.out.print("Unexpected '}' ") // Line 3;System.out.print("on line 32. ") // Line
4;
The code segment is intended to produce the following output but may not work as
intended.
Roses are red,
Violets are blue,
Unexpected '}' on line 32. - Answers - Putting the semicolon after the ) on each line.
System.out.println("Java is ");
System.out.print("fun ");
System.out.print("and cool!");
What is printed as a result of executing the code segment? - Answers - Java is
fun and cool!
What data type would be most appropriate for representing the price of a pound of
bananas? - Answers - double
What data type would be most appropriate for representing the number of cars in a
parking deck? - Answers - int
What type should you use to hold the title of a book? - Answers - String
CORRECT ANSWERS
It is recommended that we write a skeleton (outline) of the logic before coding a full
function, why? - Answers - It prevents mixing all logic in one haphazard chunk, making
the code easier to modify or debug
Why is it crucial to define data (eg. [title, rating, playCount]) before writing code? -
Answers - It prevents hidden assumptions about field positions, so adding new fields
later does not silently break old logic.
True or False: Data definitions are only necessary in typed languages like Java and
serve no purpose in Python. - Answers - False
Which concept is described by: "What the function guarantees or ensures once it
completes, given valid inputs." - Answers - Postconditions
Roster that is a list of lists. In your need to change a student's first name so you do
something along the lines roster[0][1]to reference that information. Which of the
following is the best explanation of why this is risky? - Answers - Changing the data
structure can break old assumptions about which index stores the first name.
After you make changes to the implementation of a function, why is it important to re-run
any tests that were created? - Answers - Because each new change can introduce new
bugs, so re-running ensures nothing broke.
In the context of the Design Recipe, which concept is described by: "Conditions that
must be true or satisfied before the function runs, such as height in [1..300]." - Answers
- Preconditions
In the context of the Design Recipe, which concept is described by: "The function name,
parameters (with types), and return type—describing how the function is called and
what it returns." - Answers - Method signature
True or False: If all existing tests pass after implementation, it guarantees we have
covered every possible edge case and no bugs remain. - Answers - False
Step 0 of the Design Recipe emphasizes: fully clarifying the problem before coding.
Which answer best captures why this is necessary? - Answers - You might otherwise
make assumptions about data formats or requirements leading to major rewrites if they
turn out to be incorrect.
, Which of the following best captures the main benefit of writing a clear purpose
statement when creating functions/methods? - Answers - It ensures anyone using the
function knows what it does, what inputs are valid, and what output to expect.
Which reason below best explains why it's helpful to create examples before (or during)
implementation? - Answers - Having examples clarifies expected behavior making it
easier to spot logic errors and handle edge cases before writing all the code.
Which concept is described by: "Possible invalid inputs or exceptions, and how the
function handles them (e.g., raises ValueError)." - Answers - Error Cases
In the context of the Design Recipe, which concept is described by: "A concise
explanation of what the function does, clarifying its main role or behavior." - Answers -
Purpose Statement
True or False: Once all your tests pass, you have 100% certainty there are no bugs left
in the code. - Answers - False
True or False: Once you read the problem or project prompt, you have everything you
need to start coding without revisiting the prompt or clarifying details. - Answers - False
System.out.println("Roses are red, ") // Line 1;System.out.println("Violets are blue, ") //
Line 2;System.out.print("Unexpected '}' ") // Line 3;System.out.print("on line 32. ") // Line
4;
The code segment is intended to produce the following output but may not work as
intended.
Roses are red,
Violets are blue,
Unexpected '}' on line 32. - Answers - Putting the semicolon after the ) on each line.
System.out.println("Java is ");
System.out.print("fun ");
System.out.print("and cool!");
What is printed as a result of executing the code segment? - Answers - Java is
fun and cool!
What data type would be most appropriate for representing the price of a pound of
bananas? - Answers - double
What data type would be most appropriate for representing the number of cars in a
parking deck? - Answers - int
What type should you use to hold the title of a book? - Answers - String