ACCURATE ANSWERS
1. What are the expected outputs of the flowchart when the inputs are 3, 5,
and -1?
6 10
56
35
10 3
2. Given float x = 3.0. Which expression evaluates to 2.0?
x/3*2+2
x / 2 + 0. + .25
x + 0.
x - 2/3
3. Describe how the function converts hours and minutes into seconds.
The function converts hours to minutes and then to seconds
without any multiplication.
The function multiplies the number of hours by 3600 and adds
the minutes multiplied by 60 to get the total seconds.
The function uses a fixed value of 60 for both hours and minutes.
The function simply adds hours and minutes together to get
seconds.
,4. Describe the significance of the expression (x >= 18) and (x <= 24) in the
context of defining age ranges in programming.
The expression indicates that x can only be an even number.
, The expression is used to validate if x is a string type.
The expression checks if x is less than 18 or greater than 24.
The expression (x >= 18) and (x <= 24) defines a valid age range
for x, ensuring that x falls within the specified limits.
5. Interpret the given text: 'Shake bulb; if it rattles, replace it.' What does
this imply about the nature of algorithms?
It shows that algorithms are only applicable in mathematical
contexts.
It indicates that algorithms can be vague and open to
interpretation.
It illustrates that algorithms consist of clear instructions that
lead to a decision or action.
It suggests that algorithms do not require any specific order of
operations.
6. What is the primary goal of the design phase in the agile approach?
To test the software for bugs
To deploy the final product
To gather user requirements
To create a list of components needed for the project
7. Describe the purpose of initializing the loop variable 'y' in the provided
pseudocode.
Initializing 'y' to 0 defines the maximum value for 'y'.
Initializing 'y' to 0 prevents the loop from running.
Initializing 'y' to 0 determines the final output of 's'.
Initializing 'y' to 0 sets the starting point for the loop to
, execute.
8. A variable should hold a person's height in meters. Which data type
should the variable be?
Integer
String
Float
Boolean
9. If you modify the function to return x to the power of 4 instead of x
cubed, what would be the output if the input x is 2?
16
4
2
8
10. What are the three main components depicted in a class diagram?
Classes, attributes, and methods
Modules, packages, and interfaces
Objects, properties, and events
Functions, variables, and loops
11. Describe how parentheses affect the evaluation of expressions in
programming.
Parentheses are only used in function declarations.
Parentheses are used to define variable types.
Parentheses indicate the start of a loop.