C Plus Plus Exam: True Or False Quiz!

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Mrmirante
M
Mrmirante
Community Contributor
Quizzes Created: 2 | Total Attempts: 4,315
| Attempts: 3,657 | Questions: 96
Please wait...
Question 1 / 96
0 %
0/100
Score 0/100
1. Programmers use a variety of special languages, called programming languages, to communicate with the computer.  

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.

Submit
Please wait...
About This Quiz
C Plus Plus Exam: True Or False Quiz! - Quiz

This C++ True or False quiz assesses knowledge on programming languages and concepts, focusing on the unique aspects and structures of C++.

Personalize your quiz and earn a certificate with your name on it!
2. 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.  

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.

Submit
3. The binary number system uses only the two digits 0 and 1.  

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.

Submit
4. 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.  

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.

Submit
5. The file containing the source code is called the source file.  

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.

Submit
6. If different sections of a program need to perform the same task, it is more efficient to enter the appropriate code once, in a function, and then call the function to perform its task when needed.  

Explanation

When different sections of a program need to perform the same task, it is more efficient to enter the appropriate code once in a function and then call the function when needed. This avoids code duplication and allows for easier maintenance and updates. By encapsulating the task within a function, it can be reused multiple times without having to rewrite the code each time. This improves code readability, reduces the chances of errors, and enhances the overall efficiency of the program. Therefore, the statement is true.

Submit
7. 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.  

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.

Submit
8. Functions allow the programmer to avoid duplicating code in different parts of a program.  

Explanation

Functions are reusable blocks of code that can be called multiple times in a program. By using functions, programmers can write a piece of code once and then call it whenever needed, instead of duplicating the same code in different parts of the program. This helps in reducing redundancy, improving code readability, and making the program more modular and maintainable. Therefore, the statement "Functions allow the programmer to avoid duplicating code in different parts of a program" is true.

Submit
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.  

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.

Submit
10. In a flowchart, the switch diamond contains an expression whose value determines which path is chosen.  

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.

Submit
11. You can include as many case clauses as necessary in a switch statement.  

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.

Submit
12. 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.  

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.

Submit
13. Some algorithms require selection structures that are capable of choosing from several alternatives.  

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.

Submit
14. Each variable you declare in a program has both a value and a unique address that represents the location of the variable in the computer's internal memory.  

Explanation

In programming, each variable is assigned a value and also has a unique address that indicates its location in the computer's memory. This allows the program to access and manipulate the variable's value when needed. Therefore, the statement "Each variable you declare in a program has both a value and a unique address that represents the location of the variable in the computer's internal memory" is true.

Submit
15. In C++, you use the if statement to code the if and if/else forms of the selection structure.  

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++.

Submit
16. A class definition contains two sections: a declaration section and an optional implementation section.  

Explanation

A class definition typically consists of two sections: a declaration section and an optional implementation section. The declaration section includes the class name, attributes, and methods, while the implementation section contains the actual code for the methods. This separation allows for better organization and abstraction in object-oriented programming. Therefore, the statement is true.

Submit
17. Programs written in a high-level language can be used in many different types of computers.  

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.

Submit
18. 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.  

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.

Submit
19. A local variable can be used only within the statement block in which it is declared.  

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.

Submit
20. When writing a do-while loop in C++, if more than one statement needs to be processed, the statements must be entered as a statement block.  

Explanation

In C++, when using a do-while loop, if there are multiple statements that need to be processed, they must be enclosed within a statement block. This is because the do-while loop executes the statements within the block repeatedly until the condition specified in the while statement becomes false. Without a statement block, only the first statement after the do keyword would be considered part of the loop, and the subsequent statements would be executed only once after the loop terminates. Therefore, in order to ensure that all the statements are processed repeatedly, a statement block is necessary.

Submit
21. Programmers refer to the process of verifying that the input data is within the expected range as data validation.  

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.

Submit
22. In a repetition structure, when the loop condition evaluates to false, the computer skips over the loop instructions, and processing continues with the instruction immediately following the end of the loop.  

Explanation

In a repetition structure, the loop condition is checked before each iteration of the loop. If the condition evaluates to false, it means that the loop should not be executed anymore. In this case, the computer will skip over the loop instructions and continue with the instruction immediately following the end of the loop. This allows the program to move on to the next task or instruction after the loop has finished executing. Therefore, the given statement is true.

Submit
23. When you pass a literal constant, a keyword, a named constant, or a variable's value to a function, the function stores the value it receives in a memory location.  

Explanation

When passing a literal constant, a keyword, a named constant, or a variable's value to a function, the function stores the value it receives in a memory location. This is because functions need to access and manipulate the values they receive as parameters, and storing them in memory allows for easy retrieval and modification. Therefore, the statement is true.

Submit
24. The objects used in an object-oriented program can take on many different forms.  

Explanation

In object-oriented programming, objects are instances of classes and can have different forms or types. This means that objects can be created from different classes, each with its own set of properties and behaviors. This allows for flexibility and reusability in programming, as objects can be easily created and modified to suit different needs. Therefore, the statement "The objects used in an object-oriented program can take on many different forms" is true.

Submit
25. You should perform several desk-checks, using different data, to make sure that the program is correct.  

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.

Submit
26. Names in C++ are case sensitive.  

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.

Submit
27. A repetition structure can be either a pretest loop or a posttest loop.  

Explanation

A repetition structure is a programming construct that allows a set of instructions to be repeated multiple times. It can be either a pretest loop or a posttest loop. A pretest loop checks the condition before executing the loop, while a posttest loop checks the condition after executing the loop. Therefore, the statement "A repetition structure can be either a pretest loop or a posttest loop" is true.

Submit
28. The creation of a good class, which is one whose objects can be used in a variety of ways by many different programs,requires a lot of time, patience, and planning.  

Explanation

Creating a good class that can be used in various ways by different programs is indeed a time-consuming and meticulous process. It requires careful consideration of the class's design, functionality, and potential use cases. The class should be well-structured, modular, and adaptable to different programming scenarios. Additionally, thorough planning and attention to detail are necessary to ensure the class meets the requirements and expectations of various programs. Therefore, the statement that the creation of a good class requires time, patience, and planning is true.

Submit
29. You should test an algorithm with invalid data because users sometimes make mistakes when entering data.  

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.

Submit
30. The data type and position of each formal parameter in the parameterList of a function call must agree with the data type and position of its corresponding actual argument.  

Explanation

