Title: Test 1
Course: COP 1510 Programming Concepts > Section: Module 5 - Input Validation

Q: ________ was the first high-level programming language designed that could perform complex mathematical calculations.
- COBOL
- C++
- Java
- FORTRAN
- Ada
A: FORTRAN

Q: The term used for a set of rules that must be strictly followed when writing a program is ________.
- Semantics
- Syntax
- Grammar
- Key words
- Punctuations
A: Syntax

Q: The process known as the ________ cycle is used by the CPU to execute instructions in a program.
- Decode- fetch-execute
- Decode-execute-fetch
- Fetch-decode-execute
- Fetch-execute-decode
- Execute-fetch-decode
A: Fetch-decode-execute

Q: Which computer language uses short words known as mnemonics for writing programs?
- Assembly
- Java
- C#
- Pascal
- Visual Basic
A: Assembly

Q: Programs that make a computer useful for everyday tasks are known as ________.
- System Software
- Operation System
- Application Software
- Utility Programs
- None of these
A: Application Software

Q: What function(s) does an interpreter perform with the instructions in a high-level programming language?
- Translates
- Compiles
- Compiles and Translates
- Executes
- Translates and Execute
A: Translates and Execute

Q: Which of the following is not an example of operating system software?
- Microsoft Word
- Windows Vista
- Linux
- Mac OS X
- None of these
A: Microsoft Word

Q: True/False: Most programs written in a high-level language need to be translated into machine language.
- True
- False
A: False

Q: True/False: Each instruction written in a high-level programming language is called a statement.
- True
- False
A: True

Q: True/False: Assembly language is referred to as a low-level language because it is close to the C++ language.
- True
- False
A: False

Q: True/False: The instruction set for a microprocessor is unique and is typically understood only by the microprocessors of the same brand.
- True
- False
A: True

Q: Which of the following devices is a computer?
- iPods®
- Car navigation systems
- BlackBerries®
- Cell phones
- All of these
A: All of these

Q: Data is not recorded magnetically on a(n) ________, but is encoded as a series of pits on the disk surface.
- disk drive
- floppy disk
- USB drive
- optical disk
- None of these
A: optical disk

Q: What term can be used to describe anything that uses binary numbers?
- digital
- computer
- processor
- machine language
- mnemonic
A: digital

Q: True/False: Programs that use an interpreter generally execute faster than compiled programs because they are already entirely translated into machine language when executed.
- True
- False
A: False

Q: What is the largest value that can be stored in one byte?
- 255
- 128
- 8
- 65535
- 16
A: 255

Q: The smallest storage location in a computer's memory is known as a ________.
- byte
- word
- letter
- switch
- bit
A: bit

Q: The disk drive is a secondary storage device that stores data by ________ encoding it onto circular disks.
- electrically
- magnetically
- digitally
- optically
- None of these
A: magnetically

Q: A computer system consists of all of the following, except ________.
- Central processing system
- Main memory
- Operating System
- Input and Output devices
- Secondary storage devices
A: Operating System

Q: Which of the following is not a microprocessor manufacturing company?
- Intel
- Dell
- AMD
- Motorola
- None of these
A: Dell

- C++
- Assembly language
- JAVA
- Machine language
- C #
A: Machine language

Q: What is the encoding technique called that is used to store negative numbers in the computer's memory?
- Unicode
- ASCII
- Floating-point notation
- Twos complement
- None of these
A: Twos complement

Q: The ________ coding scheme contains a set of 128 numeric codes that are used to represent characters in a computer's memory.
- Unicode
- ASCII
- ENIAC
- Binary numbering
- Twos compliment
A: ASCII

Q: Which loop repeats a statement or set of statements as long as the Boolean expression is false?
- Do-While
- Do-Until
- For
- While
- None of these
A: Do-Until

Q: The statements that appear between the While and the End While clauses are called the ________.
- Statements
- Loop
- Body of the loop
- Loop statements
- While statements
A: Body of the loop

Q: What type of loop uses a Boolean expression to control the number of times that it repeats a statement or set of statements?
- Count-controlled
- Condition-controlled
- While
- Do-while
- Do-until
A: Condition-controlled

Q: Which pair of loops causes a statement or set of statements to repeat as long as a condition is true?
- While and Do-While
- While and Do-Until
- Do-While and Do-Until
- Do-Until and For
- Do-While and For
A: While and Do-While

Q: True/False: Decision structures are also known as selection structures.
- True
- False
A: True

Q: Which structure causes a statement or set of statements to execute repeatedly?
- Start Over
- Sequence
- Decision
- Repetition
- None of these
A: Repetition

