ANSWERS(RATED A+)
A car drove 200 miles using 10 gallons of fuel. Which operation should be used to
compute the miles per gallon, which is 20? - ANSWERDivision
Which operator should be used to determine if a number is evenly divisible by 5? -
ANSWER%
A variable should hold the names of all past U.S. presidents. Which data type should
the variable be? - ANSWERString array
A variable should hold a person's height in meters. Which data type should the variable
be? - ANSWERFloat
A program uses the number of seconds in a minute in various calculations. How should
the item that holds the number of seconds in a minute be declared? -
ANSWERConstant integer secondsPerMinute
A program determines if a user's age is high enough to run for U.S. president. The
minimum age requirement is 35. How should the item that holds the minimum age be
declared? - ANSWERConstant integer minAge
Given integer x = 3 and integer y = 5.What is the value of the expression (x / 2.0) + y? -
ANSWER6.5
Given float x = 10.2 and float y = 1.0.What is the value of the expression x / y? -
ANSWER10.2
What kind of operator is the == in the expression i == 20? - ANSWEREquality
What is the purpose of parentheses () in a programming expression? - ANSWERTo
group expressions
Given float x = 3.0. Which expression evaluates to 2.0? - ANSWERx / 2 + 0.5 /2 + .25
Which expression represents all the values of x, when x is the age ranging from 18 to
24 years old? - ANSWER(x >= 18) and (x <= 24)
Which data type is used for items that are measured in length? - ANSWERFloat
Which data type should be used to keep track of how many planes are in a hangar? -
ANSWERInteger
, What does a programmer do first to use an existing programming library? -
ANSWERInclude the library
What relationship is common among a programming library's functions? -
ANSWERFunctions all relate to the same purpose.
What is an advantage of using a programming library? - ANSWERThe code has already
been tested.
Which language is dynamically typed? - ANSWERPython
Which language is not built on object-oriented design principles? - ANSWERC
A language substantially supports a programmer creating items like person, teacher,
and students. Each item has internal data and some operations. Which characteristic
describes that language? - ANSWERObject-oriented
A programmer wants a compiler to report an error if an integer variable is assigned with
a string. Which kind of language should the programmer use? - ANSWERStatically
typed
A language uses tags around text to indicate how that text should be formatted. Which
characteristic describes a language having such tags? - ANSWERMarkup
What is a characteristic of a compiled language? - ANSWERConverts to machine
language before running
What is a characteristic of an interpreted language? - ANSWERRuns easily on different
kinds of machines
function P(integer x) returns integer y y = 2 * x What does P(5) evaluate to? -
ANSWER10
Function F() Put "Hey" to output What entire output appears after three successive calls
to F()? - ANSWERHeyHeyHey
What is a valid user-defined function name? - ANSWERAny valid identifier
A function MyFct has an input x and an output z. What does MyFct return? - ANSWERz
only
What is the return value of a function? - ANSWEROutput of a function
A program should continue accepting input numbers, adding each to a sum, until a 0 is
input. Which control structure should be used? - ANSWERWhile loop