The explanation for the given correct answer is that in a function call, the data type and position of each formal parameter (parameters defined in the function's signature) must match with the data type and position of its corresponding actual argument (arguments passed to the function). This ensures that the values being passed to the function are of the correct type and in the correct order, allowing the function to work correctly. If there is a mismatch in data type or position, it can lead to errors or unexpected behavior in the program.

Submit
31. Large and complex programs are typically written by a team of programmers.  

Explanation

Large and complex programs require a significant amount of work and expertise to develop, which is why they are typically written by a team of programmers. This allows for the workload to be divided among multiple individuals, each with their own specialized skills and knowledge. Additionally, collaboration within a team can lead to better problem-solving, improved code quality, and faster development. Therefore, it is true that large and complex programs are typically written by a team of programmers.

Submit
32. When writing a procedure-oriented program, the programmer concentrates on the major tasks that the program needs to perform.  

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.

Submit
33. The ability to use an object for more than one purpose saves programming time and money—an advantage that contributes to the popularity of object-oriented programming.  

Explanation

The statement is true because object-oriented programming allows for the reuse of code and the ability to create modular and flexible systems. This means that objects can be used in multiple contexts and can be easily modified or extended to suit different purposes. By reusing code and leveraging existing objects, developers can save time and effort in programming, leading to cost savings. This advantage has contributed to the widespread adoption and popularity of object-oriented programming.

Submit
34. When used in a program, the repetition structure directs the computer to repeat one or more instructions until some condition is met.  

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.

Submit
35. Variables declared using the string data type usually are initialized to the empty string.  

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.

Submit
36. When the loop condition in a posttest loop evaluates to true, the computer processes the instructions in the loop body.  

Explanation

In a posttest loop, the loop condition is checked after the instructions in the loop body are executed. If the loop condition evaluates to true, the computer will continue processing the instructions in the loop body. Therefore, the given statement is true.

Submit
37. A data type ranks higher than another data type if it can store larger numbers.  

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.

Submit
38. A class encapsulates all of the attributes and behaviors that describe the object the class creates.  

Explanation

A class is a blueprint for creating objects in object-oriented programming. It encapsulates the attributes (data) and behaviors (methods) that define the object it creates. This means that the class contains all the necessary information and functionality to create and manipulate instances of that class. Therefore, the statement "A class encapsulates all of the attributes and behaviors that describe the object the class creates" is true.

Submit
39. Most algorithms begin with an instruction that enters the input items into the computer.  

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.

Submit
40. When coding the while statement, some C++ programmers include the braces even when the loop body contains only one statement.  

Explanation

Some C++ programmers include braces even when the loop body contains only one statement because it helps improve code readability and maintainability. By including braces, it makes it clear where the loop body begins and ends, reducing the chances of introducing bugs or confusion. It also makes it easier to add additional statements to the loop body in the future without having to modify the code structure. Overall, including braces in the while statement is considered a good practice in C++ programming.

Submit
41. It is a good programming practice to use a comment, such as //end while, to mark the end of the while statement.  

Explanation

Using a comment to mark the end of a while statement is indeed a good programming practice. Comments can help improve code readability and make it easier for other developers to understand the purpose and functionality of the code. By adding a comment like "//end while", it becomes clear where the while loop ends, making the code more maintainable and reducing the chances of introducing errors or confusion.

Submit
42. The check boxes, list boxes, and buttons included in most Windows programs are objects.  

Explanation

The explanation for the given correct answer is that check boxes, list boxes, and buttons are all examples of user interface elements that can be interacted with by the user. These elements are typically used to perform actions or make selections within a program. In the context of Windows programs, these elements are considered objects because they have properties, methods, and events associated with them, allowing them to be manipulated and controlled programmatically. Therefore, the statement "The check boxes, list boxes, and buttons included in most Windows programs are objects" is true.

Submit
43. You should use a posttest loop only when you are sure that the loop body instructions can and should be processed.  

Explanation

A posttest loop is a type of loop where the loop body instructions are executed after the condition is checked. This means that the loop body will always be executed at least once before the condition is checked. Therefore, it is important to use a posttest loop only when you are sure that the loop body instructions can and should be processed, as they will always be executed at least once. If there is a possibility that the loop body instructions should not be processed, then a different type of loop should be used.

Submit
44. Int sales = 0;
int region = 1;
int totRegSales = 0;
while (region < 3)
{
cout << "First sales amount for Region "
<< region << ": ";
cin >> sales;
while (sales > 0)
{
totRegSales = totRegSales + sales;
cout << "Next sales amount for Region "
<< region << ": ";
cin >> sales;
} //end while
cout << endl << "Region " << region << " sales: $"
<< totRegSales << endl << endl;
region = region + 1;
totRegSales = 0;
} //end while
cout << "End of program" << endl;
67. The first instruction in the inner loop in the code shown above adds the amount stored in the sales variable to the contents of the totRegSales accumulator variable.

Explanation

The given code snippet uses a nested while loop to calculate the total sales for each region. The first instruction in the inner loop is "totRegSales = totRegSales + sales", which adds the value of the sales variable to the totRegSales accumulator variable. This means that the sales amount for each region is being accumulated and added to the total sales for all regions. Therefore, the statement "The first instruction in the inner loop in the code shown above adds the amount stored in the sales variable to the contents of the totRegSales accumulator variable" is true.

Submit
45. When generating pseudo-random numbers, a seed is an integer that represents the starting point for the random number generator.  

Explanation

A seed is indeed an integer that serves as the starting point for the random number generator. It is used to initialize the generator so that it produces a sequence of numbers that appear to be random but can be reproduced if the same seed is used again. By setting a specific seed, the same sequence of pseudo-random numbers can be generated, which can be useful for debugging or ensuring consistent results in simulations or games.

Submit
46. Programmers typically desk-check a program using the same sample data used to desk-check the algorithm.  

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.

Submit
47. A loop condition must result in either a true or false answer only.  

Explanation

A loop condition is a condition that determines whether a loop should continue running or not. It is typically a boolean expression that evaluates to either true or false. If the condition is true, the loop continues to iterate, otherwise, it terminates. Therefore, it is necessary for a loop condition to result in either a true or false answer only.

Submit
48. Passing an array by reference is more efficient than passing it by value.  

Explanation

Passing an array by reference is more efficient than passing it by value because when an array is passed by value, a copy of the entire array is made and passed to the function or method. This can be time-consuming and memory-intensive, especially for large arrays. On the other hand, when an array is passed by reference, only a reference to the original array is passed. This means that any changes made to the array within the function or method will directly affect the original array, saving time and memory.

Submit
49. The C++ compiler treats all numeric literal constants containing a decimal place as a double data type.  

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.

Submit
50. In C++, x++ is equivalent to x = x + 2;  

Explanation

The correct answer is False. In C++, x++ is equivalent to x = x + 1, not x = x + 2. The ++ operator increments the value of x by 1.

Submit
51. A C++ program cannot contain more than one function.  

Explanation

False. A C++ program can contain multiple functions. In fact, it is common practice to have multiple functions in a C++ program to divide the code into smaller, manageable parts. Functions allow for modular programming and can be used for different tasks such as input/output, calculations, and data manipulation.

Submit
52. You can find the sequence structure in every program.  

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.

Submit
53. Errors in a program are called hacks.  

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.

Submit
54. A variable can store only one value at a time.  

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.

Submit
55. When creating a computer solution to a problem, the first three steps of the problem-solving process can usually be skipped.  

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.

Submit
56. In C++, the switch statement ends with a square bracket ( ] ).  

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.

