1.
Programmers use a variety of special languages, called programming languages, to communicate with the computer.
Correct Answer
A. True
Explanation
Programmers indeed use programming languages to communicate with computers. These languages are specifically designed to provide instructions and commands that the computer can understand and execute. By using programming languages, programmers can write code to create software, develop applications, and perform various tasks on a computer. Therefore, the statement "Programmers use a variety of special languages, called programming languages, to communicate with the computer" is true.
2.
The assembly languages represent the only way to communicate directly with the computer.
Correct Answer
B. False
Explanation
Assembly languages are not the only way to communicate directly with the computer. There are other programming languages such as C, C++, Java, etc., which can also communicate directly with the computer through compilers or interpreters. Assembly languages are low-level languages that provide a more direct representation of the computer's machine code, but they are not the only means of communication.
3.
High-level languages are a vast improvement over machine and assembly languages because they allow the programmer to use instructions that more closely resemble the English language.
Correct Answer
A. True
Explanation
High-level languages are indeed a significant improvement over machine and assembly languages because they enable programmers to write instructions that are more similar to the English language. This makes the code easier to read, write, and understand. High-level languages use keywords and syntax that are familiar to humans, making it simpler for programmers to translate their ideas into code. This abstraction allows for faster development and reduces the likelihood of errors. Therefore, the statement is true.
4.
When writing a procedure-oriented program, the programmer concentrates on the major tasks that the program needs to perform.
Correct Answer
A. True
Explanation
In a procedure-oriented program, the programmer focuses on breaking down the program into smaller tasks or procedures. These procedures are designed to perform specific actions or tasks within the program. By concentrating on these major tasks, the programmer can organize and structure the program in a way that makes it easier to understand and maintain. This approach allows for better code reusability and modularity, as each procedure can be used in multiple parts of the program. Therefore, the statement "When writing a procedure-oriented program, the programmer concentrates on the major tasks that the program needs to perform" is true.
5.
When used in a program, the repetition structure directs the computer to repeat one or more instructions until some condition is met.
Correct Answer
A. True
Explanation
The repetition structure in a program allows the computer to execute a set of instructions repeatedly until a certain condition is satisfied. This is a fundamental concept in programming and is often used to perform tasks such as iterating over a list of items, processing input until a specific value is entered, or executing a block of code a certain number of times. By repeating instructions, programmers can efficiently automate processes and solve complex problems. Therefore, the statement "True" accurately describes the role of the repetition structure in a program.
6.
Programs written in a high-level language can be used in many different types of computers.
Correct Answer
A. True
Explanation
Programs written in a high-level language are designed to be portable and can be used on different types of computers. High-level languages are designed to be independent of the specific hardware or operating system, allowing the code to be easily executed on different platforms. This portability is one of the main advantages of high-level languages, as it saves time and effort by allowing developers to write code once and run it on multiple systems. Therefore, the statement "Programs written in a high-level language can be used in many different types of computers" is true.
7.
You can find the sequence structure in every program.
Correct Answer
A. True
Explanation
Every program follows a sequence structure, meaning that the instructions are executed in a sequential order. This allows the program to perform tasks step by step, ensuring that each instruction is executed before moving on to the next one. The sequence structure is a fundamental concept in programming and is present in all programs, making the statement "True" correct.
8.
Desk-checking is also called pencil-tracing.
Correct Answer
B. False
Explanation
Desk-checking and pencil-tracing are two different concepts. Desk-checking refers to the process of manually reviewing and verifying code or algorithms, while pencil-tracing is a technique used in debugging to track the flow of code by manually following it with a pencil or pointer. Therefore, the statement that desk-checking is also called pencil-tracing is false.
9.
Eliminating errors at the pencil and paper stage makes it much easier to produce a correct program in the later steps of the problem-solving process.
Correct Answer
A. True
Explanation
Eliminating errors at the pencil and paper stage refers to thoroughly planning and designing a program on paper before actually coding it. This allows for identifying and correcting any potential mistakes or issues before starting the coding process. By doing so, it becomes easier to produce a correct program in the later steps of problem-solving as the foundation and structure of the program have already been carefully thought out. This approach saves time and effort in the long run, as it reduces the need for extensive debugging and troubleshooting during the coding phase.
10.
When creating a computer solution to a problem, the first three steps of the problem-solving process can usually be skipped.
Correct Answer
B. False
Explanation
The statement suggests that the first three steps of the problem-solving process can usually be skipped when creating a computer solution. However, this is not true. The problem-solving process is a crucial part of creating a computer solution as it helps in identifying, analyzing, and understanding the problem before moving on to finding a solution. Skipping these initial steps can lead to a poorly designed and ineffective computer solution. Therefore, the correct answer is False.
11.
After creating the program, the programmer desk-checks the program; this is the sixth step in the problem-solving process for creating a computer program.
Correct Answer
B. False
Explanation
The correct answer is False because desk-checking the program is not the sixth step in the problem-solving process for creating a computer program. Desk-checking is a method of manually reviewing the program's logic and code for errors or bugs, but it is typically done throughout the development process rather than as a specific step. The sixth step in the problem-solving process is usually testing and debugging the program to ensure it functions correctly.
12.
Most algorithms begin with an instruction that enters the input items into the computer.
Correct Answer
A. True
Explanation
Most algorithms require input in order to perform their calculations or operations. Therefore, it is common for algorithms to begin with an instruction that allows the user to enter the input items into the computer. This input is necessary for the algorithm to work correctly and produce the desired output.
13.
Pseudocode is standardized among programmers.
Correct Answer
B. False
Explanation
Pseudocode is not standardized among programmers. It is a way of representing algorithms using a combination of natural language and programming language-like syntax. There is no set standard for writing pseudocode, and different programmers may use different conventions and styles. Therefore, the statement that pseudocode is standardized among programmers is false.
14.
When planning an algorithm, you need to create both a flowchart and pseudocode.
Correct Answer
B. False
Explanation
When planning an algorithm, it is not necessary to create both a flowchart and pseudocode. While both tools can be helpful in designing and representing an algorithm, they are not always required. Some developers prefer to use only pseudocode, which is a way of writing out the steps of an algorithm in plain English or a programming language-like syntax. Others may choose to use only a flowchart, which uses symbols and arrows to represent the flow of the algorithm. Ultimately, the choice of which tool to use, or whether to use both, depends on the preferences and needs of the developer.
15.
You desk-check an algorithm to verify that it is not missing any steps and that the existing steps are correct and in the proper order.
Correct Answer
A. True
Explanation
Desk-checking is a method of manually reviewing an algorithm or program to ensure that all steps are included and in the correct order. It involves mentally executing the algorithm step by step, simulating the inputs and expected outputs. By doing so, any missing steps or errors in the existing steps can be identified and corrected. Therefore, the statement "True" is the correct answer as desk-checking is indeed used to verify the completeness and correctness of an algorithm.
16.
Before you begin the desk-check, you first choose a set of sample data for the input values, which you then use to manually compute the expected output values.
Correct Answer
A. True
Explanation
Before conducting a desk-check, it is necessary to select a set of sample data for the input values. This set of data is used to manually calculate the expected output values. This process allows for a comparison between the expected and actual outputs, helping to identify any errors or inconsistencies in the program. Therefore, the statement is true.
17.
You should test an algorithm with invalid data because users sometimes make mistakes when entering data.
Correct Answer
A. True
Explanation
Testing an algorithm with invalid data is important because it allows us to identify and handle any errors or exceptions that may occur when users make mistakes while entering data. By testing with invalid data, we can ensure that the algorithm can handle these unexpected inputs gracefully and provide appropriate feedback or error messages to the user. This helps to improve the overall user experience and prevent potential issues or crashes in the system.
18.
Programmers typically desk-check a program using the same sample data used to desk-check the algorithm.
Correct Answer
A. True
Explanation
Programmers typically desk-check a program using the same sample data used to desk-check the algorithm because it allows them to verify the correctness of the program's logic and ensure that it produces the expected output. By using the same sample data, programmers can compare the actual output of the program with the expected output, identifying any discrepancies or errors in the code. This process helps in debugging and refining the program before it is executed with real data. Therefore, the given answer "True" is correct.
19.
In most programming languages, the names of processing items can contain letters, numbers, underscores, punctuation characters or spaces.
Correct Answer
B. False
Explanation
In most programming languages, the names of processing items cannot contain spaces.
20.
You should perform several desk-checks, using different data, to make sure that the program is correct.
Correct Answer
A. True
Explanation
Performing desk-checks using different data is a recommended practice to ensure the correctness of a program. By testing the program with various inputs, it helps identify any potential errors or bugs in the code. This process allows the programmer to verify that the program produces the expected results and behaves as intended. Therefore, the statement "You should perform several desk-checks, using different data, to make sure that the program is correct" is true.
21.
Errors in a program are called hacks.
Correct Answer
B. False
Explanation
The statement "Errors in a program are called hacks" is false. Errors in a program are not called hacks. Hacks refer to clever or unconventional solutions to a problem, often involving workarounds or shortcuts. Errors in a program are typically referred to as bugs or glitches.
22.
Logic errors are easier to find than syntax errors.
Correct Answer
B. False
Explanation
Syntax errors are easier to find than logic errors. Syntax errors occur when there are mistakes in the structure or formatting of the code, such as missing or misplaced punctuation or incorrect keyword usage. These errors are usually detected by the compiler or interpreter and can be easily identified by error messages. On the other hand, logic errors occur when the code does not produce the desired output or behaves unexpectedly due to flaws in the algorithm or reasoning. Detecting logic errors often requires careful analysis and testing of the code's behavior, making them more difficult to find than syntax errors.
23.
The file containing the source code is called the source file.
Correct Answer
A. True
Explanation
The source file is the file that contains the source code, which is the human-readable version of a computer program. It typically has a file extension such as .cpp for C++ or .java for Java. Therefore, it is correct to say that the file containing the source code is called the source file.
24.
Comments are statements in C++.
Correct Answer
B. False
Explanation
The given answer is "False" because the statement "Comments are statements in C++" is incorrect. In C++, comments are not considered as statements. Comments are used to provide additional information or explanations in the code and are ignored by the compiler during the compilation process. They are useful for making the code more readable and understandable for other programmers.
25.
Names in C++ are case sensitive.
Correct Answer
A. True
Explanation
In C++, names are case sensitive, which means that the uppercase and lowercase letters in a name are considered distinct. This means that "variable" and "Variable" are two different identifiers in C++. Therefore, if we declare a variable with a lowercase letter and try to access it using an uppercase letter, the compiler will treat it as a different variable and may result in an error. Hence, the correct answer is true.
26.
The binary number system uses only the two digits 0 and 1.
Correct Answer
A. True
Explanation
The binary number system is a base-2 number system, which means it only uses two digits, 0 and 1, to represent numbers. In this system, each digit represents a power of 2, and the value of a number is determined by the presence or absence of these digits. Therefore, the statement that the binary number system uses only the two digits 0 and 1 is true.
27.
Variables declared using the string data type usually are initialized to the empty string.
Correct Answer
A. True
Explanation
Variables declared using the string data type are usually initialized to the empty string because it is a common practice to start with an empty string and then add or concatenate values to it as needed. This allows for flexibility in manipulating and storing string data. Therefore, the correct answer is true.
28.
The C++ compiler treats all numeric literal constants containing a decimal place as a double data type.
Correct Answer
A. True
Explanation
The C++ compiler treats all numeric literal constants containing a decimal place as a double data type. This means that if a number includes a decimal point, it will be considered as a double by default.
29.
A data type ranks higher than another data type if it can store larger numbers.
Correct Answer
A. True
Explanation
In programming, data types determine the type of values that can be stored in a variable. When comparing data types, a data type is considered to rank higher if it can store larger numbers. This means that it has a greater range or capacity to hold larger numerical values. Therefore, the statement "A data type ranks higher than another data type if it can store larger numbers" is true.
30.
A variable can store only one value at a time.
Correct Answer
A. True
Explanation
This statement is true because in programming, a variable is used to store a single value at a time. When a new value is assigned to the variable, it replaces the previous value. Therefore, a variable can hold only one value at any given point in time.
31.
If an expression contains more than one operator having the same priority, those operators are evaluated from right to left.
Correct Answer
B. False
Explanation
In an expression with multiple operators of the same priority, the operators are actually evaluated from left to right, not right to left. This means that the operators are processed in the order they appear in the expression, starting from the leftmost operator. Therefore, the correct answer is False.
32.
The newline character in C++ is ‘\N’.
Correct Answer
B. False
Explanation
The newline character in C++ is actually represented by the escape sequence '\n', not '\N'. Therefore, the correct answer is false.
33.
You use the selection structure when you want a program to make a decision or comparison and then select one of two paths, depending on the result of that decision or comparison.
Correct Answer
A. True
Explanation
The selection structure is used in programming when you want to create a decision-making process. It allows the program to compare different values or conditions and then choose one of two paths based on the result of that comparison. This is done using conditional statements such as if-else or switch-case. Therefore, the statement "You use the selection structure when you want a program to make a decision or comparison and then select one of two paths, depending on the result of that decision or comparison" is true.
34.
And if selection structure contains two sets of instructions: one set is processed when the condition is true and the other set is processed when the condition is false.
Correct Answer
B. False
Explanation
This statement is false. In a selection structure, also known as an if-else statement, there are two sets of instructions, but they are not processed based on the condition being true or false. Instead, one set of instructions is executed when the condition is true, and the other set is executed when the condition is false. So, the correct answer is false.
35.
In C++, you use the if statement to code the if and if/else forms of the selection structure.
Correct Answer
A. True
Explanation
The if statement in C++ is used to implement both the if and if/else forms of the selection structure. It allows the program to make decisions based on certain conditions. The if statement evaluates a condition and executes a block of code if the condition is true. The if/else form allows the program to execute different blocks of code based on whether the condition is true or false. Therefore, the statement "True" is correct as it accurately describes the usage of the if statement in C++.
36.
In C++, you can have an else clause without matching the if clause.
Correct Answer
B. False
Explanation
In C++, it is not possible to have an else clause without a matching if clause. The else clause is used to specify an alternative block of code that should be executed if the condition in the if clause is false. Without an if clause, there is no condition to evaluate and the else clause becomes meaningless. Therefore, the correct answer is False.
37.
In C++, comparisons with a precedence number of 2 are performed before comparisons with a precedence number of 1.
Correct Answer
B. False
Explanation
In C++, comparisons with a precedence number of 2 are not performed before comparisons with a precedence number of 1. The precedence of operators in C++ determines the order in which they are evaluated. Operators with higher precedence are evaluated before operators with lower precedence. However, the precedence number does not determine the order of comparisons.
38.
You should never use the equality operator to compare two floating-point numbers.
Correct Answer
A. True
Explanation
Floating-point numbers are represented in binary, which can lead to rounding errors. Due to these rounding errors, two floating-point numbers that should be equal may not be exactly equal when compared using the equality operator. Instead, it is recommended to use a tolerance or a function that compares the numbers within a certain range to account for these rounding errors. Therefore, it is true that you should never use the equality operator to compare two floating-point numbers.
39.
A local variable can be used only within the statement block in which it is declared.
Correct Answer
A. True
Explanation
A local variable is a variable that is declared within a specific block of code, such as a function or a loop. It is only accessible and can only be used within that block of code. Once the block of code is exited, the local variable is no longer accessible. Therefore, the statement that a local variable can be used only within the statement block in which it is declared is true.
40.
Programmers refer to the process of verifying that the input data is within the expected range as data validation.
Correct Answer
A. True
Explanation
Programmers refer to the process of verifying that the input data is within the expected range as data validation. This means that programmers check if the input data meets certain criteria, such as being within a specific range or format, before using it in a program. By validating the data, programmers can ensure that the program functions correctly and does not encounter errors or unexpected behavior due to invalid input. Therefore, the statement "Programmers refer to the process of verifying that the input data is within the expected range as data validation" is true.
41.
You use the selection structure when you want a program to make a decision or comparison and then select one of two paths, depending on the result of that decision or comparison.
Correct Answer
A. True
Explanation
The selection structure is used in programming when there is a need to make a decision or comparison and then choose one of two paths based on the result of that decision or comparison. This allows the program to execute different sets of instructions depending on certain conditions. Therefore, the statement "True" is correct as it accurately describes the purpose and functionality of the selection structure.
42.
The false path of a selection structure cannot include other selection structures.
Correct Answer
B. False
Explanation
The false path of a selection structure can indeed include other selection structures. This means that within the false path, there can be nested if-else statements or other selection structures. This allows for more complex decision-making within the program.
43.
It is easy to detect if you have incorrectly used a logical operator in the outer selection structure’s condition when a nested selection structure was needed because the error will always appear during your first desk-check.
Correct Answer
B. False
Explanation
This statement is false. The error of incorrectly using a logical operator in the outer selection structure's condition when a nested selection structure was needed may not always appear during the first desk-check. It could potentially be detected at a later stage or during testing.
44.
When nesting selection structures, you can interchangeably put the secondary decision in the outer selection structure,and put the primary decision in the nested selection structure.
Correct Answer
B. False
Explanation
When nesting selection structures, the primary decision should be placed in the outer selection structure, and the secondary decision should be placed in the nested selection structure. This allows for proper flow and logical organization of the code. Therefore, the given statement is incorrect.
45.
Some algorithms require selection structures that are capable of choosing from several alternatives.
Correct Answer
A. True
Explanation
Some algorithms require selection structures that are capable of choosing from several alternatives. This means that in certain situations, the algorithm needs to make a decision based on certain conditions or criteria. By using selection structures, the algorithm can evaluate these conditions and choose the appropriate alternative to proceed with. This is why the statement "Some algorithms require selection structures that are capable of choosing from several alternatives" is true.
46.
In a flowchart, the if/else and switch selection structures are represented in exactly the same way.
Correct Answer
B. False
Explanation
The statement is false because in a flowchart, the if/else and switch selection structures are represented differently. In an if/else structure, there is a diamond shape with the condition written inside, and two branches representing the true and false outcomes. In a switch structure, there is a rectangle shape with multiple arrows coming out of it, each representing a different case. Therefore, the if/else and switch selection structures are not represented in exactly the same way in a flowchart.
47.
In a flowchart, the switch diamond contains a condition requiring a true or false answer.
Correct Answer
B. False
Explanation
In a flowchart, the switch diamond does not contain a condition requiring a true or false answer. The switch diamond is used to represent multiple possible paths based on different conditions, rather than a simple true or false condition.
48.
In a flowchart, the switch diamond contains an expression whose value determines which path is chosen.
Correct Answer
A. True
Explanation
The switch diamond in a flowchart contains an expression that evaluates to a certain value. This value determines which path or branch of the flowchart is chosen to be executed next. If the expression evaluates to a true or valid value, then the corresponding path is chosen. If it evaluates to false or invalid, a different path is chosen. Therefore, the statement that the switch diamond contains an expression whose value determines which path is chosen is true.
49.
In C++, the switch statement ends with a square bracket ( ] ).
Correct Answer
B. False
Explanation
In C++, the switch statement ends with a closing curly brace ( } ) not a square bracket ( ] ). The square bracket is used to close an array or an index in C++. Therefore, the correct answer is False.
50.
You can include as many case clauses as necessary in a switch statement.
Correct Answer
A. True
Explanation
A switch statement is a control flow statement that allows a program to evaluate an expression and execute different code blocks based on different possible values of the expression. The case clauses in a switch statement are used to define the different possible values of the expression and the corresponding code blocks to be executed. Since there can be multiple possible values and code blocks, it is necessary to include as many case clauses as needed in a switch statement. Therefore, the given statement is true.