Programming Logic and Design
Which structure is a logical design that controls the order in which a set of statements executes? A) Control B) Sequence C) Module D) Terminal E) None of these
A) Control
Which type of data file access allows access to any piece of data in the file without reading the data that comes before it? A) Direct access B) Sequential access C) Input access D) Output access E) None of these
A) Direct access
Which of the following is not an example of operating system software? A) Microsoft Word B) Windows Vista C) Linux D) Mac OS X E) None of these
A) Microsoft Word
Which of the following operators reverses the logic of its operand? A) NOT B) AND C) OR D) All of these E) None of these
A) NOT
What term is used in the ending terminal symbol of a function flowchart? A) Return B) End C) Function End D) Function Return E) None of these
A) Return
Two-dimensional arrays can be thought of as containing ________. A) Rows and columns B) Lines and pages C) Rows and lines D) Lines and columns E) Rows and pages
A) Rows and columns
Which is the simplest search technique to use to find an item in an array? A) Sequential B) Binary C) Bubble D) Select E) None of these
A) Sequential
True/False: A While loop repeats infinitely when there is no statement inside the loop body that makes the test condition false. A) True B) False
A) True
True/False: A sequence of characters that is used as data is called a string in programming. A) True B) False
A) True
True/False: Decision structures are also known as selection structures. A) True B) False
A) True
True/False: If you mistakenly write pseudocode into an editor for an actual programming language, such as Python or Visual Basic, errors will result. A) True B) False
A) True
True/False: In an expression with an OR operator, it does not matter which sub expression is true for the compound expression to be true. A) True B) False
A) True
True/False: Modules can be written for commonly needed tasks, and those modules can be incorporated into each program that needs them. A) True B) False
A) True
True/False: Multiple-dimensional arrays can be used to model data that occurs in multiple sets. A) True B) False
A) True
True/False: Programmers use pseudocode to create "mock-ups" of programs because they do not have to worry about syntax rules. A) True B) False
A) True
True/False: The CPU understands instructions in machine language, which are written in binary. A) True B) False
A) True
True/False: The While loop is known as a pretest loop, which means it tests its condition before performing an iteration. A) True B) False
A) True
True/False: The first line of the case structure starts with the word CASE followed by the test expression. A) True B) False
A) True
True/False: The function body follows the function header in a function definition. A) True B) False
A) True
True/False: The parameter list that accepts arguments is optional in a function definition. A) True B) False
A) True
True/False: When an argument is passed by value, the communication channel works only in one direction. A) True B) False
A) True
True/False: When an input file is opened, the read position is initially set to the first item in the file. A) True B) False
A) True
True/False: When processing the data in a two-dimensional array, each element has two subscripts. A) True B) False
A) True
When an argument is passed by ________, it is not affected by a change of the content of the parameter variable. A) Value B) Constant C) Reference D) Variable E) None of these
A) Value
The value of the expression 12 - 4 * 3 / 2 + 9 is ________. A) 21 B) 15 C) -6 D) 2.18 E) None of these
B) 15
What two logical operators perform short-circuit evaluation? A) NOT and OR B) AND and OR C) AND and NOT D) All of these E) None of these
B) AND and OR
The following is an example of what type of statement: Set rate = 5.75 A) Declaration B) Assignment C) Input D) Output E) None of these
B) Assignment
Which search algorithm uses three variables to mark positions within the array as it searches for the searchValue? A) Sequential B) Binary C) Parallel D) Linear E) None of these
B) Binary
What type of loop uses a Boolean expression to control the number of times that it repeats a statement or set of statements? A) Count-controlled B) Condition-controlled C) While D) Do-while E) Do-until
B) Condition-controlled
True/False: A file with the extension .doc usually indicates that the file contains a note written by a doctor. A) True B) False
B) False
True/False: A module can have two variables of the same name because they are within the same scope. A) True B) False
B) False
True/False: All types of data files are viewable in a text editor. A) True B) False
B) False
True/False: If array name contains a list of names, name[1] is the name of the first person. A) True B) False
B) False
True/False: In a binary search, if the search fails to find the item on the first attempt, then there are 999 elements left to search in an array of 1000 elements. A) True B) False
B) False
True/False: In the For statement, you can only use positive integers as step values. A) True B) False
B) False
True/False: Most programs written in a high-level language need to be translated into machine language. A) True B) False
B) False
True/False: One of the advantages of two- or more dimensional arrays is that the data values can be of two or more data types. A) True B) False
B) False
True/False: The While loop will never execute if its condition is true to start with. A) True B) False
B) False
True/False: The arguments in a module call and the parameters listed in the module header must be of compatible data types. A) True B) False
B) False
True/False: The bubble sort is limited to arranging data only in acceding order. A) True B) False
B) False
True/False: The expressions (a + b) / c and a + b / c will always yield identical results. A) True B) False
B) False
True/False: The number of arguments that can be passed to a function are limited in most programming languages. A) True B) False
B) False
True/False: The sequential search algorithm is simple and most efficient to use with a large data array. A) True B) False
B) False
True/False: The short-circuit evaluation is performed with expressions containing any logical operators. A) True B) False
B) False
True/False: The swap module is executed with three arguments to correctly swap the elements in an array. A) True B) False
B) False
True/False: The term "input file" is used to describe a file that data is written to. A) True B) False
B) False
True/False: The term "software" refers to all the physical devices, or components, that a computer is made of. A) True B) False
B) False
True/False: The toInteger function accepts a real number as its argument and preserves any fractional part in the returned number. A) True B) False
B) False
The ________ is a diagram that graphically depicts the steps that take place in a program. A) Program B) Flowchart C) Algorithm D) Code E) Pseudocode
B) Flowchart
The ________ operator is a unary operator, as it works with only one operand. A) AND B) NOT C) OR D) All of these E) None of these
B) NOT
When a piece of data is written to a file, it is copied from a variable in ________ to the file. A) cyberspace B) RAM C) flash memory D) All of these E) None of these
B) RAM
What type of operators are the following? > < >= => == != A) Boolean B) Relational C) Logical D) Mathematical E) None of these
B) Relational
The amount by which the counter variable is incremented in a For loop is known as what? A) Incremental value B) Step amount C) Counter differential D) Additive Index E) None of these
B) Step amount
The term used for a set of rules that must be strictly followed when writing a program is ________. A) Semantics B) Syntax C) Grammar D) Key words E) Punctuations
B) Syntax
How many subscripts do you need to access one element in a two-dimensional array? A) One B) Two C) Three D) Four E) None of these
B) Two
What is the term used for the value that is searched for in a search algorithm? A) stringValue B) searchValue C) matchValue D) flag E) None of these
B) searchValue
In general, how many types of files are there? A) one B) two C) three D) five E) None of these
B) two
the variable r would contain the value _____ after the execution of the following statement. Declare Interger i=12 Declare real r Set r= toReal(i) A) 12 B) 1.2 C) 12.0 D) 0.12 E) None of these
C) 12.0
Processing a large number of items in a(n) ________ is usually easier than processing a large number of items stored in separate variables. A) Constant B) Variable C) Array D) Loop E) None of these
C) Array
The function ________ comprises one or more statements that are executed when the function is called. A) Definition B) Header C) Body D) Datatype E) None of these
C) Body
The process known as the ________ cycle is used by the CPU to execute instructions in a program. A) Decode- fetch-execute B) Decode-execute-fetch C) Fetch-decode-execute D) Fetch-execute-decode E) Execute-fetch-decode
C) Fetch-decode-execute
What is a short sequence of characters that appears at the end of a filename and is preceded by a period called? A) File extension B) Filetype extension C) Filename extension D) Fileaccess extension E) None of these
C) Filename extension
Which loop statement does not contain an increment statement but automatically increments the counter at the end of each iteration? A) Do-While B) Do-Until C) For D) While E) None of these
C) For
What phrase is placed in the starting terminal symbol of a module in a flowchart? A) Start B) Begin C) Name of the module D) Continue E) Resume
C) Name of the module
What symbol is used to mark the beginning and end of a string? A) Slash B) Asterisk C) Quotation D) Comma E) Question
C) Quotation
In a count-controlled loop, the counter performs ________ action(s). A) One B) Two C) Three D) Four E) Five
C) Three
Which of the following is a sorting algorithm? A) Bubble sort B) Selection sort C) Insertion sort D) All of these E) None of these
D) All of these
Which of the following statements is true after the execution of the following statement? set needANumber= random (5,10) A) A random number is generated between 5 and 10. B) The random number is assigned to the variable needANumber. C) The numbers 5 and 10 are the arguments of the random number function. D) All of these E) None of these
D) All of these
What is the terminology used when a task is temporarily interrupted as a control variable reaches a specific value? A) Control break B) End of page C) Break D) Control break logic E) None of these
D) Control break logic
________ was the first high-level programming language designed that could perform complex mathematical calculations. A) COBOL B) C++ C) Java D) FORTRAN E) Ada
D) FORTRAN
Which type of variable is not recommended to be used in programs because they make programs hard to understand and debug? A) Local B) Pass by value C) Reference D) Global E) Pass by reference
D) Global
Which type of variable is visible to every module and the entire program? A) Local B) Pass by value C) Reference D) Global E) Pass by reference
D) Global
What is the term used to describe a file that data is read from? A) In file B) Out file C) Output file D) Input file E) None of these
D) Input file
A three-dimensional array can be thought of as ________ of two-dimensional arrays. A) Rows B) Columns C) Lines D) Pages E) None of these
D) Pages
Which symbol is used for an assignment statement in a flowchart? A) Processing B) I/O C) Terminal D) Parallelogram E) None of these
D) Parallelogram
Modules are commonly called what? A) Procedures B) Subroutines C) Subprograms D) Methods E) All of these
E) All of these
Random numbers are commonly used in which type of program? A) Games B) Simulations C) Statistical analysis D) Data encryption E) All of these
E) All of these
Which of the following devices is a computer? A) iPods® B) Car navigation systems C) BlackBerries® D) Cell phones E) All of these
E) All of these
What is the first step of the program development cycle? A) Write the code B) Correct syntax errors C) Debug the code D) Test the executable code E) Design the program
E) Design the program
The smallest storage location in a computer's memory is known as a ________. A) byte B) word C) letter D) switch E) bit
E) bit
how many times will the following loop iterate? Set k=1 While k <=5 Display k End While
infinite
How many times will the following loop iterate? Set k=1 Do Display K Set k= k + 1 Until k >1
one
Which of the following sorting algorithms is the least efficient? A) Bubble sort B) Insertion sort C) Selection sort D) All of these E) None of these
A) Bubble sort
Which operator is best to determine whether x contains a value in the range of 10 through 57? A) AND B) NOT C) OR D) == E) None of these
A) AND
Which of the following search algorithms should be used on large arrays if speed is important? A) Binary B) Sequential C) Bubble D) Selection E) Insertion
A) Binary
The module definition comprises the module header and the module ________. A) Body B) Statements C) Call D) Arguments E) Parameters
A) Body