Q: True/False: The short-circuit evaluation is performed with expressions containing any logical operators.
- True
- False
A: False

Q: True/False: Although the sequence structure is heavily used in programming, it cannot handle every type of task.
- True
- False
A: True

- Three
- Four
- Five
- No iterations
- Infinite
A: Three

- Three
- Two
- Five
- No iterations
- Infinite
A: Infinite

Q: The ________ represents a special value that marks the end of a list of values.
- Sentinel
- Stop
- End
- Any of these
- None of these
A: Sentinel

Q: Which loop is specifically designed to initialize, test, and increment a counter variable?
- Do-While
- Do-Until
- For
- While
- None of these
A: For

Q: Which loop statement does not contain an increment statement but automatically increments the counter at the end of each iteration?
- Do-While
- Do-Until
- For
- While
- None of these
A: For

- Count-controlled
- Condition-controlled
- While
- Do-while
- Do-until
A: Count-controlled

Q: Which of these are posttest loops?
- While and Do-While
- While and Do-Until
- Do-While and Do-Until
- Do-Until and For
- Do-While and For
A: Do-While and Do-Until

Q: In a count-controlled loop, the counter performs ________ action(s).
- One
- Two
- Three
- Four
- Five
A: Three

Q: True/False: A While loop repeats infinitely when there is no statement inside the loop body that makes the test condition false.
- True
- False
A: True

Q: True/False: The While loop gets its name from the way it works: While a condition is false, do some task.
- True
- False
A: False

Q: True/False: The conditions that control a loop repetition are Boolean expressions.
- True
- False
A: True

Q: A loop that accumulates a total as it reads each number from a series is often said to keep a what?
- Average
- Maximum value
- Running total
- Accumulation
- None of these
A: Running total

Q: To ________ a variable means to decrease its value.
- Negate
- Increment
- Initialize
- Decrement
- Reference
A: Decrement

Q: The amount by which the counter variable is incremented in a For loop is known as what?
- Incremental value
- Step amount
- Counter differential
- Additive Index
- None of these
A: Step amount

- One
- Two
- Three
- No iterations
- Infinite
A: One

- One
- Two
- Five
- No iterations
- Infinite
A: No iterations

Q: True/False: The While loop will never execute if its condition is true to start with.
- True
- False
A: False

Q: True/False: The While loop is known as a pretest loop, which means it tests its condition before performing an iteration.
- True
- False
A: True

Q: True/False: Modules can be called from statements in the body of any loop.
- True
- False
A: True

Q: True/False: In a For loop, the programmer should know the exact number of iterations the loop must perform before writing the code.
- True
- False
A: False

Q: True/False: In the For statement, you can only use positive integers as step values.
- True
- False
A: False

Q: True/False: A condition-controlled loop can be used to iterate the body of the loop a specific number of times.
- True
- False
A: True

Q: True/False: A posttest loop does not perform any iteration if the Boolean expression is false to begin with.
- True
- False
A: False

Q: True/False: The While and For loops are considered pretest loops because they test the condition before processing the statement(s) in the loop body.
- True
- False
A: True

Q: ________ happens when an input operation attempts to read data, but there is no data to read.
- No data
- Error reading
- Input error
- Empty input
- None of these
A: Empty input

Q: Input ________ is commonly done with a loop that iterates as long as an input variable contains bad data.
- Check
- Validation
- Examination
- Priming
- None of these
A: Validation

Q: ________ is sometimes the term used for input validation.
- Input error
- Error trap
- Input trap
- Data error
- None of these
A: Error trap

Q: In addition to using loops to validate data, ________ can also be used to validate data.
- String Function
- Real Function
- Integer Function
- Boolean Function
- None of these
A: Boolean Function

Q: True/False: Any loop that can be written as a Do-While loop can also be written as a While loop.
- True
- False
A: True

Q: What is the famous saying among computer programmers that refers to the fact that computers cannot tell the difference between good and bad data?
- Garbage input, garbage output
- Garbage in, garbage out
- Garbage output is from garbage inputted
- Garbage out is from garbage in
- None of these
A: Garbage in, garbage out

Q: The purpose of the ________ is to get the first input value for the validation of a loop.
- GIGO
- Read
- Priming read
- Write
- None of these
A: Priming read

Q: Designing a program to avoid common errors is called ________ programming.
- Defensive
- Direct
- Defective
- Detective
- None of these
A: Defensive

Q: Which of the following statements is true about this Boolean expression?
- This expression is true for numbers between 0 and 100.
- This expression is true for numbers greater than 100.
- This expression is true for numbers less than 0.
- This expression would never be true.
- None of these
A: This expression would never be true.