Submit
57. You should never use the equality operator to compare two floating-point numbers.  

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.

Submit
58. There are no differences between the syntax of a value-returning function and the syntax of a void function.  

Explanation

The statement is false because there are differences between the syntax of a value-returning function and a void function. In a value-returning function, you need to specify the data type of the return value in the function declaration and use a return statement to return a value of that data type. In contrast, a void function does not have a return type specified in the function declaration and does not use a return statement to return a value.

Submit
59. The assembly languages represent the only way to communicate directly with the computer.  

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.

Submit
60. Comments are statements in C++.  

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.

Submit
61. In C++, you can have an else clause without matching the if clause.  

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.

Submit
62. Logic errors are easier to find than syntax errors.  

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.

Submit
63. The false path of a selection structure cannot include other selection structures.  

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.

Submit
64. Desk-checking is also called pencil-tracing.  

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.

Submit
65. The newline character in C++ is '\N'.  

Explanation

The newline character in C++ is actually represented by the escape sequence '\n', not '\N'. Therefore, the correct answer is false.

Submit
66. Class names in C++ must use the Pascal case.  

Explanation

Class names in C++ do not necessarily have to use Pascal case. While it is a common convention to use Pascal case in C++ for class names, it is not a strict requirement. C++ does not enforce any specific naming conventions for class names, so developers have the flexibility to choose their own naming styles. Other naming styles such as camel case or snake case can also be used for class names in C++.

Submit
67. If an expression contains more than one operator having the same priority, those operators are evaluated from right to left.  

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.

Submit
68. In a flowchart, the if/else and switch selection structures are represented in exactly the same way.  

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.

Submit
69. A string variable is not an object.  

Explanation

The statement "A string variable is not an object" is false. In most programming languages, a string variable is considered an object. An object is an instance of a class, and a string variable can hold a sequence of characters, which is the behavior of a string object. Therefore, a string variable can be treated as an object and can have properties and methods associated with it.

