1.
A good mnemonic name generally speaks to the __________.
Correct Answer
A. Problem
Explanation
A good mnemonic name generally speaks to the problem. This means that a well-chosen mnemonic name should clearly indicate or describe the problem that it is intended to help remember or recall. It should be specific and relevant to the problem at hand, making it easier for the user to associate the name with the problem and remember it when needed.
2.
If you modify a name with a computer-value qualifier like Total, Sum, Average, Max, Min, put the modifier at the __________ of the name.
Correct Answer
B. End
Explanation
When modifying a name with a computer-value qualifier like Total, Sum, Average, Max, Min, it is most appropriate to put the modifier at the end of the name. This is because it makes the name more descriptive and easier to understand. Placing the modifier at the end helps to clearly indicate the purpose or nature of the variable, making the code more readable and reducing the chances of confusion or errors.
3.
Loop index variables are best named __________.
Correct Answer
D. Count
Explanation
Loop index variables are typically best named "count" because they are commonly used to keep track of the number of iterations or the current position in a loop. Using a descriptive name like "count" helps to make the code more readable and understandable. Other options like "flag" or "temp" may not accurately convey the purpose of the variable, while using single-letter variables like "i", "j", or "k" can make the code harder to follow and understand.
4.
According to McConnell, the most common problems with arrays is __________?
Correct Answer
B. Attempting to access an element which is out of bounds
Explanation
The most common problem with arrays, according to McConnell, is attempting to access an element which is out of bounds. This means trying to access an index that does not exist in the array, either because it is negative or exceeds the array's length. This can lead to errors and unexpected behavior in the program.
5.
Localization is __________.
Correct Answer
A. Another word for internationalization
Explanation
Localization refers to the process of adapting a product or service to a specific language, culture, and region. It involves translating and adapting content, such as text, images, and user interfaces, to suit the preferences and requirements of a target market. Internationalization, on the other hand, focuses on designing and developing a product or service in a way that allows for easy localization. Therefore, the correct answer suggests that localization is another term used to describe the broader concept of internationalization.
6.
Magic numbers are __________.
Correct Answer
C. Literal numbers inside program that appear without explanation
Explanation
Magic numbers are literal numbers inside a program that appear without explanation. These numbers are often used directly in the code without any clear indication of their purpose or meaning. This can make the code difficult to understand and maintain, as it lacks clarity and context. It is generally considered a best practice to avoid using magic numbers and instead use named constants or variables to improve code readability and maintainability.
7.
Access routines __________.
Correct Answer
A. Are another name for .get routines
Explanation
Access routines are another name for .get routines. In programming, access routines are used to retrieve or access data from a class or object. These routines typically have the prefix "get" and are used to return the value of a private or protected variable. By using access routines, we can ensure that data encapsulation is maintained, as the actual data remains hidden and can only be accessed through these routines. Therefore, access routines and .get routines serve the same purpose of retrieving data from a class or object.
8.
To reduce the risk from using global data __________.
Correct Answer
C. develop a naming convention that makes global data obvious
Explanation
Developing a naming convention that makes global data obvious helps to reduce the risk from using global data. This means that by using clear and descriptive names for global variables, it becomes easier for developers to understand and manage them, reducing the chances of confusion or unintended misuse. This naming convention can help improve code readability and maintainability, making it easier to identify and address any potential risks associated with global data.
9.
It can be useful to use global data for __________.
Correct Answer
B. Emulation of named constants
Explanation
Using global data for emulation of named constants can be useful in order to keep all access to the data at the same level of abstraction. By using global data, the constants can be easily accessed and used throughout the program without the need for repetitive code or multiple instances of the same constant. This helps to improve code readability and maintainability.
10.
'Routine parameter' means __________.
Correct Answer
D. The information passed into a routine
Explanation
A routine parameter refers to the information that is passed into a routine. It can be any value or variable that is provided to the routine when it is called. This allows the routine to perform operations using the provided information.
11.
A program should be read in __________ order.
Correct Answer
B. Top to bottom
Explanation
A program should be read in top to bottom order because programming languages are designed to be executed sequentially. The code is written in a logical order, with each line or block of code building upon the previous ones. Reading the program from top to bottom ensures that the instructions are executed in the intended order, allowing the program to function as intended.
12.
Code which needs to be in a specific order contains __________.
Correct Answer
A. Dependencies
Explanation
Code that needs to be in a specific order often contains dependencies. Dependencies refer to the relationships and requirements between different components or modules of the code. These dependencies determine the order in which the code should be executed to ensure that all the necessary dependencies are satisfied. By organizing the code based on dependencies, developers can ensure that the code runs smoothly and without any errors.
13.
A conditional is a statement that __________.
Correct Answer
D. Controls the execution of other statements
Explanation
A conditional is a statement that controls the execution of other statements. It allows the program to make decisions based on certain conditions. Depending on whether the condition is true or false, the program will execute different blocks of code or skip certain statements altogether. By using conditionals, programmers can create more flexible and dynamic programs that can adapt to different scenarios and user inputs.
14.
An incorrect branch is most often caused by using __________.
Correct Answer
C. < or > instead of =
Explanation
An incorrect branch is most often caused by using < or > instead of =. This is because < and > are comparison operators used to check if one value is less than or greater than another value, whereas = is the assignment operator used to assign a value to a variable. Therefore, using < or > instead of = in a branch condition can lead to incorrect logic and potentially unexpected results.
15.
How many elseif clauses can be put in conditional code?
Correct Answer
B. as many as are needed
Explanation
There is no specific limit to the number of elseif clauses that can be put in conditional code. The number of elseif clauses can vary depending on the specific requirements and conditions of the code. Therefore, as many elseif clauses can be used as are needed to fulfill the desired logic and conditions of the code.