1.
Complex loops can be most easily created by _________.
Correct Answer
C. Starting with a single case and working from the inside out
2.
How long/short should a loop be?
Correct Answer
A. Short enough to view all at once
Explanation
A loop should be short enough to view all at once because a long loop can make the code difficult to understand and maintain. By keeping the loop concise, it becomes easier to comprehend its purpose and identify any potential issues. Additionally, a shorter loop improves code readability and makes it more efficient, as unnecessary iterations are avoided.
3.
The preferred (easiest to understand) kind of loop control structure is __________.
Correct Answer
A. Loop with exit
Explanation
The preferred kind of loop control structure is a "loop with exit" because it allows the programmer to define a condition that, when met, will terminate the loop. This makes it easier to understand and control the flow of the loop, as it provides a clear and explicit way to exit the loop when a certain condition is satisfied.
4.
In McConnell’s opinion, ‘unusual’ control structures are __________.
Correct Answer
C. Useful when used with care in languages that do offer them
Explanation
In McConnell's opinion, "unusual" control structures are useful when used with care in languages that do offer them. This suggests that McConnell believes that these control structures can be beneficial, but only if they are used cautiously and in languages that support them. He does not advocate for avoiding them altogether or using them extensively without caution.
5.
In modern programing languages gotos __________.
Correct Answer
A. should usually be replaced by equivalent sequential construct, but are useful in some unusual cases
Explanation
In modern programming languages, the use of "gotos" should usually be replaced by an equivalent sequential construct, such as loops or conditional statements. This is because using "gotos" can make the code harder to understand and maintain. However, there are some unusual cases where "gotos" can be useful, such as when implementing low-level operations or handling exceptional situations. Therefore, while "gotos" are generally discouraged, they can still have their place in certain specific scenarios.
6.
Recursion is when a routine __________.
Correct Answer
B. calls itself
Explanation
Recursion is a process in which a routine calls itself. This means that within the routine, there is a statement or condition that triggers the routine to be called again, creating a loop-like behavior. This can be useful when solving problems that can be broken down into smaller parts or when a repetitive action needs to be performed. By calling itself, the routine can continue to execute until a certain condition is met, allowing for the completion of a larger task by solving smaller parts of it.
7.
Compared with logic-based and object-oriented approaches, the table-driven approach is usually more __________.
Correct Answer
D. Ecomomical
Explanation
The correct answer is "ecomomical". The table-driven approach is usually more economical compared to logic-based and object-oriented approaches. This means that it is more cost-effective and efficient in terms of resources and time required for implementation and maintenance.
8.
If data is not ‘well behaved’ and it is not possible to directly look up a value from a key, you may still be able to use a table driven-approach by __________.
Correct Answer
B. Duplicating information in the table
Explanation
In cases where the data is not 'well behaved' and direct lookup of a value from a key is not possible, duplicating information in the table can be a solution. By duplicating the information, you can create additional entries in the table that can be used to indirectly look up the desired value. This approach allows for more flexibility in retrieving data and can help overcome the limitations of a non-well-behaved dataset.
9.
In stair-step access tables the entries in the table are __________.
Correct Answer
B. Ranges for data
Explanation
Stair-step access tables are used to organize and present data in a structured manner. The entries in these tables represent ranges for the data. Each entry corresponds to a specific range of values, allowing users to easily locate and access the desired information. This format is particularly useful when dealing with large datasets or when presenting data in a concise and organized manner.
10.
A control structure that causes a group of statements to be executed multiple times is known as a(n) __________.
Correct Answer
B. Iteration
Explanation
An iteration is a control structure that causes a group of statements to be executed multiple times. It allows for the repetition of a certain set of statements until a specific condition is met. In this context, the other options (selection, sequence, structure) do not accurately describe a control structure that involves repeated execution.
11.
A set of statements executed in order is known as a(n) __________.
Correct Answer
B. Sequence
Explanation
A set of statements executed in order is known as a sequence. This means that the statements are executed one after another, without any branching or repetition. The term "sequence" implies a linear flow of execution, where each statement is executed exactly once in the specified order.
12.
The core of Structured Programming is the simple idea that a program should use ______.
Correct Answer
C. Multiple-entry, single-exit control structures
Explanation
Structured programming is a programming paradigm that promotes the use of control structures to improve the clarity and maintainability of code. The core idea is that a program should use multiple-entry, single-exit control structures. This means that a program should have multiple points of entry, such as loops or conditional statements, but should have only one point of exit, ensuring that the flow of control is clear and predictable. This approach helps to reduce complexity and makes the code easier to understand and debug.
13.
An effective software-quality program must include __________.
Correct Answer
D. A combination of techniques that apply to all stages of development
Explanation
An effective software-quality program must include a combination of techniques that apply to all stages of development. This means that the program should not rely solely on one specific technique, but rather use a variety of methods that can be applied throughout the entire development process. This approach ensures that quality is considered from the beginning of the project and continues to be monitored and improved as the software evolves. By using a combination of techniques, such as formal inspections, execution testing, and modelling or prototyping, the program can address different aspects of quality and minimize the risk of defects or issues in the final product.
14.
At which stage of a software development project should there be an emphasis on quality assurance?
Correct Answer
D. All of these answers are correct
Explanation
All of these answers are correct. Quality assurance should be emphasized at every stage of a software development project. It should be planned into the project from the beginning to ensure that quality standards are met throughout the development process. It should also be part of the technical fiber of the project as work continues, with ongoing testing and quality checks. Finally, it should punctuate the end of the project by verifying the quality of the final product before it is released.
15.
What is the General Principle of Software Quality?
Correct Answer
B. Improving quality reduces development cost
Explanation
Improving quality reduces development cost because when software quality is improved, there are fewer defects and issues that need to be fixed. This means that there is less rework and debugging required, which ultimately saves time and resources. Additionally, higher quality software leads to increased customer satisfaction and fewer customer complaints, which can reduce support and maintenance costs in the long run.