1. Which one of the following options refers to a collection of programs that a computer executes?

    1. Software
    2. Assembler
    3. Instructions
    4. Source code
    Section Ref
    1.1
    Title
    Which (term) refers to a collection of programs?
    section
    1.1 What Is Programming?
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-1
  2. Computers are machines that

    1. Design computer programs
    2. Execute programs
    3. Carry out a very narrow range of tasks
    4. Are imprecise and slow
    Section Ref
    1.1
    Title
    What kind of machines are computers?
    section
    1.1 What Is Programming?
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-2
  3. Computer programming is

    1. The speed with which a computer operates
    2. The collection of peripheral devices connected to a computer
    3. The storage of data in the form of words and pictures
    4. The act of designing and implementing a computer program
    Section Ref
    1.1
    Title
    What is computer programming?
    section
    1.1 What Is Programming?
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-3
  4. Consider the following statements regarding computers:

    I. Computers can execute a large number of instructions in a fraction of a second.

    II. Computer application areas mainly target the research and scientific communities.

    III. The physical components of a computer constitute its hardware.

    IV. Unlike humans, a computer never gets bored or exhausted on performing repetitive tasks.

    Which one of the following options is correct?

    1. Only III is a valid statement.
    2. I and III are valid statements.
    3. I, II, and III are valid statements.
    4. I, III, and IV are valid statements.
    Section Ref
    1.1
    Title
    Which statement(s) regarding computers is(are) correct?
    section
    1.1 What Is Programming?
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-4
  5. Consider the following statements about computer programs:

    I. Computer programs can be written by someone who has a basic knowledge of operating a computer.

    II. Computer programs can complete complex tasks quickly.

    III. Large and complex computer programs are generally written by a group of programmers.

    IV. Computer programs are composed of extremely primitive operations.

    Which one of the following options is correct?

    1. II and III are correct statements.
    2. I, II, III, and IV are correct statements.
    3. II, III, and IV are correct statements.
    4. I and IV are correct statements.
    Section Ref
    1.1
    Title
    Which statement(s) regarding computer programs is(are) correct?
    section
    1.1 What Is Programming?
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-5
  6.         Writing the program for a computer game with motion, graphics, and sound usually requires

    1.         one brilliant programmer writing a large number of simple instructions
    2.         a team of programmers writing a few complex instructions
    3.         one brilliant programmer writing a few complex instructions
    4.         a team of programmers writing a large number of simple instructions
    Section Ref
    1.1
    Title
    Who writes complex programs?
    section
    1.1 What Is Programming?
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-6
  7. The Central Processing Unit is primarily responsible for

    1. Performing program control and data processing
    2. Ensuring data persists when electrical power is turned off
    3. Enabling a human user to interact with the computer
    4. Interconnecting computers that are separated by distance
    Section Ref
    1.2
    Title
    What is the function of a CPU?
    section
    1.2 The Anatomy of a Computer
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-6
  8. A single silicon chip made from potentially millions of transistors is called

    1. A Central Processing Unit (CPU)
    2. Secondary Storage
    3. A Hard Disk
    4. An Optical Disk (such as a DVD)
    Section Ref
    1.2
    Title
    What is a chip with transistors called?
    section
    1.2 The Anatomy of a Computer
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-7
  9. An example of an output device that interfaces between computers and humans is

    1. The keyboard
    2. The mouse
    3. The speaker
    4. A microphone
    Section Ref
    1.2
    Title
    What is an example of an output device that interfaces between humans and computers?
    section
    1.2 The Anatomy of a Computer
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-8
  10. An example of an input device that interfaces between computers and humans is

    1. The microphone
    2. The monitor
    3. The printer
    4. The speaker
    Section Ref
    1.2
    Title
    What is an example of an input device that interfaces between humans and computers?
    section
    1.2 The Anatomy of a Computer
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-9
  11. Programs that are not running are usually stored

    1. in the CPU's memory.
    2. on the computer monitor.
    3. in secondary storage.
    4. on a backup device that is in a different physical location from the computer.
    Section Ref
    1.2
    Title
    Where are programs usually stored when they are not running?
    section
    1.2 The Anatomy of a Computer
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-10
  12. When a program begins to run,

    1. It is moved from DVD to hard disk.
    2. It is moved to the CPU's memory.
    3. It is moved from the CPU's memory to hard disk.
    4. It must be connected to a computer network.
    Section Ref
    1.2
    Title
    What happens when a program begins to run?
    section
    1.2 The Anatomy of a Computer
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-11
  13. Which one of the following typically provides data persistence without electricity?

    I. The CPU's memory

    II. The hard disk

    III. Secondary storage

    1. I, II
    2. I, III
    3. II, III
    4. I, II, III
    Section Ref
    1.2
    Title
    Which storage type provides data persistence without electricity?
    section
    1.2 The Anatomy of a Computer
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-12
  14.         Which best describes the difference between primary and secondary storage?

    1.         primary storage is more expandable, while secondary storage is more flexible
    2.         primary storage is used only by the CPU, while secondary storage is used only by peripherals
    3.         primary storage is simpler to replace than secondary storage if it fails
    4.         primary storage is fast but costly, while secondary is slow, larger and cheaper
    Section Ref
    1.2
    Title
    Differences between primary and secondary storage
    section
    1.2 The Anatomy of a Computer
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-14
  15.         A network controller is the device in a computer that

    1.         controls the internal network.
    2.         connects the computer to the internet or other network through a wire or wireless.
    3.         connects the CPU to peripherals.
    4.         interfaces between a hard disk and other disks such as CDs and USB drives.
    Section Ref
    1.2
    Title
    What is a network controller?
    section
    1.2 The Anatomy of a Computer
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-15
  16.         The instruction “1011 0011” for a computer is an example of

    1.         assembly language.
    2.         high-level language.
    3.         bit language.
    4.         machine language.
    Section Ref
    1.3
    Title
    Computer Instruction Types
    section
    1.3 Machine Code and Programming Languages
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-18
  17.         The C++ Language

    1.         was introduced in the 1980s.
    2.         is commonly used for embedded systems.
    3.         is commonly used for designing system software such as databases.
    4.         All of the above
    Section Ref
    1.3
    Title
    C++ Usage
    section
    1.3 Machine Code and Programming Languages
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-19
  18. Consider a scenario in which you develop a C++ program on a computer that has a Pentium processor and compile the program into the corresponding machine language. What step should you take to run the same program on a computer that has a different processor?

    1. Copy the compiled machine language instructions to the computer that has a different processor.
    2. Develop the same program again on the computer that has a different processor and recompile the program.
    3. Recompile the C++ program on the computer that has a different processor.
    4. You cannot run the program on a computer with a different processor because C++, being a high-level programming language, is machine dependent.
    Section Ref
    1.3
    Title
    What step should you take to run a C++ program on a (different) processor?
    section
    1.3 Machine Code and Programming Languages
    Difficulty
    Medium
    id
    testbank-bc-2-ch01-13
  19. High level programming languages

    1. Are made up primarily of ones and zeros
    2. Are independent of the underlying hardware
    3. Are not standardized
    4. Use syntax that is close to the underlying hardware's instruction set
    Section Ref
    1.3
    Title
    What are the characteristics of high level programming languages?
    section
    1.3 Machine Code and Programming Languages
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-14
  20. Which one of the following translates high-level descriptions into machine code?

    1. Assembler
    2. Linker
    3. Compiler
    4. Editor
    Section Ref
    1.3
    Title
    Which translates high-level descriptions into machine code?
    section
    1.3 Machine Code and Programming Languages
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-15
  21. Computer scientists have devised something that allows programmers to describe tasks in words that are closer to the syntax of the problems being solved. This is called

    1. Embedded system
    2. Machine instructions
    3. High level programming language
    4. Compiler
    Section Ref
    1.3
    Title
    What are the tools used to describe and solve high-level problems?
    section
    1.3 Machine Code and Programming Languages
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-16
  22. Small computers that control devices like automobile engines or cellular telephones are called

    1. Embedded systems
    2. Compilers
    3. CPUs
    4. Peripheral devices
    Section Ref
    1.3
    Title
    What are small control devices called?
    section
    1.3 Machine Code and Programming Languages
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-17
  23. What is one of the benefits of using a high-level programming language like C++?

    1. Its syntax is very similar to the hardware instruction set
    2. No tools other than a text editor are required for programming
    3. Statements in the high-level language are just like English
    4. Problems solved in a high-level language are independent of the underlying computer hardware
    Section Ref
    1.3
    Title
    What are the benefits of using high level languages?
    section
    1.3 Machine Code and Programming Languages
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-18
  24. What name do you use for small computers that are programmed to control automobile engines and cell phones?

    1. Mainframe computers
    2. Mini computers
    3. Embedded systems
    4. Virtual systems
    Section Ref
    1.3
    Title
    What are small computers programmed to control engines and phones called?
    section
    1.3 Machine Code and Programming Languages
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-19
  25. An integrated development environment (IDE) bundles tools for programming into a unified application. What kinds of tools are usually included?

    1. An editor and a compiler
    2. A web browser
    3. Presentation tools
    4. A multimedia creation package
    Section Ref
    1.4
    Title
    What kinds of tools are included in an IDE?
    section
    1.4 Becoming Familiar with Your Programming Environment
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-20
  26. What is the difference between an editor and a compiler?

    1. An editor converts program files into an executable program; a compiler allows program files to be written and stored
    2. An editor allows program files to be written and stored; a compiler produces an organized list of files
    3. An editor allows program files to be written and stored; a compiler produces an indexed database of terms and keywords
    4. An editor allows program files to be written and stored; a compiler converts program files into an executable program
    Section Ref
    1.4
    Title
    What is the difference between an editor and a compiler?
    section
    1.4 Becoming Familiar with Your Programming Environment
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-21
  27. Suppose you define a C++ symbol MadCitie and another symbol Madcitie. What can be said about these two symbols?

    1. Since C++ is case-sensitive, these are considered to be completely distinct
    2. Because "citie" is misspelled, the C++ compiler will reject it
    3. Since these C++ symbols both have the same letters, they are considered to be the same
    4. They are the correct length because all C++ symbols must have exactly eight characters.
    Section Ref
    1.4
    Title
    What are some of the rules for defining and understanding variable names in C++?
    section
    1.4 Becoming Familiar with Your Programming Environment
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-22
  28. What statements about the integrated development environment (IDE) are true?

    I. You may run an executable program even after exiting the IDE

    II. The IDE contains a program called the linker, which is required to build an executable program

    III. Translating C++ source code into machine code is not enough to actually run the program

    1. I, II
    2. I, III
    3. II, III
    4. I, II, III
    Section Ref
    1.4
    Title
    What are the steps in building an executable file in C++?
    section
    1.4 Becoming Familiar with Your Programming Environment
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-23
  29. Consider the following statements about folders and your integrated development environment (IDE):

    I. Hierarchical folders help to organize a project

    II. Folders are a way to visualize the layout of a file system

    III. Folders make it impossible to lose or accidentally delete a file

    1. Only I is correct
    2. I, II, and III are correct
    3. Only I and II are correct
    4. Only III is correct
    Section Ref
    1.4
    Title
    How is your integrated development environment organized?
    section
    1.4 Becoming Familiar with Your Programming Environment
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-24
  30.         Which of the following statements regarding backup strategies for C++ files are true?

    I. You should back up your projects often to prevent loss of valuable work.

    II. You should check your backups only if you have lost your current working copy.

    III. Have more than one backup, from various stages of your development work.

    1.         I, II
    2.         I, III
    3.         II, III
    4.         I, II, III
    Section Ref
    1.5
    Title
    Which snippet compiles without errors and displays "hello"?
    from
    testbank-bc-2-ch01-25
    section
    1.4 Becoming Familiar with Your Programming Environment
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-33
  31.         Which of the following are NOT windows displayed in a typical IDE?

    1.         The compiler

    2.         The editor

    3.         The folder/file hierarchy or directory tree

    4.         The message window

    Section Ref
    1.4
    Title
    Which of the following are NOT windows displayed in a typical IDE?
    section
    1.4 Becoming Familiar with Your Programming Environment
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-34
  32.         Which of the following are NOT types of code used by an IDE?

    1.         Source code
    2.         Machine code
    3.         Native code
    4.         Library code
    Section Ref
    1.4
    Title
    Which of the following are NOT types of code used by an IDE?
    section
    1.4 Becoming Familiar with Your Programming Environment
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-35
  33. Which one of the following statements is true about a C++ compiler?

    1. It translates the object code into the source code.
    2. It translates the library code into the machine code.
    3. It translates the source code into the machine code.
    4. It translates the machine code into the source code.
    Section Ref
    1.8
    Title
    Which statement is true about a C++ compiler?
    section
    1.4 Becoming Familiar with Your Programming Environment
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-62
  34. Which one of the following programs combines the machine code with the library code to build an executable file?

    1. Assembler
    2. Linker
    3. Editor
    4. Compiler
    Section Ref
    1.8
    Title
    Which program combines machine code with library code to build an executable file?
    section
    1.4 Becoming Familiar with Your Programming Environment
    Difficulty
    Medium
    id
    testbank-bc-2-ch01-63
  35.         Which one of the following statements is true about C++ syntax?

    1.         The semicolon terminates statements.
    2.         The double quote character cannot appear within a character string.
    3.         The tab character is the only way to produce “whitespace”.
    4.         The single quote character means the same thing as the double quote character.
    Section Ref
    1.5
    Title
    Which statements are true about C++ syntax?
    section
    1.5 Analyzing Your First Program
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-26
  36. Characters that are grouped together between double quotes (quotation marks) in C++ are called

    1. keywords
    2. syntax
    3. symbols
    4. strings
    Section Ref
    1.5
    Title
    What is the term for characters grouped together and enclosed with quotes in C++?
    section
    1.5 Analyzing Your First Program
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-27
  37.         To include a literal special character, such as the double quote, inside a character string, use the following preceding the character:

    1.         a duplicate copy of the same character
    2.         the dollar sign $
    3.         the backslash
    4.         the single quote
    Section Ref
    Special Topic 1.1
    Title
    How are special characters designated and represented in C++?
    from
    testbank-bc-2-ch01-28
    section
    1.5 Analyzing Your First Program
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-40
  38. The two lines of code below both produce the same output. Why?

    cout << "Hello" << " Goodbye";
    cout << "Hello"      <<      " Goodbye";
    1. Since there are no numerical / arithmetic operators, the spaces don't matter.
    2. In fact, the two statements do not produce the same output.
    3. Spacing between symbols in C++ doesn’t affect statements.
    4. Because there are no escape characters.
    Section Ref
    1.5
    Title
    Why do the example lines of code behave the way they do (understanding whitespace)?
    section
    1.5 Analyzing Your First Program
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-29
  39. What is the output from this code snippet?

    cout << "The sum is " << "8 + 6";
    1. The sum is 14
    2. The sum is 48
    3. The sum is 2
    4. The sum is 8 + 6
    Section Ref
    1.5
    Title
    What is the output from this code? (arithmetic statements versus character strings)
    section
    1.5 Analyzing Your First Program
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-30
  40.         Which of the following statements should you include in a C++ program that performs an input or output operation with cin and/or cout?

    I. using namespacestd;

    II. #include<iostream>

    III. int main()

    IV. #include "iostream"

    1.         II only
    2.         All of the above
    3.         II and III only
    4.         I, II, and III
    Section Ref
    1.5
    Title
    Which statements should you include in program with input/output operations?
    from
    testbank-bc-2-ch01-31
    section
    1.5 Analyzing Your First Program
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-43
  41. What is the output of the following code snippet?

    #include <iostream>
    using namespace std;
     
    int main()
    {
       cout << "Goodbye" << endl << "Come again" << endl;
       return 0;
    }
    1. Goodbye Come again
    2. Goodbye

      Come again

    3. Goodbye

      Come again

    4. No output due to compilation errors
    Section Ref
    1.5
    Title
    What is output of code snippet (using cout and endl)?
    section
    1.5 Analyzing Your First Program
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-32
  42. Which one of the following code snippets compiles without errors and displays the output "hello" on the screen?

    1. #include <iostream>
      using namespace std;
      int main();
      {
         cout << hello << endl;
         return 0;
      }
    2. #include <iostream>
      using namespace std;
      int main();
      {
         cout << 'hello' << endl;
         return 0;
      }
    3. #include <iostream>
      using namespace std;
      int main()
      {
         cout << "hello" << endl;
         return 0;
      }
    4. #include <iostream>
      using namespace std;
      int main()
      {
         cout << "hello" << "endl";
         return 0;
      }
    Section Ref
    1.5
    Title
    Which snippet compiles without errors and displays "hello"?
    section
    1.5 Analyzing Your First Program
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-33
  43. Which one of the given code snippet represents the correct way to print the following output?

    HI

    "HELLO"

    1. #include <iostream>
      using namespace std;
      int main()
      {
         cout << HI << endl << "HELLO" << endl;
         return 0;
      }
    2. #include <iostream>
      using namespace std;
      int main()
      {
         cout << "HI << endl << HELLO";
         return 0;
      }
    3. #include <iostream>
      using namespace std;
      int main()
      {
         cout << 'HI' << endl << '"HELLO"';
         return 0;
      }
    4. #include <iostream>
      using namespace std;
      int main()
      {
         cout << "HI" << endl << "\"HELLO\"" << endl;
         return 0;
      }
    Section Ref
    1.5
    Title
    Which snippet correctly prints (output on two lines)?
    section
    1.5 Analyzing Your First Program
    Difficulty
    Medium
    id
    testbank-bc-2-ch01-34
  44. What is the output of the following code snippet?

    #include <iostream>
    using namespace std;
     
    int main()
    {
      cout << 2 * 2 << 6;
      return 0;
    }
    1. 2 * 26
    2. 226
    3. 46
    4. 4 6
    Section Ref
    1.5
    Title
    TB 1.14 What is output of snippet (with expressions sent to cout)?
    section
    1.5 Analyzing Your First Program
    Difficulty
    Medium
    id
    testbank-bc-2-ch01-35
  45.         Which of the following statements is valid regarding endl?

    I. The endl symbol denotes the end of line marker.

    II. When the end of line marker is sent out to cout, the cursor is moved to the first column in the next screen row.

    III. endl is included inside double quotes if the cout contains a string.

    1.         I only.
    2.         II only,
    3.         I and II only
    4.         I, II and III.
    Section Ref
    1.5
    Title
    Which statement is true about the usage of endl?
    from
    testbank-bc-2-ch01-36
    section
    1.5 Analyzing Your First Program
    Difficulty
    Medium
    id
    testbank-bc-3-ch01-48
  46. Which of the following symbols is used to terminate a C++ program statement?

    1. Colon
    2. Semicolon
    3. Single quote
    4. Period
    Section Ref
    1.5
    Title
    Which symbol is used to terminate a C++ program statement?
    section
    1.5 Analyzing Your First Program
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-37
  47.         Which of the following statements is valid with respect to semicolons in C++?

    1.         A semicolon is used to denote the end of a statement.
    2.         A semicolon is used to terminate the #include statement.
    3.         You cannot use a semicolon to terminate the “using namespace” statement.
    4.         You cannot put a semicolon within double quotation marks.
    Section Ref
    1.5
    Title
    Which statement is true about semicolon usage?
    from
    testbank-bc-2-ch01-38
    section
    1.5 Analyzing Your First Program
    Difficulty
    Medium
    id
    testbank-bc-3-ch01-50
  48.         Which of the following statements are valid with respect to the main function?

    1.         The opening and closing parentheses after the function name main are optional.
    2.         A semicolon is required after the declaration int main()
    3.         A semicolon is required after the closing curly braces of the main function.
    4.         Every executable C++ program has a main function.
    Section Ref
    1.5
    Title
    Which statement is true about the main function?
    from
    testbank-bc-2-ch01-39
    section
    1.5 Analyzing Your First Program
    Difficulty
    Medium
    id
    testbank-bc-3-ch01-51
  49. Which of the given cout statements generates the following output?

    ///"\\\

    1. cout << "///"\\\" << endl;
    2. cout << "///\"\\\\\\" << endl;
    3. cout << "//////""\\\\\\" endl;
    4. cout << ///"\\\ << endl;
    Section Ref
    1.5
    Title
    Which cout statement generates this output?
    section
    1.5 Analyzing Your First Program
    Difficulty
    Hard
    id
    testbank-bc-2-ch01-41
  50.         Which of the following statements enables the use of input and output operations in a C++ program?

    1.         using namespace std;
    2.         #include <iostream>
    3.         int main()
    4.         return 0;
    Section Ref
    1.5
    Title
    Which statements enables the use of input/output operations?
    from
    testbank-bc-2-ch01-42
    section
    1.5 Analyzing Your First Program
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-54
  51.         What is the output of the following code snippet?

    #include <iostream>
    using namespace std;
    int main()
    {
       cout << "Hello\n" << " Good Day!" << endl;
       return 0;
    }
    1.         Hello \n Good Day!
    2.         Hello

      Good Day!

    3.         Hello

      Good

      Day!

    4.         No output due to compilation errors
    Section Ref
    1.5
    Title
    What is output of snippet (with cout, and endl)?
    from
    testbank-bc-2-ch01-43
    section
    1.5 Analyzing Your First Program
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-55
  52. Which one of the following code snippets compiles without errors and displays the output "Hello world" on the screen?

    1. #include <iostream>
      using namespace std;
      int main();
      {
         cout << Hello world << endl;
         return 0;
      }
    2. #include <iostream>
      using namespace std;
      int main();
      {
         cout << 'Hello world' << endl;
         return 0;
      }
    3. #include <iostream>
      using namespace std;
      int main()
      {
         cout << "Hello world" << endl;
         return 0;
      }
    4. #include <iostream>
      using namespace std;
      int main()
      {
         cout << "Hello world" << "endl";
         return 0;
      }
    Section Ref
    1.5
    Title
    Which snippet compiles without errors and displays "Hello world"?
    section
    1.5 Analyzing Your First Program
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-44
  53. Which one of the given code snippets represents the correct way to print the following output?

    GOOD MORNING

    "AMERICA"

    1. #include <iostream>
      using namespace std;
      int main()
      {
         cout << GOOD MORNING << endl << "AMERICA" << endl;
         return 0;
      }
    2. #include <iostream>
      using namespace std;
      int main()
      {
         cout << "GOOD MORNING << endl << AMERICA";
         return 0;
      }
    3. #include <iostream>
      using namespace std;
      int main()
      {
         cout << 'GOOD MORNING' << endl << '"AMERICA"';
         return 0;
      }
    4. #include <iostream>
      using namespace std;
      int main()
      {
         cout << "GOOD MORNING" << endl << "\"AMERICA\"" << endl;
         return 0;
      }
    Section Ref
    1.5
    Title
    Which snippet correctly prints (output on two lines)?
    section
    1.5 Analyzing Your First Program
    Difficulty
    Medium
    id
    testbank-bc-2-ch01-45
  54. What is the output of the following code snippet?

    #include <iostream>
    using namespace std;
     
    int main()
    {
       cout << 4 * 4 << 12;
       return 0;
    }
    1. 4 * 412
    2. 4412
    3. 1612
    4. 28
    Section Ref
    1.5
    Title
    What is output of snippet (with expressions sent to cout)?
    section
    1.5 Analyzing Your First Program
    Difficulty
    Medium
    id
    testbank-bc-2-ch01-46
  55. What is the output of the following code snippet?

    #include <iostream>
    using namespace std;
     
    int main()
    {
       cout << "\"cout << endl\" prints out a new line to " << endl;
       cout << "the standard output stream" << endl;
       return 0;
    }
    1. The code snippet gives a compilation error because the cout statement is inside the quotation marks
    2. cout prints out a new line to

      the standard output stream

    3. cout << endl prints out a new line to

      the standard output stream

    4. "cout << endl" prints out a new line to

      the standard output stream

    Section Ref
    1.5
    Title
    What is the output of snippet (with complex cout statement)?
    section
    1.5 Analyzing Your First Program
    Difficulty
    Medium
    id
    testbank-bc-2-ch01-47
  56. Which of the given cout statements generates the following output?

    \\\"///

    1. cout << "\\\"///" << endl;
    2. cout << "\\\\\\\"///" << endl;
    3. cout << "\\\\\\""//////" endl;
    4. cout << \\\"/// << endl;
    Section Ref
    1.5
    Title
    Which cout statement generates this output?
    section
    1.5 Analyzing Your First Program
    Difficulty
    Hard
    id
    testbank-bc-2-ch01-48
  57. What, if anything, is wrong with the following code snippet?

    cout << "Hello, World!" << endl
    return 0;
    
    1.         The double quotes should be single quotes.
    2.         The < < symbols are in the wrong direction, and should be > >.
    3.         There is a missing semicolon.
    4.         Nothing is wrong with the snippet.
    Section Ref
    1.5: Common Error 1.1
    Title
    What type of error is in this snippet?
    section
    Common Error 1.1 Omitting Semicolons
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-61
  58. What is the output of the following code snippet?

    #include <iostream>
    using namespace std;
     
    int main()
    {
       cout << "cout << endl prints out a new line to " << endl 
          << "the standard output stream" << endl;
       return 0;
    }
    1. The code snippet gives a compilation error because the cout statement is inside the quotation marks
    2. cout prints out a new line to

      the standard output stream

    3. cout << endl prints out a new line to

      the standard output stream

    4. prints out a new line to

      the standard output stream

    Section Ref
    1.5
    Title
    What is the output of snippet (with complex cout statement)?
    section
    Special Topic 1.1 Escape Sequences
    Difficulty
    Medium
    id
    testbank-bc-2-ch01-40
  59.         What is an equivalent way to produce the same output as the following single statement?

    cout << "Hello, World!" << endl;
    1.         cout << "Hello, World!\n";
    2.         cout << "Hello, "; cout << "World!" << endl;
    3.         cout << "Hello, Wor"; cout << "ld!\n";
    4.         All of the above
    Section Ref
    1.5: Special Topic 1.1
    Title
    What is an equivalent way to produce the same output as the following single statement?
    section
    Special Topic 1.1 Escape Sequences
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-62
  60. What kind of error is it when your program has a syntax error?

    1. Compile-time error
    2. Logic error
    3. Run-time error
    4. Exception
    Section Ref
    1.6
    Title
    Which kind of error is it when programs do not compile?
    section
    1.6 Errors
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-49
  61. When a compiler finds a syntax error in a program, what happens?

    1. The compiler goes ahead and produces an executable program but leaves out the statement where there was an error.
    2. The compiler stops immediately.
    3. The compiler requests input from the user before it will continue.
    4. The compiler continues and may report about other errors but does not produce an executable file.
    Section Ref
    1.6
    Title
    What happens when the compiler finds a syntax error?
    section
    1.6 Errors
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-50
  62. What kind of error is created by the following code snippet?

    coutt << "Hello, World!" << endl;
    1. No error: the code is correct
    2. Logic error: the program will run until it comes to this statement
    3. Syntax error: the program will not compile
    4. Exception: the statement will generate an exception
    Section Ref
    1.6
    Title
    What kind of error is created by the code snippet?
    section
    1.6 Errors
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-51
  63. What kind of error is created by the following code snippet?

    cout << "The sum of 8 and 12 is " << 8 * 12 << endl;
    1. No error: the code is correct
    2. Logic error: the program does not produce the desired result
    3. Syntax error: the code will not compile
    4. Exception: the statement will generate an exception
    Section Ref
    1.6
    Title
    What kind of error is created by the code snippet?
    section
    1.6 Errors
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-52
  64. What is a logic error?

    1. An error that occurs when a program is running because, for example, the wrong operator was used.
    2. An error in a statement that does not conform to the syntax of the programming language.
    3. An error in the hardware from overheating.
    4. An error introduced by the compiler when it guesses at how to fix a syntax error.
    Section Ref
    1.6
    Title
    What is the definition of a logic error?
    section
    1.6 Errors
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-53
  65.         How do programmers find exceptions and run-time errors?

    1.         Running the compiler and examining output messages
    2.         Testing the compiled program with a variety of input values
    3.         Carefully reading over the program code
    4.         Compiling with the run-time-error detection option activated
    Section Ref
    1.6
    Title
    How do programmers find exceptions and run-time errors?
    from
    testbank-bc-2-ch01-54
    section
    1.6 Errors
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-68
  66. The programmer, not the compiler, is responsible for testing a program to identify

    1. Syntax errors
    2. Compile-time errors
    3. Run-time errors
    4. Undefined symbols
    Section Ref
    1.6
    Title
    Who is responsible for what (programmer vs. compiler)?
    section
    1.6 Errors
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-55
  67. Which one of the following errors represents a part of a program that is incorrect according to the rules of the programming language?

    1. Syntax errors
    2. Run-time errors
    3. Logic errors
    4. Out-of-memory errors
    Section Ref
    1.6
    Title
    Which kind of error violates rules of the programming language?
    section
    1.6 Errors
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-56
  68.         Which of the following statements would generate a compile-time error?

    1.         cout << "eleven" << endl;
    2.         cout << eleven << endl;
    3.         cout << 4 + 7 << endl;
    4.         cout << "4 + 7" << endl;
    Section Ref
    1.6
    Title
    Which of the following statements would generate a compile-time error?
    section
    1.6 Errors
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-71
  69.         Which of the following statements represents a logic error, but not a compile-time error?

    1.         cout << "The sum of 5 and 6 is 10" << endl;
    2.         cout << The sum of 5 and 6 is 10 << endl;
    3.         cout << "The sum of 5 and 6 is 11" << endl;
    4.         cout << "The sum of 5 and 6 is " << 5 + 6 << endl;
    Section Ref
    1.6
    Title
    Which of the following statements represents a logic error, but not a compile-time error?
    section
    1.6 Errors
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-72
  70. The following code snippet is written to calculate the miles per gallon of two cars and print out both values.

    #include <iostream>
    using namespace std;
    int main()
    {
       int miles1 = 420;
       int miles2 = 500;
       int gallons1 = 10;
       int gallons2 = 15;
     
       cout << miles1 / gallons1 << endl;
       cout << miles1 / gallons2 << endl;
       return 0;
    }

    Based on the given code snippet, identify the correct statement:

    1. The output is correct, and there are no errors.
    2. The mileage of the first car is calculated correctly, but the mileage of the second car is incorrect due to a logic error.
    3. The mileage of the second car is calculated correctly, but the mileage of the first car is incorrect due to a logic error.
    4. The mileage of both cars is incorrect due to a logic error.
    Section Ref
    1.7
    Title
    Which is true about this snippet that calculates and prints mpg?
    section
    1.6 Errors
    Difficulty
    Hard
    id
    testbank-bc-2-ch01-57
  71. What is the error in the following code snippet, which is used for calculating the average score for a student in three subjects?

    #include <iostream>
     
    int main()
    {
       int subject1 = 75;
       int subject2 = 65;
       int subject3 = 70;
     
       int average = subject1 + subject2 + subject3 / 3;
     
       cout << "The average is " << average;
     
       return 0;
    }
    1. The code snippet has a syntax error from an incorrect use of arithmetic operators.
    2. The code snippet has a logic error.
    3. The code snippet uses variable names that are not allowed in C++.
    4. There is no error; the code snippet is completely accurate.
    Section Ref
    1.7
    Title
    Is there an error in snippet that calculates average score?
    section
    1.6 Errors
    Difficulty
    Hard
    id
    testbank-bc-2-ch01-58
  72. Who or what is responsible for inspecting and testing the program to guard against logic errors?

    1. Programmer
    2. Linker
    3. Compiler
    4. End-user
    Section Ref
    1.7
    Title
    Who/what is responsible for ... guarding against logic errors?
    section
    1.6 Errors
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-59
  73. While developing a program, the programmer adds the discount amount to the total payable instead of reducing the discount amount from the total. What type of an error does this denote?

    1. A syntax error
    2. A logic error
    3. A human error
    4. A compilation error
    Section Ref
    1.7
    Title
    What type of error is (adding instead of subtracting)?
    section
    1.6 Errors
    Difficulty
    Medium
    id
    testbank-bc-2-ch01-60
  74. What type of error can you identify in the following code snippet?

    #include <iostream>
     
    int main
    {
       int a = 10;
       int b = 20;
       int c = a + b;
       return 0;
    }
    1. A logic error.
    2. A syntax error.
    3. A run-time error.
    4. No errors; the code snippet is completely accurate.
    Section Ref
    1.7
    Title
    What type of error is in this snippet?
    section
    1.6 Errors
    Difficulty
    Medium
    id
    testbank-bc-2-ch01-61
  75.         What if anything is wrong with the following code?

    #include <iostream>
    using namespace std
      
    int Main()
    {
       cout << "Hello, World!" << endl;
       return 0;
    }
    
    1.         Nothing is wrong.
    2.         It is missing a semicolon.
    3.         Main should be lowercase main.
    4.         Both b and c are correct.
    Section Ref
    1.6: Common Error 1.2
    Title
    What if anything is wrong with the following code?
    section
    Common Error 1.2 Misspelling Words
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-73
  76. What is the purpose of the following algorithm?

    num = 0
    Repeat the following steps 10 times
       input var1
          if var1 > num then
             num = var1
          end of if
    end of repeat 
    print num
    1. To find the highest among 10 numbers
    2. To print out the 10 numbers
    3. To find the smallest among 10 numbers
    4. To search for a particular number among 10 numbers
    Section Ref
    1.9
    Title
    What is the purpose of this algorithm?
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Medium
    id
    testbank-bc-2-ch01-64
  77.         Consider a situation where you are buying books online. The bookseller charges $19.95 as the price per book and $4.95 as the handling cost for up to three books. For every book purchased in addition to three books, there is a handling charge of $1.50. In addition, there is a 7% tax on the cost of the books but not on the handling charges. Assuming that num_books represents the number of books you are purchasing, which of the following is the correct algorithm for calculating the total cost of the books that you are purchasing?

    1. Total charge for the books = 4.95 * num_books
      Tax on the books = num_books * .7
      if (books <= 3) then Handling charges = 4.95
      else Handling charges = 1.50 * num_books
      Total cost of order = total charge for books + tax + handling charges
    2. Total charge for the books = 4.95 * num_books
      Tax on the books = num_books * .07
      if (books <= 3) then Handling charges = 4.95
      else Handling charges = 1.50 * num_books
      Total cost of order = total charge for books + tax + handling charges
    3. Total charge for the books = 4.95 * num_books
      Tax on the books = num_books * .07
      if (books < 3) then Handling charges = 4.95
      else Handling charges = 4.95 + 1.50 * (num_books – 3)
      Total cost of order = total charge for books + tax + handling charges
    4. Total charge for the books = 4.95 * num_books
      Tax on the books = Total charge for the books * .07
      if (books <= 3) then Handling charges = 4.95
      else Handling charges = 4.95 + 1.50 * (num_books – 3)
      Total cost of order = total charge for books + tax + handling charges
    Section Ref
    1.7
    Title
    Which is the correct algorithm for calculating total cost with tax/shipping?
    from
    testbank-bc-2-ch01-65
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Hard
    id
    testbank-bc-3-ch01-80
  78. Consider a situation where you are planning on purchasing a new cell phone. You are considering two cell phones. These cell phones have different purchase prices. Each mobile service provider charges a different rate for each minute that the cell phone is used. To determine which cell phone is the better buy, you need to develop an algorithm to calculate the total cost of purchasing and using each cell phone. What are all the inputs needed for this algorithm?

    1. The cost of each cell phone and the rate for each minute for each cell phone
    2. The cost of each cell phone and the number of minutes provided with each cell phone
    3. The cost of each cell phone, the rate per minute for each cell phone, and the number of minutes provided with each cell phone
    4. The cost of each cell phone, the rate per minute for each cell phone, and the number of minutes you would use the cell phone
    Section Ref
    1.9
    Title
    Which inputs do you need to calculate cost of purchasing/using cell phone?
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Medium
    id
    testbank-bc-2-ch01-66
  79. Which one of the following methodologies is a sequence of precise steps formulated in English for solving a problem?

    1. Flowcharts
    2. Pseudocode
    3. Algorithms
    4. Terminations
    Section Ref
    1.7
    Title
    Which methodology is an informal description of steps for solving a problem?
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Easy
    id
    testbank-bc-2-ch01-67
  80.         Consider a situation where you are assigned to develop an algorithm to calculate the total cost of a purchase order that contains several items. The cost of each item and the tax rate is known. The standard shipping charge for the entire order is $4.95, and the special delivery charge is $19.95. In addition, there is no tax on the shipping cost. Which of the following is the correct pseudocode for the required algorithm?

    1. For each item on the purchase order:
      Order cost = order cost + item cost
      Total purchase order cost = order cost + tax rate + 4.95
    2. For each item on the purchase order:
      Order cost = order cost + item cost
      If standard shipping
         Shipping cost = 4.95
      Else
         Shipping cost = 19.95
      Total purchase order cost = order cost * tax rate + shipping cost
    3. If standard shipping
         Shipping cost = 4.95
      Else
         Shipping cost = 19.95
      For each item on the purchase order:
         Order cost = order cost + item cost + shipping cost
      Total purchase order cost = order cost * tax rate
    4. If special delivery
         Shipping cost = 4.95
      Else
         Shipping cost = 19.95
      For each item on the purchase order:
         Order cost = order cost + item cost 
      Total purchase order cost = order cost * tax rate + shipping cost
    Section Ref
    1.7
    Title
    Which is the correct pseudocode for algorithm to calculate total cost?
    from
    testbank-bc-2-ch01-68
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Medium
    id
    testbank-bc-3-ch01-83
  81. Consider the given scenario for describing an algorithm using pseudocode.

    UML Supermarket has different ways of awarding discounts to its customers for each purchase they make. A 10% discount is given on the total value of the purchase. In addition, a standard loyalty discount is given if customers have a permanent customer card. Your program should indicate the amount payable by the customer after the discounts. Identify the inputs that the program requires from the given set of options.

    I. The discount percentage

    II. The total value of the purchase

    III. The loyalty-discount amount

    IV. The customer card number

    V. The amount payable after discount

    1. I, II, and III
    2. I and III
    3. II, IV, and V
    4. II and IV
    Section Ref
    1.9
    Title
    What are the inputs required to solve this problem?
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Hard
    id
    testbank-bc-2-ch01-69
  82.         Evaluate the given pseudocode to calculate the payment (pmt) with the following test values:

    The total number of hours worked (working_hours) = 50

    The rate paid for hourly work (rate) = 10

    input working_hours 
    input rate
    pmt = working_hours * rate
    if working_hours > 45 then
       extra_hours = working_hours – 45
       extra_pmt = extra_hours * rate * 2
       pmt = pmt + extra_pmt
    end if
    output pmt
    1.         400
    2.         500
    3.         600
    4.         1,000
    Section Ref
    1.7
    Title
    Evaluate this pseudocode with these test values.
    from
    testbank-bc-2-ch01-70
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Hard
    id
    testbank-bc-3-ch01-85
  83.         The following code snippet is written to calculate the kilometers per liter of two cars and print out both values.

    #include <iostream>
    using namespace std;
    int main()
    {
       int km1 = 600;
       int km2 = 800;
       int lit1 = 15;
       int lit2 = 20;
     
       cout << "Car 1: " << km1 / lit2 << endl;
       cout << "Car 2: " << km2 / lit2 << endl;
       return 0;
    }

    Based on the given code snippet, identify the correct statement:

    1.         The output is correct, and there are no errors.
    2.         There is a logic error, but the mileage of the first car in this case still ends up correct, while the mileage of the second car is incorrect
    3.         There is a logic error, but the mileage of the second car in this case still ends up correct, while the mileage of the first car is incorrect
    4.         There is a logic error and the mileage of both cars ends up incorrect as a result
    Section Ref
    1.7
    Title
    Which is true about this snippet that calculates and prints km per liter?
    from
    testbank-bc-2-ch01-71
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Hard
    id
    testbank-bc-3-ch01-86
  84.         Is there any error in the following code snippet, which is used for calculating the average age for a group of three students?

    #include <iostream>
    
    int main()
    {
       int age1 = 15;
       int age2 = 18;
       int age3 = 24;
     
       int average = (age1 + age2 + age3) / 3;
     
       cout << "The average is " << average;
     
       return 0;
    }
    1.         Yes, the code snippet has a syntax error.
    2.         Yes, the code snippet has a logic error.
    3.         Yes, the code snippet has a run-time error.
    4.         No error; the code snippet is completely accurate.
    Section Ref
    1.7
    Title
    Is there an error in snippet that calculates average age?
    from
    testbank-bc-2-ch01-72
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Hard
    id
    testbank-bc-3-ch01-87
  85. What is the purpose of the following algorithm?

    somenum = 0
    Repeat the following steps 50 times
       input variable1
          if variable1 > somenum then
             somenum = variable1
          end of if
    end of repeat
    print somenum
    1. To find the highest among 50 numbers
    2. To print out the 50 numbers
    3. To find the smallest among 50 numbers
    4. To search for a particular number among 50 numbers
    Section Ref
    1.7
    Title
    What is the purpose of this algorithm?
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Medium
    id
    testbank-bc-2-ch01-73
  86.         Consider a situation where you are buying videos online. The video seller charges $21.50 as the price per video and $6.75 as the handling cost for up to three videos. For every video purchased in addition to three videos, there is a handling charge of $1.50. In addition, there is a 9% tax on the cost of the videos but not on the handling charges. Assuming that num_videos represents the number of videos you are purchasing, which of the following is the correct algorithm for calculating the total cost of the videos that you are purchasing?

    1. Total charge for the videos = 21.50 * num_videos
      Tax on the videos = num_videos * .9
      if (num_videos <= 3) then Handling charges = 6.75
      else Handling charges = 1.50 * num_videos
      Total cost of order = total charge for videos + tax + handling charges
    2. Total charge for the videos = 21.50 * num_videos
      Tax on the videos = num_videos * .09
      if (num_videos <= 3) then Handling charges = 6.75
      else Handling charges = 1.50 * num_videos
      Total cost of order = total charge for videos + tax + handling charges
    3. Total charge for the videos = 21.50 * num_videos
      Tax on the videos = num_videos * .09
      if (num_videos < 3) then Handling charges = 6.75
      else Handling charges = 6.75 + 1.50 * (num_videos – 3)
      Total cost of order = total charge for videos + tax + handling charges
    4. Total charge for the videos = 21.50 * num_videos
      Tax on the videos = total charge for videos * .09
      if (num_videos <= 3) then Handling charges = 6.75
      else Handling charges = 6.75 + 1.50 * (num_videos – 3)
      Total cost of order = total charge for videos + tax + handling charges
    Section Ref
    1.7
    Title
    Which is the correct algorithm for calculating total cost with tax/shipping?
    from
    testbank-bc-2-ch01-74
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Hard
    id
    testbank-bc-3-ch01-89
  87. Consider a situation where you are planning on purchasing a new cable TV dish. You are considering two cable TV dishes. These cable TV dishes have different purchase prices. Each channel service provider charges a different rate for each month that the cable TV dish is used. To determine which cable TV dish is a better buy, you need to develop an algorithm to calculate the total cost of purchasing and using each cable TV dish. What are all of the inputs that you need for this algorithm?

    1. The cost of each cable TV dish and the rate for each month for using each cable TV dish
    2. The cost of each cable TV dish and the number of months provided with each cable TV dish
    3. The cost of each cable TV dish, the rate per month for using each cable TV dish, and the number of months provided with each cable TV dish
    4. The cost of each cable TV dish, the rate per month for using each cable TV dish, and the number of months you would use the cable TV dish
    Section Ref
    1.7
    Title
    Which inputs do you need to calculate cost of purchasing/using cable dish?
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Medium
    id
    testbank-bc-2-ch01-75
  88.         Consider a situation where you are assigned to develop an algorithm to calculate the total cost of a purchase order that contains several T shirts. The cost of each T shirt and the tax rate is known. The standard shipping charge for the entire order is $5.75, and the special delivery charge is $23.65. In addition, there is no tax on the shipping cost. Which of the following is the correct pseudocode for the required algorithm?

    1. For each T shirt on the purchase order:
      Order cost = order cost + T shirt cost
      Total purchase order cost = order cost + tax rate + 5.75
    2. For each T shirt on the purchase order:
      Order cost = order cost + T shirt cost
      If standard shipping
         Shipping cost = 5.75
      Else
         Shipping cost = 23.65
      Total purchase order cost = order cost * tax rate + shipping cost
    3. If standard shipping
         Shipping cost = 5.75
      Else
         Shipping cost = 23.65
      For each T shirt on the purchase order:
         Order cost = order cost + T shirt cost + shipping cost
      Total purchase order cost = order cost * tax rate
    4. If special delivery
         Shipping cost = 5.75
      Else
         Shipping cost = 23.65
      For each T shirt on the purchase order:
         Order cost = order cost + T shirt cost 
      Total purchase order cost = order cost * tax rate + shipping cost
    Section Ref
    1.7
    Title
    Which is the correct pseudocode for algorithm to calculate total cost?
    from
    testbank-bc-2-ch01-76
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Medium
    id
    testbank-bc-3-ch01-91
  89. Consider the given scenario for describing an algorithm using pseudocode.

    WALMART Supermarket has different ways of awarding discounts to its customer IDs for each purchase they make. An 8% discount is given on the total value of the purchase. In addition, a standard loyalty discount is given if customers have a permanent customer ID card. Your program should indicate the amount payable by the customer after the discounts. Identify the inputs that the program requires from the given set of options.

    I. The discount percentage

    II. The total value of the purchase

    III. The loyalty-discount amount

    IV. The customer ID card number

    V. The amount payable after discount

    1. I, II, and III
    2. I and III
    3. II, IV, and V
    4. II and IV
    Section Ref
    1.7
    Title
    What are the inputs required to solve this problem?
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Hard
    id
    testbank-bc-2-ch01-77
  90. Evaluate the given pseudocode to calculate the payment (pmt) with the following test values:

    The total number of hours worked (working_hours) = 60

    The rate paid for hourly work (rate) = 15

    input working_hours 
    input rate
    pmt = working_hours * rate
    if working_hours > 40 then
       extra_hours = working_hours – 40
       extra_pmt = extra_hours * rate * 2
       pmt = pmt + extra_pmt
    end of if
    output pmt
    1. 900
    2. 1,200
    3. 1,500
    4. 1,800
    Section Ref
    1.7
    Title
    Evaluate this pseudocode with these test values.
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Hard
    id
    testbank-bc-2-ch01-78
  91.         Which of the following is NOT a requirement for the characteristics of a good algorithm?

    1.         It is simple.
    2.         It is unambiguous.
    3.         It is executable.
    4.         It terminates.
    Section Ref
    1.7
    Title
    Which of the following is NOT a requirement for the characteristics of a good algorithm?
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-94
  92.         An algorithm should be written first in:

    1.         English.
    2.         pseudocode.
    3.         C++.
    4.         a generic programming language.
    Section Ref
    1.7
    Title
    How to write an algorithm
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-95
  93.         An algorithm should be written first in:

    1.         English.
    2.         pseudocode.
    3.         C++.
    4.         a generic programming language.
    Section Ref
    1.7
    Title
    Which of the following is NOT part of the software development process?
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-96
  94.         What is wrong with this algorithm for sorting a deck of playing cards according to suit?

    Pick up the top card from the deck
    Put it into the pile corresponding to its suit (heart, diamond, spade, club)
    Repeat
    1.         It is ambiguous.
    2.         It is not executable.
    3.         It is not terminating.
    4.         Nothing is wrong.
    Section Ref
    1.7
    Title
    What is wrong with this algorithm for sorting a deck of playing cards according to suit?
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-97
  95.         What is the correct order for the following steps in creating an algorithm?

    D. Describe each task with pseudocode
    T. Test the pseudocode on a sample set of inputs
    B. Break down the problem into small tasks
    L. List the inputs and outputs
    
    1.         The order does not matter.
    2.         D, T, L, B
    3.         B, D, L, T
    4.         L, B, D, T
    Section Ref
    1.7
    Title
    What is the correct order for the following steps in creating an algorithm?
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-98
  96.         Say you are writing an algorithm to arrange tiles to fill a rectangular floor with alternating black and white tiles. What would be the required inputs to the algorithm?

    1.         The total floor area and each tile’s area
    2.         The number of tiles available and the floor area
    3.         The length and width of the floor and of the tiles
    4.         A and C both are required inputs
    Section Ref
    1.7
    Title
    Determining Inputs to an Algorithm
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-99
  97.         What is the problem with the following algorithm?

    Repeat a number of times
          Add sales amount to total sales.
    1.         The algorithm has a Repeat instruction, but statements in a program cannot be repeated.
    2.         The Add statement in the algorithm is not executable.
    3.         The Add statement in the algorithm does not clearly specify what is to be added.
    4.         The algorithm is ambiguous because it does not specify how many times to repeat the Add statement.
    Section Ref
    1.7
    Title
    What is the problem with the following algorithm?
    section
    1.7 Problem Solving: Algorithm Design
    Difficulty
    Easy
    id
    testbank-bc-3-ch01-100