Submit
70. You can use program-defined functions to replace the main() function.  

Explanation

The statement is false because the main() function is a required function in a program. It is the entry point of the program where the execution starts. Without the main() function, the program will not run. Program-defined functions can be used within the main() function to perform specific tasks, but they cannot replace the main() function itself.

Submit
71. In C++, comparisons with a precedence number of 2 are performed before comparisons with a precedence number of 1.  

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.

Submit
72. 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.  

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.

Submit
73. Passing a variable's address to a function is referred to as passing by value.  

Explanation

Passing a variable's address to a function is referred to as passing by reference, not passing by value. When passing by reference, the function can directly access and modify the original variable's value using its memory address. In contrast, passing by value creates a copy of the variable's value, and any modifications made within the function do not affect the original variable. Therefore, the correct answer is False.

Submit
74. Sequential access files must use the "txt" filename extension.  

Explanation

Sequential access files do not necessarily have to use the "txt" filename extension. The filename extension is just a convention used to indicate that the file contains text data. Sequential access files can have different filename extensions depending on the type of data they contain, such as "dat" for generic data or "csv" for comma-separated values. Therefore, the statement that sequential access files must use the "txt" filename extension is false.

Submit
75. Objects created from a class are referred to as children of the class.  

Explanation

The statement is false because objects created from a class are not referred to as children of the class. In object-oriented programming, objects are instances of a class and are not considered children of the class. The relationship between a class and its objects is that the class serves as a blueprint or template for creating objects with similar properties and behaviors.

Submit
76. The evaluation of the condition in a pretest loop occurs after the instructions within the loop are processed.  

Explanation

In a pretest loop, the condition is evaluated before the instructions within the loop are processed. This means that the condition is checked first, and if it is true, then the instructions are executed. If the condition is false, the loop is not entered and the instructions are not executed. Therefore, the statement in the answer is incorrect, and the correct answer is False.

Submit
77. In most programming languages, the names of processing items can contain letters, numbers, underscores, punctuation characters or spaces.  

Explanation

In most programming languages, the names of processing items cannot contain spaces.

Submit
78. The second argument in the for clause usually contains an expression that updates the counter variable specified in the initialization argument.  

Explanation

The second argument in the for clause does not necessarily contain an expression that updates the counter variable specified in the initialization argument. It can contain any expression that determines the condition for the loop to continue, such as a comparison or a function call. Therefore, the statement is false.

Submit
79. When planning an algorithm, you need to create both a flowchart and pseudocode.  

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.

Submit
80. Pseudocode is standardized among programmers.  

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.

Submit
81. You pass a variable by reference when the receiving function needs to know the variable's contents, but the receiving function does not need to change the contents.  

Explanation

Passing a variable by reference means that the receiving function not only needs to know the variable's contents, but also has the ability to change the contents of the variable. Therefore, the correct answer is False.

Submit
82. All objects in C++ are created from a class and are referred to as children of the class.  

Explanation

In C++, objects are not referred to as children of a class. Objects are instances of a class, and they are not related to the class in a parent-child hierarchy. Each object is independent and has its own set of data and behavior defined by the class. Therefore, the statement "All objects in C++ are created from a class and are referred to as children of the class" is incorrect.

Submit
83. The difference between a pretest and posttest loop is that in the posttest loop, the condition is not evaluated with each repetition of the loop.  

Explanation

The correct answer is False. The explanation for this is that in a posttest loop, the condition is evaluated after each repetition of the loop. This means that the loop will continue executing until the condition is no longer true. In contrast, a pretest loop evaluates the condition before each repetition, and if the condition is false, the loop will not execute at all. So, the main difference between a pretest and posttest loop lies in when the condition is evaluated.

Submit
84. A function header is considered a statement in C++.  

Explanation

In C++, a function header is not considered a statement. A function header is the part of a function declaration that includes the function's return type, name, and parameters. It is not an executable statement and does not perform any action in the program. Statements in C++ are executable instructions that perform actions or calculations. Therefore, the correct answer is False.