Q: What type of function can be used to see if the password entered has the minimum number of characters?
- Mathematical
- Boolean
- String
- Trigonometric
- None of these
A: String

Q: If, when asked for a date of birth, the user enters a future date, this error should be caught by a ________ check.
- Date
- Time
- Day
- Reasonableness
- None of these
A: Reasonableness

Q: Accepting February 29 in only a leap year is a check that is done by a ________ check.
- Date
- Day
- Month
- Calendar
- None of these
A: Date

Q: Which of the following is not a check for data accuracy?
- Salary within the allowable range
- Time measurements
- ZIP codes in correct format and valid
- All of these are checks for data accuracy
- None of these
A: All of these are checks for data accuracy

Q: Which of the following is not an input validation error type?
- Empty input
- Incorrect data type
- Inaccurate data
- All of these are input validation error types
- None of these
A: All of these are input validation error types

Q: What is the first step to use in detecting data type mismatch errors?
- Read the input as a string
- Convert to the desired data type
- Determine whether it can be converted
- Display error message
- None of these
A: Read the input as a string

Q: The priming read is placed ________ the loop.
- Inside
- Before
- Below
- Inside and before
- Inside and below
A: Before

Q: True/False: Programs should be designed such that all input is inspected before it is processed and bad data is discarded.
- True
- False
A: True

Q: True/False: If the user provides bad data as input to a program, the program will correct the data and produce output.
- True
- False
A: False

Q: True/False: Often a Boolean function can be used to validate data.
- True
- False
A: True

Q: True/False: The priming read is needed when a pretest loop is executed.
- True
- False
A: True

Q: Which of the following library functions could be used to validate that the correct data type was input for an amount of money?
- isInteger
- isString
- toLower
- isReal
- All of these
A: isReal

Q: Which of the following library functions could be used to validate the length of a string?
- random
- isString
- length
- toUpper
- None of these
A: length

Q: True/False: An input validation loop is sometimes called an error handler.
- True
- False
A: True

Q: Which of the following library functions could be used to simplify the process of string validation?
- length
- toUpper
- isReal
- isInteger
- None of these
A: toUpper

Q: True/False: Input validation is not needed if the program is well designed.
- True
- False
A: False

Q: True/False: When 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.
- True
- False
A: True

Q: Have you read the syllabus completely and thoroughly?
- Yes
- No
A: Yes

Q: True/False: Most programming languages do not provide library functions that can be used for input validation.
- True
- False
A: False

Q: True/False: The practice of anticipating errors that can happen while a program is running and designing the program to avoid those errors is called defensive programming.
- True
- False
A: True

Q: True/False: The empty read is not an obvious input error and is a difficult one to handle.
- True
- False
A: False

Q: True/False: Checking for reasonableness of data is programmatically impossible.
- True
- False
A: False

Q: True/False: Checking for accuracy of data, even when the user provides the right type of data, is part of input validation.
- True
- False
A: True

Q: True/False: The main reason for using secondary storage is to hold data for long periods of time, even when the power to the computer is turned off.
- True
- False
A: True

Q: True/False: RAM is a volatile memory used for temporary storage while a program is running.
- True
- False
A: True

Q: True/False: The CPU understands instructions in machine language, which are written in binary.
- True
- False
A: True

Q: True/False: A bit that is turned off is represented by the value -1.
- True
- False
A: False

Q: True/False: The term "software" refers to all the physical devices, or components, that a computer is made of.
- True
- False
A: False

Q: Which error produces incorrect results but does not prevent the program from running?
- syntax
- logic
- grammatical
- human
- None of these
A: logic

Q: True/False: A computer is not a single device, but a system of devices that work together to manipulate data according to the instructions provided.
- True
- False
A: True

Q: Do you accept all the items in the syllabus?
- Yes
- No
A: Yes

Q: True/False: Computers are designed to do just one job.
- True
- False
A: False

Q: The ________ is a diagram that graphically depicts the steps that take place in a program.
- Program
- Flowchart
- Algorithm
- Code
- Pseudocode
A: Flowchart

Q: A ________ structure is a set of statements that execute in the order they appear.
- Control
- Repetition
- Decision
- Sequence
- None of these
A: Sequence

Q: The program development cycle is made up of ________ steps that are repeated until no errors can be found in the program.
- Five
- Four
- Three
- Six
- None of these
A: Five

Q: What is the informal language that programmers use to create models of programs that have no syntax rules and are not meant to be compiled or executed?
- Program
- Flowchart
- Algorithm
- Code
- Pseudocode
A: Pseudocode