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

    1. source code
    2. instructions
    3. assembler
    4. software
    Section Ref
    1.1 Computer Programs
    Title
    Which (term) refers to a collection of programs?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-1
  2. Computers are machines that __________________.

    1. design computer programs
    2. execute programs
    3. are imprecise and slow
    4. carry out a very narrow range of tasks
    Section Ref
    1.1 Computer Programs
    Title
    What kind of machines are computers?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-2
  3. Computer programming is ______________________.

    1. the act of designing and implementing a computer program
    2. the storage of data in the form of words and pictures
    3. the collection of peripheral devices connected to a computer
    4. the speed with which a computer operates
    Section Ref
    1.1 Computer Programs
    Title
    What is computer programming?
    Difficulty
    Easy
    id
    testbank-bjlo-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 when performing repetitive tasks.

    Which of the statements are correct?

    1. I, III, and IV only
    2. I and III only
    3. III only
    4. I, II, and III only
    Section Ref
    1.1 Computer Programs
    Title
    Which statement(s) regarding computers is (are) correct?
    Difficulty
    Easy
    id
    testbank-bjlo-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 of the statements are correct?

    1. I, II, III and IV
    2. I and IV
    3. II and III only
    4. II, III, and IV only
    Section Ref
    1.1 Computer Programs
    Title
    Which statement(s) regarding computer programs is (are) correct?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-5
  6. Writing a computer game in Java that has graphics, motion, and sound effects _______________________.

    1. cannot be done in the Java programming language
    2. is simple because of the power of Java
    3. requires a team of skilled programmers
    4. is more mundane than most programs
    Section Ref
    1.1 Computer Programs
    Title
    What is required to write a computer game in Java?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-6
  7. The Central Processing Unit is primarily responsible for ______________.

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

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

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

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

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

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

    I. The CPU’s memory

    II. The hard disk

    III. Secondary storage

    1. I, II, and III
    2. I and III only
    3. I and II only
    4. II and III only
    Section Ref
    1.2 The Anatomy of a Computer
    Title
    Which storage type provides data persistence without electricity?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-13
  14. In order for the ENIAC computer to be re-programmed, __________________________.

    1. vacuum tubes needed to be replaced
    2. wires needed to be plugged into a different wiring configuration
    3. the programmer needed to load the program from cards
    4. the programmer needed to download the new code over the computer network
    Section Ref
    1.2 The Anatomy of a Computer
    Title
    What is true about the ENIAC being re-programmed?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-14
  15. Consider a scenario in which you develop a Java program on a computer that has a Pentium processor. What step should you take to run the same Java program on a computer that has a different processor?

    1. Load the program in a browser on the computer that has a different processor.
    2. The compiled Java machine language instructions can be run on any processor that has a Java Virtual Machine.
    3. You cannot run the program on a computer with a different processor because high-level programming languages are machine dependent.
    4. Develop the same program again on the computer that has a different processor and recompile the program.
    Section Ref
    1.3 The Java Programming Language
    Title
    What step should you take to run a program in a high-level language on a (different) processor?
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-15
  16. High-level programming languages _________________________.

    1. are made up primarily of ones and zeros
    2. are independent of the underlying hardware
    3. use syntax that is close to the underlying hardware’s instruction set
    4. are not standardized
    Section Ref
    1.3 The Java Programming Language
    Title
    What are the characteristics of high-level programming languages?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-16
  17. Which one of the following translates high-level descriptions into machine code?

    1. assembler
    2. compiler
    3. editor
    4. linker
    Section Ref
    1.3 The Java Programming Language
    Title
    Which translates high-level descriptions into machine code?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-17
  18. Computer scientists have devised __________________ that allow programmers to describe tasks in words that are closer to the syntax of the problems being solved.

    1. compilers
    2. embedded systems
    3. high-level programming languages
    4. machine instructions
    Section Ref
    1.3 The Java Programming Language
    Title
    What are the tools used to describe and solve high-level problems?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-18
  19. Small applications written in the Java programming language that can be located anywhere on the Internet are called __________.

    1. applets
    2. compilers
    3. embedded systems
    4. virtual machines
    Section Ref
    1.3 The Java Programming Language
    Title
    What are small applications written in Java called?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-19
  20. What is one of the benefits of using a high-level programming language like Java?

    1. Problems solved in a high-level language are independent of the underlying computer hardware.
    2. Statements in the high-level language are just like English.
    3. Its syntax is very similar to the hardware instruction set.
    4. No tools other than a text editor are required for programming.
    Section Ref
    1.3 The Java Programming Language
    Title
    What are the benefits of using high-level languages?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-20
  21. Because Java was designed for the Internet, which two of its attributes make it suitable for beginning programmers?

    1. Efficiency and security
    2. Safety and portability
    3. Safety and security
    4. Efficiency and portability
    Section Ref
    1.3 The Java Programming Language
    Title
    What are two important Java attributes?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-21
  22. In order to run Java programs on a computer, the computer needs to have software called a(n) __________.

    1. assembler
    2. virtual machine
    3. windows
    4. debugger
    Section Ref
    1.3 The Java Programming Language
    Title
    Software needed to run Java on a computer
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-22
  23. In order to translate a Java program to a class file, the computer needs to have software called a(n) _______________.

    1. assembler
    2. virtual machine
    3. compiler
    4. debugger
    Section Ref
    1.3 The Java Programming Language
    Title
    Software needed to translate Java source code
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-23
  24. A Java virtual machine is ____________.

    1. firmware
    2. hardware
    3. applet
    4. software
    Section Ref
    1.3 The Java Programming Language
    Title
    A Java virtual machine is ___
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-24
  25. The language developed by Sun Microsystems that became the Java programming language was originally designed to be simple, secure, and _______________.

    1. environmentally friendly, or "green"
    2. usable for many different processor types
    3. available over the Internet
    4. easy to program on a phone
    Section Ref
    1.3 The Java Programming Language
    Title
    The Java programming language was designed to be _____?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-25
  26. The term applet refers to _________________.

    1. a Java program that runs as a C++ program
    2. any Java program
    3. a Java program that runs within a web browser
    4. a Java program that runs within an Integrated Development Environment (IDE)
    Section Ref
    1.3 The Java Programming Language
    Title
    What is an "applet"?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-26
  27. Programmers have embraced Java over its closest rival, C++, mainly because _____________.

    1. it is easier to use
    2. it is easier to debug
    3. it is cheaper to use
    4. most computers only understand Java
    Section Ref
    1.3 The Java Programming Language
    Title
    Why have programmers embraced Java?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-27
  28. How does Java achieve portability?

    1. Java programs are compiled to instructions for a virtual machine.
    2. Java programs must be re-compiled on each platform where they are to run.
    3. Java programs are interpreted.
    4. Java programs are compiled to instructions in the C++ programming language.
    Section Ref
    1.3 The Java Programming Language
    Title
    How does Java achieve portability?
    Difficulty
    medium
    id
    testbank-bjlo-2-ch01-28
  29. A Java Virtual Machine is _______________________.

    1. a theoretical machine to help understand the computational complexity of algorithms
    2. a kind of computer hardware that is embedded into the CPUs of all computers using Java
    3. a library package that extends the capability of the Java programming language
    4. a program that simulates a real CPU
    Section Ref
    1.3 The Java Programming Language
    Title
    What is a Java Virtual Machine?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-29
  30. The Java programming language is itself relatively simple, but also contains a vast set of _______________.

    1. cross-platform scripting languages
    2. syntactical variations
    3. library packages
    4. program templates
    Section Ref
    1.3 The Java Programming Language
    Title
    Java also contains a vast set of _____?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-30
  31. A Java class with the name Printer has to be saved using the source file name:

    1. Printer.txt
    2. printer.txt
    3. Printer.java
    4. printer.java
    Section Ref
    1.4 Becoming Familiar with Your Programming Environment
    Title
    Java source file names
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-31
  32. An integrated development environment (IDE) bundles tools for programming into a unified application. What kinds of tools are usually included?

    1. a web browser
    2. source files and class files
    3. an editor and a compiler
    4. presentation tools
    Section Ref
    1.4 Becoming Familiar with Your Programming Environment
    Title
    What kinds of tools are included in an IDE?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-32
  33. What is the difference between an editor and a compiler?

    1. An editor allows program files to be written and stored; a compiler converts program files into an executable program.
    2. An editor converts program files into an executable program; a compiler allows program files to be written and stored.
    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 produces an organized list of files.
    Section Ref
    1.4 Becoming Familiar with Your Programming Environment
    Title
    What is the difference between an editor and a compiler?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-33
  34. Suppose you examine a simple Java program and the first line is public class HelloPrinter. Is this the same thing in Java as the line public class helloprinter?

    1. No, because helloprinter is misspelled, the Java compiler will reject it.
    2. Yes, because these Java symbols both have the same letters, they are considered to be the same
    3. No, because Java is case-sensitive, these are considered to be completely distinct.
    4. Yes, because all Java symbols must have exactly twelve characters.
    Section Ref
    1.4 Becoming Familiar with Your Programming Environment
    Title
    Are these lines of code the same?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-34
  35. 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.

    Which statements are correct?

    1. I only
    2. III only
    3. I and II only
    4. I, II, and III
    Section Ref
    1.4 Becoming Familiar with Your Programming Environment
    Title
    How is your integrated development environment organized?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-35
  36. The source code for a Java program is stored in a file ________________.

    1. that ends with a .class suffix
    2. that can have any valid file name
    3. that has no suffix
    4. that ends with a .java suffix
    Section Ref
    1.4 Becoming Familiar with Your Programming Environment
    Title
    Where is Java source code stored?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-36
  37. A Java "class" file _______________________.

    1. contains instructions for the Java virtual machine
    2. contains Java source code
    3. is the translation of the Java source code into C++
    4. is an internal file created by the Integrated Development Environment (IDE)
    Section Ref
    1.4 Becoming Familiar with Your Programming Environment
    Title
    What is a Java "class" file?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-37
  38. Which of the following statements regarding backup strategies for Java files are true?

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

    II. You should check your backups only in case of loss of data.

    III. You should pay attention to the backup direction.

    1. I and II only
    2. I, II, and III
    3. II and III only
    4. I and III only
    Section Ref
    1.4 Becoming Familiar with Your Programming Environment
    Title
    Which statement regarding backup strategies for Java files is correct?
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-38
  39. Which pointers about backing up your Java projects are important?

    I. Check your backups once in a while.

    II. Rely on the Java programming language's built-in back up system.

    III. Back up often.

    1. I, II, and III
    2. I and II only
    3. II and III only
    4. I and III only
    Section Ref
    1.4 Becoming Familiar with Your Programming Environment
    Title
    Which pointers are important for backing up Java projects?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-39
  40. Every Java program consists of one or more ___________.

    1. classes
    2. strings
    3. System.out.println statements
    4. values (arguments)
    Section Ref
    1.5 Analyzing Your First Program
    Title
    What does every program consist of?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-40
  41. Characters that are grouped together between double quotes (quotation marks) in Java are called _____________.

    1. syntax
    2. strings
    3. reserved words
    4. symbols
    Section Ref
    1.5 Analyzing Your First Program
    Title
    What is the term for characters grouped together and enclosed in quotes?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-41
  42. Every statement in Java must be terminated with ____________.

    1. the semi-colon character ;
    2. System.out.println()
    3. a carriage return
    4. an escape sequence
    Section Ref
    1.5 Analyzing Your First Program
    Title
    What does every statement end with?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-42
  43. These two lines of code do not produce the same output. Why?

    System.out.println(7 + 3);
    System.out.println("7 + 3");
    1. The lack of escape characters causes the expressions to be treated differently.
    2. In fact, the two statements do produce the same output.
    3. The quotes cause the second expression to be treated as a string.
    4. Arithmetic calculations cannot take place within the println method call.
    Section Ref
    1.5 Analyzing Your First Program
    Title
    Why do the example lines of code behave the way they do?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-43
  44. What is the output from this code snippet?

    System.out.print("The sum is ");
    System.out.println("7 + 3");
    1. The sum is 21
    2. The sum is 4
    3. The sum is 10
    4. The sum is 7 + 3
    Section Ref
    1.5 Analyzing Your First Program
    Title
    What is the output from this code?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-44
  45. Which of the following symbols is used to terminate a Java program statement?

    1. colon
    2. single quote
    3. semicolon
    4. period
    Section Ref
    1.5 Analyzing Your First Program
    Title
    Which symbol is used to terminate a Java program statement?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-45
  46. Which of the following statements is valid with respect to the usage of a semicolon in Java?

    1. You cannot use a semicolon to terminate the System.out.print statement.
    2. A semicolon is used to terminate the public class statement.
    3. A semicolon is used to denote the end of a statement.
    4. You cannot put a semicolon within double quotation marks.
    Section Ref
    1.5 Analyzing Your First Program
    Title
    Which statement is true about semicolon usage?
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-46
  47. Which of the following statements is true with respect to the main method in Java?

    1. A semicolon is required after the closing curly braces in the main method.
    2. Every Java application must have a main method.
    3. The opening and closing parentheses after the method name main are optional.
    4. A semicolon is required after the statement public static void main()
    Section Ref
    1.5 Analyzing Your First Program
    Title
    Which statement is true about the main method?
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-47
  48. Which statement starts the declaration of a class in Java?

    1. Java class
    2. public class Classname
    3. System.out.println("Hello, World!");
    4. public static void main(String[] args)
    Section Ref
    1.5 Analyzing Your First Program
    Title
    Which statement starts a class declaration in Java
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-48
  49. Which Java statement prints a blank line?

    1. System.out.println();
    2. System.out.print();
    3. public static void main(String[] args)
    4. System.out.Println();
    Section Ref
    1.5 Analyzing Your First Program
    Title
    Which statement prints a blank line
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-49
  50. Which Java statement does not contain an error?

    1. System.out.print(;
    2. System.out.print()
    3. System.out.printl();
    4. System.out.println();
    Section Ref
    1.5 Analyzing Your First Program
    Title
    Which statement does not contain an error
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-50
  51. What is the output of the following code snippet?

    System.out.print(4 + 4);
    System.out.print(12);
    1. 4412
    2. 4 + 412
    3. 20
    4. 812
    Section Ref
    1.5 Analyzing Your First Program
    Title
    What is output of snippet (using print)?
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-51
  52. The Java statement public static void main(String[] args) declares a ____________.

    1. class
    2. constant
    3. variable
    4. method
    Section Ref
    1.5 Analyzing Your First Program
    Title
    The statement "public static void main(String[] args)"declares what?
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-52
  53. Which of the following statements must you include in a Java class that can be executed by the virtual machine?

    1. // Hello
    2. System.out.println();
    3. public static void main(String[] args)
    4. return 0;
    Section Ref
    1.5 Analyzing Your First Program
    Title
    Which statements should you include in executable class?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-53
  54. What is the output of the following code snippet?

    System.out.print("Hello");
    System.out.println("Good Day!");
    1. Hello
      Good Day!
    2. Hello Good Day!
    3. HelloGood Day!
    4. HelloGoodDay!
    Section Ref
    1.5 Analyzing Your First Program
    Title
    What is output of snippet?
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-54
  55. Which one of the following code snippets compiles without errors and displays the output “Hello Good Day!” on the screen?

    1. System.out.print("Hello ")
      System.out.println(Good Day!");
    2. System.out.print("Hello );
      System.out.println("Good Day!");
    3. System.out.print("Hello");
      System.out.println("Good Day!")
    4. System.out.print("Hello ");
      System.out.println("Good Day!");
    Section Ref
    1.5 Analyzing Your First Program
    Title
    Which snippet compiles without errors and displays “Hello Good Day!”?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-55
  56. What is the output of the following code snippet?

    public class PrintIt
    {
       public static void main(String[] args)
       {
          System.out.println("4 * 4" + 12);
       }
    }
    1. 4 * 412
    2. 4412
    3. 1612
    4. 28
    Section Ref
    1.5 Analyzing Your First Program
    Title
    What is output of snippet (with expressions)?
    Difficulty
    Hard
    id
    testbank-bjlo-2-ch01-56
  57. Which statements are true?

    I. In Java, a file can contain at most one public class.

    II. The word public denotes that the class is usable by the "public".

    III. Every Java program must have a main method.

    1. I, II, and III
    2. I and III only
    3. I and II only
    4. II and III only
    Section Ref
    1.5 Analyzing Your First Program
    Title
    Which statements about Java are true?
    Difficulty
    medium
    id
    testbank-bjlo-2-ch01-57
  58. The technical term for the values that a method needs in order to carry out its task is an argument. When there is more than one argument needed by a method, they are __________________.

    1. separated by semicolons
    2. separated by spaces
    3. separated by commas
    4. merged into a single variable
    Section Ref
    1.5 Analyzing Your First Program
    Title
    Where a method needs more than one argument, they are ________?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-58
  59. In Java, if you want the compiler to interpret what you type as program instructions, you must __________________.

    1. write the instructions in all capital letters
    2. write correct Java statements separated by the semicolon
    3. enclose those instructions within quotation marks
    4. start the line that you type with the symbols //
    Section Ref
    1.5 Analyzing Your First Program
    Title
    How do you type program commands in Java?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-59
  60. What kind of error is it when your program has a syntax error?

    1. compile-time error
    2. logic error
    3. exception
    4. run-time error
    Section Ref
    1.6 Errors
    Title
    Which kind of error is a syntax error?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-60
  61. When a compiler finds a syntax error in a program, what happens?

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

    System.outt.println("Hello");
    1. Logic error: the program will run until it comes to this statement
    2. Syntax error: the program will not compile
    3. No error: the code is correct
    4. Exception: the statement will generate an exception
    Section Ref
    1.6 Errors
    Title
    What kind of error is created by the code snippet?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-62
  63. What kind of error is created by the following code snippet?

    System.out.print("The sum of 8 and 12 is ");
    System.out.println(8 * 12);
    1. Exception: the statement will generate an exception
    2. Syntax error: the code will not compile
    3. No error: the code is correct
    4. Logic error: the program does not produce the desired result
    Section Ref
    1.6 Errors
    Title
    What kind of error is created by the code snippet?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-63
  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 introduced by the compiler when it guesses at how to fix a syntax error.
    3. An error in a statement that does not conform to the syntax of the programming language.
    4. An error in the hardware from overheating.
    Section Ref
    1.6 Errors
    Title
    What is the definition of a logic error?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-64
  65. How do programmers find exceptions and run-time errors?

    1. Re-compiling using different symbols
    2. Using the compiler
    3. Testing by running the program with a variety of input values
    4. Carefully reading over the program code
    Section Ref
    1.6 Errors
    Title
    How do programmers find exceptions and run-time errors?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-65
  66. The programmer, not the compiler, is responsible for testing a program to identify _________________.

    1. run-time errors
    2. undefined symbols
    3. syntax errors
    4. compile-time errors
    Section Ref
    1.6 Errors
    Title
    Who is responsible for what (programmer vs. compiler)?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-66
  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. run-time errors
    2. out-of-memory errors
    3. syntax errors
    4. logic errors
    Section Ref
    1.6 Errors
    Title
    Which kind of error violates rules of the programming language?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-67
  68. Who or what is responsible for inspecting and testing the program to guard against logic errors?

    1. end-user
    2. Integrated Development Environment
    3. compiler
    4. programmer
    Section Ref
    1.6 Errors
    Title
    Who/what is responsible for ... guarding against logic errors?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-68
  69. While developing a program, the programmer adds the discount amount to the total due instead of subtracting it. What type of an error is this?

    1. hardware error
    2. compile-time error
    3. logic error
    4. syntax error
    Section Ref
    1.6 Errors
    Title
    What type of error is (adding instead of subtracting)?
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-69
  70. In Java, the following statement ____________________.

    System.out.print("hello");;;
    1. seems like it should print out "hello" but doesn't
    2. asks the user to enter a value and stores it in the variable "hello"
    3. is a syntax error
    4. is a legal statement
    Section Ref
    1.6 Errors
    Title
    What can you say about the given Java statement?
    Difficulty
    medium
    id
    testbank-bjlo-2-ch01-70
  71. Sometimes errors throw the compiler off track because __________________.

    1. the compiler must be trained by your programming style
    2. it cannot tell which language you are writing without a network connection
    3. the compiler does not understand quotation marks
    4. the compiler does not give up when it finds the first error
    Section Ref
    1.6 Errors
    Title
    Why does the Java compiler sometimes get "off track"?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-71
  72. Some run-time errors are so severe that they generate ______________.

    1. the loss of your source code file
    2. an exception
    3. a syntax error
    4. an email to your account
    Section Ref
    1.6 Errors
    Title
    Severe run-time errors generate _____?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-72
  73. During program development, errors are __________________.

    1. very rare
    2. automatically tracked by the Integrated Development Environment (IDE)
    3. unavoidable
    4. prevented by the Java virtual machine
    Section Ref
    1.6 Errors
    Title
    What is true about errors during program development?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-73
  74. If you misspell a word in your Java program, which of the following statements are true?

    I. the program will not compile

    II. the program may compile, but not run

    III. the program may compile and run but still have a logic error

    1. I, II, and III
    2. I and III only
    3. II and III only
    4. I and II only
    Section Ref
    1.6 Errors
    Title
    What might happen if you misspell a word in your Java program?
    Difficulty
    medium
    id
    testbank-bjlo-2-ch01-74
  75. A sequence of steps that is unambiguous, executable, and terminating is called _______________.

    1. an algorithm
    2. a logarithm
    3. a programming task
    4. pseudocode
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    What is the term for a set of steps that is unambiguous, executable, and terminating?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-75
  76. You have been asked 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. 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
    3. 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
    4. 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 + order cost * tax rate + shipping cost
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    Which is the correct pseudocode for algorithm to calculate total cost?
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-76
  77. What is the purpose of the following algorithm, written in pseudocode?

    num = 0
    Repeat the following steps 10 times
       Input var1
          If var1 > num
             Num = var1
    Print num
    1. To search for a particular number among 10 numbers
    2. To find the smallest among 10 numbers
    3. To print out the 10 numbers
    4. To find the highest among 10 numbers
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    What is the purpose of this algorithm?
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-77
  78. 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 percent tax on the cost of the books but not on the handlingCharges. Assuming that numBooks represents the number of books you are purchasing, which of the following is the correct algorithm for calculating the total cost of your purchase?

    1. Total charge for books = 19.95 * numBooks
      Tax on the books = numBooks * .07
      if (books < 3) then handlingCharges = 4.95
      else handlingCharges = 4.95 + 1.50 * (numBooks – 3)
      Total cost of order = total charge for books + tax + handlingCharges
    2. Total charge for books = 19.95 * numBooks
      Tax on the books = total charge for books * .07
      if (books = 3) then handlingCharges = 4.95
      else handlingCharges = 1.50 * numBooks
      Total cost of order = total charge for books + tax + handlingCharges
    3. Total charge for books = 19.95 * numBooks
      Tax on the books = total charge for books * .07
      if (books <= 3) then handlingCharges = 4.95
      else handlingCharges = 4.95 + 1.50 * (numBooks – 3)
      Total cost of order = total charge for books + tax + handlingCharges
    4. Total charge for books = 19.95 * numBooks
      Tax on the books = numBooks * .7
      if (books <= 3) then handlingCharges = 4.95
      else handlingCharges = 1.50 * numBooks
      Total cost of order = total charge for books + tax + handlingCharges
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    Which is the correct algorithm for calculating total cost with tax/shipping?
    Difficulty
    Hard
    id
    testbank-bjlo-2-ch01-78
  79. Imagine you are planning to buy 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 number of minutes provided with each cell phone
    2. 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
    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 and the rate for each minute for each cell phone
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    Which inputs do you need to calculate cost of purchasing/using cell phone?
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-79
  80. Which one of the following methodologies is a sequence of steps formulated in English for solving a problem?

    1. Pseudocode
    2. Terminations
    3. Flowcharts
    4. Algorithms
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    Which methodology is an informal description of steps for solving a problem?
    Difficulty
    Easy
    id
    testbank-bjlo-2-ch01-80
  81. Imagine you are developing 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. 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
    2. 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
    3. 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 + order cost * tax rate + shipping cost
    4. For each item on the purchase order:
         Order cost = order cost + item cost
      Total purchase order cost = order cost + tax rate + 4.95
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    Which is the correct pseudocode for algorithm to calculate total cost?
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-81
  82. Evaluate the pseudocode below to calculate the payment (pmt) with the following test values:

    The total number of hours worked (workingHours) = 50

    The rate paid for hourly work (rate) = 10

    Input workingHours 
    Input rate
    pmt = workingHours * rate
    If working_hours > 45 
       extraHours = workingHours – 45
       extraPmt = extraHours * rate * 2
       pmt = pmt + extraPmt
    Output pmt
    1. 500
    2. 400
    3. 600
    4. 1,000
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    Evaluate this pseudocode with these test values.
    Difficulty
    Hard
    id
    testbank-bjlo-2-ch01-82
  83. What is the purpose of the following algorithm?

    someNum = 0
    Repeat the following steps 50 times
       Input variable1
       if variable1 > someNum 
           someNum = variable1
    Print someNum
    1. To print out the 50 numbers
    2. To find the smallest of 50 numbers
    3. To search for a particular number among 50 numbers
    4. To find the largest of 50 numbers
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    What is the purpose of this algorithm?
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-83
  84. 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 percent tax on the cost of the videos but not on the handlingCharges. Assuming that numVideos represents the number of videos you are purchasing, which of the following is the correct algorithm for calculating the total cost of your purchase?

    1. Total charge for videos = 21.50 * numVideos
      Tax on the videos = total charge for videos * .9
      if (numVideos = 3) then handlingCharges = 6.75
      else handlingCharges = 1.50 * numVideos
      Total cost of order = total charge for videos + tax + handlingCharges
    2. Total charge for videos = 21.50 * numVideos
      Tax on the videos = numVideos * .09
      if (numVideos < 3) then handlingCharges = 6.75
      else handlingCharges = 6.75 + 1.50 * (numVideos – 3)
      Total cost of order = total charge for videos + tax + handlingCharges
    3. Total charge for videos = 21.50 * numVideos
      Tax on the videos = total charge for videos * .09
      if (numVideos <= 3) then handlingCharges = 6.75
      else handlingCharges = 6.75 + 1.50 * (numVideos – 3)
      Total cost of order = total charge for videos + tax + handlingCharges
    4. Total charge for videos = 21.50 * numVideos
      Tax on the videos = numVideos * .9
      if (numVideos <= 3) then handlingCharges = 6.75
      else handlingCharges = 1.50 * numVideos
      Total cost of order = total charge for videos + tax + handlingCharges
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    Which is the correct algorithm for calculating total cost with tax/shipping?
    Difficulty
    Hard
    id
    testbank-bjlo-2-ch01-84
  85. Imagine you are planning to purchase a new cable TV dish. You are considering two cable TV dishes that 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 the 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, the rate per month for using each cable TV dish, and the number of months you would use the cable TV dish
    3. The cost of each cable TV dish and the number of months you would use the cable TV dish
    4. The number of months you would use the cable TV dish and the rate per month for using each cable TV dish
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    Which inputs do you need to calculate cost of purchasing/using cable dish?
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-85
  86. Evaluate the pseudocode below to calculate the payment (pmt) with the following test values:

    The total number of hours worked (workingHours) = 60

    The rate paid for hourly work (rate) = 15

    Input workingHours 
    Input rate
    pmt = workingHours * rate
    If workingHours > 40 then
       extraHours = workingHours – 40
       extraPmt = extraHours * rate * 2
       pmt = pmt + extraPmt
    Output pmt
    1. 1,200
    2. 1,800
    3. 900
    4. 1,500
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    Evaluate this pseudocode with these test values.
    Difficulty
    Hard
    id
    testbank-bjlo-2-ch01-86
  87. Consider the following pseudocode. What does it produce?

    Create a list of consecutive integers from two to n: (2, 3, 4, ..., n) 
    Initially, let p equal 2
    Repeat following steps until p is greater than n
         Strike from the list all multiples of p less than or equal to n
         Find the first number remaining on the list greater than p
         Replace p with this number.
    1. All factorial numbers up to n
    2. All Fibonacci numbers up to n
    3. All prime numbers up to n
    4. All even numbers up to n
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    What does the algorithm produce?
    Difficulty
    Hard
    id
    testbank-bjlo-2-ch01-87
  88. Consider the following pseudocode. What does it produce?

    Set n to 1
    Set p to 1
    Repeat until n equals 20
       Multiply p by 2 and store result in p
       Add 1 to n
     Print p
    1. The product of first 20 numbers
    2. Two raised to the power 20
    3. The product of first 20 even numbers
    4. Factorial of 20
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    What does the algorithm produce?
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-88
  89. Consider the following pseudocode, what does it produce?

    Set n to 1
    Set p to 0
    Set s to 0
    Repeat until n equals 10
       Calculate the square of n and store in s
       Add s to p
       Add 1 to n
    Print p
    1. The product of first 10 numbers
    2. Two raised to the power 10
    3. Sum of square of numbers between 1 and 10
    4. The product of first 10 even numbers
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    What does the algorithm produce?
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-89
  90. Consider the following pseudocode, what does it produce?

    Set n to 0
    Set a to 0
    Set b to 1
    Set p to 1
    Print p
    Repeat until n equals 10
       Set p to a + b
       Set a to b
       Set b to p
       Add 1 to n
       Print p
    1. 1  2  3  4  5  6  7  8  9  10  11
    2. 1  3  6  9  12  15  18  21  24  27  30
    3. 1  1  2  3  5  8  13  21  34  55  89
    4. 1  3  5  7  9  11  13  15  17  19  21
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    What does the algorithm produce?
    Difficulty
    Hard
    id
    testbank-bjlo-2-ch01-90
  91. Consider the following pseudocode, what does it produce?

    Set n to 1
    Set p to 1
    Repeat until n equals 6
       Multiply p by n and store result in p
       Add 1 to n
       Print p
    1. 1  1  2  3  5  8  
    2. 1  3  6  9  12  15  
    3. 1  2  6  24  120  720  
    4. 1  2  3  4  5  6  
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    What does the algorithm produce?
    Difficulty
    Medium
    id
    testbank-bjlo-2-ch01-91
  92. Which of these are true about writing algorithms in pseudocode?

    I. The exact wording is not important

    II. The sequence of steps should be ambiguous

    III. The algorithm should terminate

    1. II and III only
    2. I and II only
    3. I and III only
    4. I, II, and III
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    What is true when writing pseudocode?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-92
  93. A pseudocode step is executable when _____________________________.

    1. it is precise about where to go next
    2. it is guaranteed to terminate
    3. it can be carried out in practice
    4. it is syntactically correct in a programming language like Java
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    A pseudocode step is executable when _____?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-93
  94. The first step in describing an algorithm in pseudocode is ______________.

    1. break the algorithm into smaller pieces
    2. write the steps out in Java code
    3. test the algorithm by working a problem
    4. determine the inputs and the outputs
    Section Ref
    1.7 Problem Solving: Algorithm Design
    Title
    What is the first step in describing an algorithm?
    Difficulty
    easy
    id
    testbank-bjlo-2-ch01-94