Submit
85. 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.  

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.

Submit
86. A value-returning function can return multiple values after completing its assigned task, using a multi-valued return statement.  

Explanation

A value-returning function can only return a single value after completing its assigned task. It cannot return multiple values using a multi-valued return statement.

Submit
87. You might want to use a value-returning function in a program simply to display information (such as a title and column headings) at the top of each page in a report.  

Explanation

A value-returning function is used to return a value to the calling code. It is not typically used for displaying information. In this case, using a value-returning function to display information at the top of each page in a report would not be the appropriate approach. Instead, a void function (a function that does not return a value) would be more suitable for this purpose. Therefore, the given answer "False" is correct.

Submit
88. Unless specified otherwise, scalar variables in C++ are passed by reference.  

Explanation

In C++, scalar variables are passed by value by default, not by reference. When a scalar variable is passed by value, a copy of the variable is made and passed to the function, so any changes made to the variable within the function do not affect the original variable. Therefore, the correct answer is False.

Submit
89. 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.  

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.

Submit
90. An accumulator is always incremented by a constant value, whereas a counter is incremented by a value that varies.  

Explanation

An accumulator is not always incremented by a constant value, as it can be incremented by any value depending on the specific program or situation. Similarly, a counter is not always incremented by a value that varies, as it can also be incremented by a constant value. Therefore, the statement that an accumulator is always incremented by a constant value and a counter is incremented by a value that varies is incorrect.

Submit
91. Few C++ programmers enter the function definitions below the main() function in a program.  

Explanation

Many C++ programmers do enter the function definitions below the main() function in a program. The order of function definitions in a C++ program does not matter as long as they are declared before they are used. The main() function can be placed at any position in the program, and the function definitions can be placed before or after the main() function. Therefore, the statement is false.

Submit
92. The top-down design divides a problem into one or more objects.  

Explanation

The statement is false because the top-down design actually divides a problem into one or more modules or sub-problems, not objects. Objects are part of the object-oriented design approach, where the problem is divided into objects with their own attributes and behaviors. In the top-down design, the focus is on breaking down the problem into smaller, manageable modules or sub-problems.

Submit
93. Unless you specify otherwise, variables in C++ are automatically passed by value.  

Explanation

In C++, unless specified otherwise, variables are passed by value. This means that when a variable is passed to a function, a copy of the variable's value is made and used within the function. Any changes made to the variable within the function do not affect the original variable outside of the function. Therefore, the correct answer is False.

Submit
94. 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.  

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.

Submit
95. In a flowchart, the switch diamond contains a condition requiring a true or false answer.  

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.

Submit
96. Depending on the result of the evaluation, the instructions in a posttest loop may never be processed.  

Explanation

In a posttest loop, the instructions are always processed at least once, regardless of the result of the evaluation. This is because the loop condition is checked at the end of each iteration, so even if the condition is false initially, the instructions will still be executed once before the condition is evaluated again. Therefore, the statement that the instructions in a posttest loop may never be processed is false.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 22, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 22, 2009
    Quiz Created by
    Mrmirante
Cancel
  • All
    All (96)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Programmers use a variety of special languages, called programming...
