9781111969752_TB_ch02.rtf - Chapter 2 Elements of...

This preview shows page 1 - 4 out of 8 pages.

Chapter 2: Elements of High-Quality Programs TRUE/FALSE 1. A variable can hold more than one value at any given moment in time. ANS: F PTS: 1 REF: 39 2. Because one memory location can be used repeatedly with different values, you can write program instructions once and then use them for thousands of separate calculations ANS: T PTS: 1 REF: 39 3. In many programming languages, if you declare a variable and do not initialize it, the variable contains an unknown value until it is assigned a value. ANS: T PTS: 1 REF: 40 4. Variable names can be more than one word with blanks between the words. ANS: F PTS: 1 REF: 41 5. The assignment operator has left-to-right-to-left associativity, which means that the value of the expression to the left of the assignment operator is evaluated first and that the result is assigned to the operand on the right. ANS: F PTS: 1 REF: 42 6. A string variable can hold digits such as phone numbers and zip codes. ANS: T PTS: 1 REF: 43 7. Programmers generally write programs as one long series of steps. ANS: F PTS: 1 REF: 48 8. Modularization makes it harder for multiple programmers to work on a problem. ANS: F PTS: 1 REF: 50 9. Program comments are a type of internal documentation. ANS: T PTS: 1 REF: 64 10. Most modern programming languages require that program statements be placed in specific columns. ANS: F PTS: 1 REF: 68
MULTIPLE CHOICE 1. When you write programs, you work with data in three different forms: ____. a. values; variables, or named values; and unnamed values b. variables; named constants; and named memory c. variables; literals, or unnamed constants; and named constants d. variations; transliterals, or unnamed constants; and named values ANS: C PTS: 1 REF: 38 2. A specific numeric value is often called a(n) ____. a. named constant c. arithmetic constant b. defined constant d. numeric constant ANS: D PTS: 1 REF: 38 3. Fractional numeric variables that contain a decimal point are known as ____ variables. a. partial c. integer b. string d. floating-point ANS: D PTS: 1 REF: 38 4. In most programming languages, before you can use any variable, you must include a ____ for it. a. declaration c. header b. definition d. proclamation ANS: A PTS: 1 REF: 39 5. The process of naming program variables and assigning a type to them is called ____ variables. a. initializing c. identifying b. declaring d. proclaiming ANS: B PTS: 1 REF: 39 6. A variable’s unknown value is commonly called ____. a. initial c. deterministically random b. default d. garbage ANS: D PTS: 1 REF: 40 7. Declaring a starting value for a variable is known as ____ the variable. a. initializing c. defining b. declaring d. identifying ANS: A PTS: 1 REF: 40 8. When the variable starts with a lowercase letter and any subsequent word begins with an uppercase letter, this is called ____. a. Hungarian notation c. camel casing b. Pascal casing d. Turing notation ANS: C PTS: 1 REF: 41
9. When the first letter of a variable name is uppercase, as in HourlyWage , the format is known as ____ casing.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture