Quiz
Chapter 5 to 7 TF & MC
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (89)
1Which structure causes a statement or set of statements to execute repeatedly?
- ARepetition
- BSequence
- CStart Over
- DDecision
- ENone of the Above
2The conditions that control a loop repetition are Boolean expressions.
- ATrue
- BFalse
3The While loop gets its name from the way it works: While a condition is false, do some task.
- ATrue
- BFalse
4A While loop repeats infinitely when there is no statement inside the loop body that makes the test condition false.
- ATrue
- BFalse
5The While and For loops are considered pretest loops because they test the condition before processing the statement(s) in the loop body.
- ATrue
- BFalse
6A posttest loop does not perform any iteration if the Boolean expression is false to begin with.
- ATrue
- BFalse
7A condition-controlled loop can be used to iterate the body of the loop a specific number of times.
- ATrue
- BFalse
8In the For statement, you can only use positive integers as step values.
- ATrue
- BFalse
9In a For loop, the programmer should know the exact number of iterations the loop must perform before writing the code.
- ATrue
- BFalse
10Modules can be called from statements in the body of any loop.
- ATrue
- BFalse
11The While loop is known as a pretest loop, which means it tests its condition before performing an iteration.
- ATrue
- BFalse
12The While loop will never execute if its condition is true to start with.
- ATrue
- BFalse
13Any loop that can be written as a Do-While loop can also be written as a While loop.
- ATrue
- BFalse
14What type of loop uses a Boolean expression to control the number of times that it repeats a statement or set of statements?
- ADo-while
- BWhile
- CCondition-controlled
- DCount-controlled
- EDo-until
15Which pair of loops causes a statement or set of statements to repeat as long as a condition is true?
- ADo-While and For
- BDo-Until and For
- CDo-While and Do-Until
- DWhile and Do-While
- EWhile and Do-Until
16Which loop repeats a statement or set of statements as long as the Boolean expression is false?
- AWhile
- BDo While
- CFor
- DDo Until
- ENone of the above
17The statements that appear between the While and the End While clauses are called the ________.
- ALoop
- BStatement
- CBody of the Loop
- DLoop statements
- Ewhile statements
18Which of these are posttest loops?
- ADo While and For
- BWhile and Do Until
- CWhile and Do While
- DDo While and Do Until
- EDo Until and For
19In a count-controlled loop, the counter performs ________ action(s).
- ATwo
- BOne
- CFive
- DFour
- EThree
20Which loop statement does not contain an increment statement but automatically increments the counter at the end of each iteration?
- ADo-While
- BFor
- CDo Until
- DWhile
- ENone of the Above
21The following is an example of what type of loop?
For k = 7 To maxValue- AWhile
- BCondition-controlled
- CDo-Until
- DCount-controlled
- EDo While
22The ________ represents a special value that marks the end of a list of values.
- AStop
- BSentinel
- CEnd
- DAny of the Above
- ENone of the Above
23Which loop is specifically designed to initialize, test, and increment a counter variable?
- ADo-While
- BFor
- CDo-Until
- DWhile
- ENone of the Above
24How many times will the following loop iterate?
For j = 1 To 5 Step 2
Display j
End For- AFour
- BFive
- CThree
- DNo iterations
- EInfinite
25How many times will the following loop iterate?
Set k = 1
While k <= 5
Display k
End While- AInfinite
- BNo iterations
- CTwo
- DThree
- EFive
26How many times will the following loop iterate?
Set k = 1
Do
Display k
Set k = k + 1
Until k > 1- AThree
- BOne
- CInfinite
- DTwo
- ENo iterations
27The amount by which the counter variable is incremented in a For loop is known as what?
- AAdditive Index
- BCounter differential
- CIncremental value
- Dstep amount
- Enone of the above
28To ________ a variable means to decrease its value.
- ANegate
- Bdecrement
- Cincrement
- Dreference
- Einitialize
29A loop that accumulates a total as it reads each number from a series is often said to keep a what?
- Amaximum value
- Baccumulation
- Caverage
- Drunning total
- Enone of the above
30The term ________ is used to describe any mechanism that accepts input, performs some operation that cannot be seen on the input, and produces output.
- AWhite Box
- BBlack Cube
- CWhite Cube
- DBlack Box
- ENone of the Above
31Library functions are built into the programming language, and can be called any time they are needed.
- ATrue
- BFalse
32The parameter list that accepts arguments is optional in a function definition.
- ATrue
- BFalse
33The input column in the IPO chart describes the process the function performs on the input data.
- ATrue
- BFalse
34Most programming languages let you assign an integer value to a real variable without causing an error.
- ATrue
- BFalse
35The library functions in every programming language have the same function names and accept the same arguments, but their behaviors might differ slightly.
- ATrue
- BFalse
36The number of arguments that can be passed to a function are limited in most programming languages.
- ATrue
- BFalse
37Programming languages have not yet started to support localization.
- ATrue
- BFalse
38Random numbers are useful in simulation programs where the computer must randomly decide how an object will behave.
- ATrue
- BFalse
39The function body follows the function header in a function definition.
- ATrue
- BFalse
40The toInteger function accepts a real number as its argument and preserves any fractional part in the returned number.
- ATrue
- BFalse
41When a function finishes, it returns a value back to the part of the program that called it.
- ATrue
- BFalse
42The value that is returned from a function can be used just like any other value.
- ATrue
- BFalse
43The function ________ specifies the return data type, name of the function, and the parameter variable(s).
- AStatement
- BDefinition
- CBody
- DHeader
- ENone of the Above
44What term is used in the ending terminal symbol of a function flowchart?
- AReturn
- BFunction End
- CFunction Return
- DEnd
- ENone of the Above
45In the IPO chart, the ________ column describes the data that is passed to the function as arguments.
- AProcess
- BFunction
- CInput
- DOutput
- ENone of the Above
46The ________ function does the same thing as using the mathematical ∧ operator.
- Around
- Bpow
- Ccos
- Dsqrt
- Eabs
47Which function accepts two strings as arguments, returns "True" if the first string contains the second string, and otherwise returns "False"?
- Aconcatenate
- BContains
- CSubstring
- DAppend
- ENone of the Above
48Which function returns a string within a string?
- AConcatenate
- BSubstring
- CAppend
- DContains
- ENone of the Above
49Which of the following errors occur when a real value is attempted to be assigned to an integer variable?
- Atype mismatch
- Bconversion
- CInteger value
- Dassignment
- ENone of the Above
50Which of the following statements is true after the execution of the following statement?
y = abs(x)- Ay contains the absolute value of x
- Bx contains the absolute value of the value in y
- Cx contains the absolute value of y
- Dy contains the absolute value of the value in x
- Enone of the above
51The variable r would contain the value ________ after the execution of the following statement.
Declare Integer i = 12
Declare Real r
Set r = toReal (i)- A0.12
- B1.2
- C12.0
- D12
- ENone of the Above
52A ________ is a module that returns a value back to the part of the program that called it.
- AFor
- BLoop
- CFunction
- DWhile
- ENone of the Above
53Which of the following statements is true after the execution of the following statement?
Set needANumber = random(5, 10)- AThe random number is assigned to the variable needANumber
- BThe numbers 5 and 10 are the arguments of the random number function
- CA random number is generated between 5 and 10
- DAll of the Above
- ENone of the Above
54The function ________ comprises one or more statements that are executed when the function is called.
- ADefinition
- BBody
- CHeader
- DDatatype
- ENone of the Above
55Examine the following piece of code and determine the data type of the function's return value.
Function Real sum (Integer num1, Integer num2)
Declare Integer result
Set result = num1 + num2
Return result
End Function- AReal
- BSum
- Cresult
- DInteger
- ENone of the Above
56Examine the following piece of code and state the return value of the function.
Function Integer product (Integer num1, Integer num2)
Declare Real result
Set result = num1 + num2
Return result
End Function- AReal
- BResult
- CInteger
- DProduct
- ENone of the Above
57Random numbers are commonly used in which type of program?
- ASimulations
- BGames
- CStatistical analysis
- DData encryption
- EAll of the Above
58What is the data type of the value returned by the random library function?
- ABoolean
- BString
- CReal
- DInteger
- ENone of the Above
59Which of the following is optional when writing a function definition?
- AFunction body
- BFunction header
- CReturn statement
- DData Type
- ENone of the Above
60What is the famous saying among computer programmers that refers to the fact that computers cannot tell the difference between good and bad data?
- AGarbage output is from garbage inputted
- BGarbage input, garbage output
- CGarbage out is from garbage in
- DGarbage in, Garbage out
- ENone of the Above
61An input validation loop is sometimes called an error handler.
- ATrue
- BFalse
62If the user provides bad data as input to a program, the program will correct the data and produce output.
- ATrue
- BFalse
63Programs should be designed such that all input is inspected before it is processed and bad data is discarded.
- ATrue
- BFalse
64The priming read is needed when a pretest loop is executed.
- ATrue
- BFalse
65Often a Boolean function can be used to validate data.
- ATrue
- BFalse
66The empty read is not an obvious input error and is a difficult one to handle.
- ATrue
- BFalse
67The practice of anticipating errors that can happen while a program is running and designing the program to avoid those errors is called defensive programming.
- ATrue
- BFalse
68Checking for accuracy of data, even when the user provides the right type of data, is part of input validation.
- ATrue
- BFalse
69Checking for reasonableness of data is programmatically impossible.
- ATrue
- BFalse
70When using string input validation it is wise to use the library function to convert the input to upper case or lowercase so case-sensitive string comparisons can be made
- ATrue
- BFalse
71Input validation is not needed if the program is well designed.
- ATrue
- BFalse
72Most programming languages do not provide library functions that can be used for input validation.
- ATrue
- BFalse
73The purpose of the ________ is to get the first input value for the validation of a loop.
- AGIGO
- BWrite
- CPriming read
- DRead
- ENone of the Above
74Designing a program to avoid common errors is called ________ programming.
- ADefective
- BDefensive
- CDirect
- DDetective
- ENone of the above
75________ happens when an input operation attempts to read data, but there is no data to read.
- AInput error
- BNo data
- CEmpty Input
- DError Reading
- ENone of the Above
76Input ________ is commonly done with a loop that iterates as long as an input variable contains bad data.
- AValidation
- BCheck
- CExamination
- DPriming
- ENone of the Above
77________ is sometimes the term used for input validation.
- AInput trap
- BError trap
- CInput error
- DData error
- ENone of the Above
78In addition to using loops to validate data, ________ can also be used to validate data.
- AString Function
- BInteger Function
- CBoolean Function
- DReal Function
- ENone of the Above
79Which of the following is not a check for data accuracy?
- AZip codes in correct format and valid
- BTime measurements
- CSalary within the allowable range
- DAll of the above are checks for data accuracy
- ENone of the Above
80Which of the following is not an input validation error type?
- AIncorrect data type
- BInaccurate data
- CEmpty input
- DAll of the above are input validation error type
- ENone of the Above
81What is the first step to use in detecting data type mismatch errors?
- AConvert to the desired data type
- Bread the input as a string
- CDisplay error message
- DDetermine whether it can be converted
- ENone of the Above
82The priming read is placed ________ the loop.
- ABefore
- BBelow
- CInside and below
- DInside and before
- EInside
83Which of the following statements is true about this Boolean expression?
score < 0 AND score > 100- AThis expression is true for number less than 0
- BThis expression is true for numbers greater than 100
- CThis expression is true for numbers between 0 and 100
- DThis expression would never be true
- ENone of the Above
84What type of function can be used to see if the password entered has the minimum number of characters?
- ATrigonometric
- BBoolean
- CMathematical
- DString
- ENone of the Above
85If, when asked for a date of birth, the user enters a future date, this error should be caught by a ________ check.
- ADay
- BTime
- CDate
- DReasonableness
- ENone of the Above
86Accepting February 29 in only a leap year is a check that is done by a ________ check
- ACalendar
- BDate
- CDay
- DMonth
- ENone of the Above
87Which of the following library functions could be used to validate the length of a string?
- AisString
- Blength
- CtoUpper
- Drandom
- ENone of the Above
88Which of the following library functions could be used to validate that the correct data type was input for an amount of money?
- AisString
- BisInteger
- CisReal
- DtoLower
- EAll of the Above
89Which of the following library functions could be used to simplify the process of string validation?
- AtoUpper
- BisReal
- CisInteger
- Dlength
- ENone of the Above
Information
- Description
- Quiz on Chapter 5 to 7 TF & MC, created by Azevinho on 30/09/2015.
- Author
- Azevinho
- Language
- English
- Views
- 0
- Rating
- No ratings yet Rate this quiz