You use the selection structure when you want a program to make a...
The binary number system uses only the two digits 0 and 1.  
You desk-check an algorithm to verify that it is not missing any steps...
The file containing the source code is called the source file.  
If different sections of a program need to perform the same task, it...
You use the selection structure when you want a program to make a...
Functions allow the programmer to avoid duplicating code in different...
Eliminating errors at the pencil and paper stage makes it much easier...
In a flowchart, the switch diamond contains an expression whose value...
You can include as many case clauses as necessary in a switch...
High-level languages are a vast improvement over machine and assembly...
Some algorithms require selection structures that are capable of...
Each variable you declare in a program has both a value and a unique...
In C++, you use the if statement to code the if and if/else forms of...
A class definition contains two sections: a declaration section and an...
Programs written in a high-level language can be used in many...
Before you begin the desk-check, you first choose a set of sample data...
A local variable can be used only within the statement block in which...
When writing a do-while loop in C++, if more than one statement needs...
Programmers refer to the process of verifying that the input data is...
In a repetition structure, when the loop condition evaluates to false,...
When you pass a literal constant, a keyword, a named constant, or a...
The objects used in an object-oriented program can take on many...
You should perform several desk-checks, using different data, to make...
Names in C++ are case sensitive.  
A repetition structure can be either a pretest loop or a posttest...
The creation of a good class, which is one whose objects can be used...
You should test an algorithm with invalid data because users sometimes...
The data type and position of each formal parameter in the...
Large and complex programs are typically written by a team of...
When writing a procedure-oriented program, the programmer concentrates...
The ability to use an object for more than one purpose saves...
When used in a program, the repetition structure directs the computer...
Variables declared using the string data type usually are initialized...
When the loop condition in a posttest loop evaluates to true, the...
A data type ranks higher than another data type if it can store larger...
A class encapsulates all of the attributes and behaviors that describe...
Most algorithms begin with an instruction that enters the input items...
When coding the while statement, some C++ programmers include the...
It is a good programming practice to use a comment, such as //end...
The check boxes, list boxes, and buttons included in most Windows...
You should use a posttest loop only when you are sure that the loop...
Int sales = 0;int region = 1;int totRegSales = 0;while (region <...
When generating pseudo-random numbers, a seed is an integer that...
Programmers typically desk-check a program using the same sample data...
A loop condition must result in either a true or false answer only....
Passing an array by reference is more efficient than passing it by...
The C++ compiler treats all numeric literal constants containing a...
In C++, x++ is equivalent to x = x + 2;  
A C++ program cannot contain more than one function.  
You can find the sequence structure in every program.  
Errors in a program are called hacks.  
A variable can store only one value at a time.  
When creating a computer solution to a problem, the first three steps...
In C++, the switch statement ends with a square bracket ( ] ).  
You should never use the equality operator to compare two...
There are no differences between the syntax of a value-returning...
The assembly languages represent the only way to communicate directly...
Comments are statements in C++.  
In C++, you can have an else clause without matching the if clause....
Logic errors are easier to find than syntax errors.  
The false path of a selection structure cannot include other selection...
Desk-checking is also called pencil-tracing.  
The newline character in C++ is '\N'.  
Class names in C++ must use the Pascal case.  
If an expression contains more than one operator having the same...
In a flowchart, the if/else and switch selection structures are...
A string variable is not an object.  
You can use program-defined functions to replace the main() function....
In C++, comparisons with a precedence number of 2 are performed before...
When nesting selection structures, you can interchangeably put the...
Passing a variable's address to a function is referred to as passing...
Sequential access files must use the "txt" filename...
Objects created from a class are referred to as children of the class....
The evaluation of the condition in a pretest loop occurs after the...
In most programming languages, the names of processing items can...
The second argument in the for clause usually contains an expression...
When planning an algorithm, you need to create both a flowchart and...
Pseudocode is standardized among programmers.  
You pass a variable by reference when the receiving function needs to...
All objects in C++ are created from a class and are referred to as...
The difference between a pretest and posttest loop is that in the...
A function header is considered a statement in C++.  
After creating the program, the programmer desk-checks the program;...
A value-returning function can return multiple values after completing...
You might want to use a value-returning function in a program simply...
Unless specified otherwise, scalar variables in C++ are passed by...
It is easy to detect if you have incorrectly used a logical operator...
An accumulator is always incremented by a constant value, whereas a...
Few C++ programmers enter the function definitions below the main()...
The top-down design divides a problem into one or more objects.  
Unless you specify otherwise, variables in C++ are automatically...
And if selection structure contains two sets of instructions: one set...
In a flowchart, the switch diamond contains a condition requiring a...
Depending on the result of the evaluation, the instructions in a...
Alert!

Advertisement