Which one of the following options refers to a collection of programs that a computer executes?
- Software
- Assembler
- Instructions
- Source code
- Section Ref
- 1.1
- Title
- Which (term) refers to a collection of programs?
- section
- 1.1 What Is Programming?
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-1
Computers are machines that
- Design computer programs
- Execute programs
- Carry out a very narrow range of tasks
- Are imprecise and slow
- Section Ref
- 1.1
- Title
- What kind of machines are computers?
- section
- 1.1 What Is Programming?
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-2
Computer programming is
- The speed with which a computer operates
- The collection of peripheral devices connected to a computer
- The storage of data in the form of words and pictures
- The act of designing and implementing a computer program
- Section Ref
- 1.1
- Title
- What is computer programming?
- section
- 1.1 What Is Programming?
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-3
Consider the following statements regarding computers:
I. Computers can execute a large number of instructions in a fraction of a second.
II. Computer application areas mainly target the research and scientific communities.
III. The physical components of a computer constitute its hardware.
IV. Unlike humans, a computer never gets bored or exhausted on performing repetitive tasks.
Which one of the following options is correct?
- Only III is a valid statement.
- I and III are valid statements.
- I, II, and III are valid statements.
- I, III, and IV are valid statements.
- Section Ref
- 1.1
- Title
- Which statement(s) regarding computers is(are) correct?
- section
- 1.1 What Is Programming?
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-4
Consider the following statements about computer programs:
I. Computer programs can be written by someone who has a basic knowledge of operating a computer.
II. Computer programs can complete complex tasks quickly.
III. Large and complex computer programs are generally written by a group of programmers.
IV. Computer programs are composed of extremely primitive operations.
Which one of the following options is correct?
- II and III are correct statements.
- I, II, III, and IV are correct statements.
- II, III, and IV are correct statements.
- I and IV are correct statements.
- Section Ref
- 1.1
- Title
- Which statement(s) regarding computer programs is(are) correct?
- section
- 1.1 What Is Programming?
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-5
-
Writing the program for a computer game with motion, graphics, and sound usually requires
- one brilliant programmer writing a large number of simple instructions
- a team of programmers writing a few complex instructions
- one brilliant programmer writing a few complex instructions
- a team of programmers writing a large number of simple instructions
- Section Ref
- 1.1
- Title
- Who writes complex programs?
- section
- 1.1 What Is Programming?
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-6
The Central Processing Unit is primarily responsible for
- Performing program control and data processing
- Ensuring data persists when electrical power is turned off
- Enabling a human user to interact with the computer
- Interconnecting computers that are separated by distance
- Section Ref
- 1.2
- Title
- What is the function of a CPU?
- section
- 1.2 The Anatomy of a Computer
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-6
A single silicon chip made from potentially millions of transistors is called
- A Central Processing Unit (CPU)
- Secondary Storage
- A Hard Disk
- An Optical Disk (such as a DVD)
- Section Ref
- 1.2
- Title
- What is a chip with transistors called?
- section
- 1.2 The Anatomy of a Computer
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-7
An example of an output device that interfaces between computers and humans is
- The keyboard
- The mouse
- The speaker
- A microphone
- Section Ref
- 1.2
- Title
- What is an example of an output device that interfaces between humans and computers?
- section
- 1.2 The Anatomy of a Computer
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-8
An example of an input device that interfaces between computers and humans is
- The microphone
- The monitor
- The printer
- The speaker
- Section Ref
- 1.2
- Title
- What is an example of an input device that interfaces between humans and computers?
- section
- 1.2 The Anatomy of a Computer
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-9
Programs that are not running are usually stored
- in the CPU's memory.
- on the computer monitor.
- in secondary storage.
- on a backup device that is in a different physical location from the computer.
- Section Ref
- 1.2
- Title
- Where are programs usually stored when they are not running?
- section
- 1.2 The Anatomy of a Computer
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-10
When a program begins to run,
- It is moved from DVD to hard disk.
- It is moved to the CPU's memory.
- It is moved from the CPU's memory to hard disk.
- It must be connected to a computer network.
- Section Ref
- 1.2
- Title
- What happens when a program begins to run?
- section
- 1.2 The Anatomy of a Computer
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-11
Which one of the following typically provides data persistence without electricity?
I. The CPU's memory
II. The hard disk
III. Secondary storage
- I, II
- I, III
- II, III
- I, II, III
- Section Ref
- 1.2
- Title
- Which storage type provides data persistence without electricity?
- section
- 1.2 The Anatomy of a Computer
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-12
Which best describes the difference between primary and secondary storage?
- primary storage is more expandable, while secondary storage is more flexible
- primary storage is used only by the CPU, while secondary storage is used only by peripherals
- primary storage is simpler to replace than secondary storage if it fails
- primary storage is fast but costly, while secondary is slow, larger and cheaper
- Section Ref
- 1.2
- Title
- Differences between primary and secondary storage
- section
- 1.2 The Anatomy of a Computer
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-14
A network controller is the device in a computer that
- controls the internal network.
- connects the computer to the internet or other network through a wire or wireless.
- connects the CPU to peripherals.
- interfaces between a hard disk and other disks such as CDs and USB drives.
- Section Ref
- 1.2
- Title
- What is a network controller?
- section
- 1.2 The Anatomy of a Computer
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-15
The instruction “1011 0011” for a computer is an example of
- assembly language.
- high-level language.
- bit language.
- machine language.
- Section Ref
- 1.3
- Title
- Computer Instruction Types
- section
- 1.3 Machine Code and Programming Languages
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-18
The C++ Language
- was introduced in the 1980s.
- is commonly used for embedded systems.
- is commonly used for designing system software such as databases.
- All of the above
- Section Ref
- 1.3
- Title
- C++ Usage
- section
- 1.3 Machine Code and Programming Languages
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-19
Consider a scenario in which you develop a C++ program on a computer that has a Pentium processor and compile the program into the corresponding machine language. What step should you take to run the same program on a computer that has a different processor?
- Copy the compiled machine language instructions to the computer that has a different processor.
- Develop the same program again on the computer that has a different processor and recompile the program.
- Recompile the C++ program on the computer that has a different processor.
- You cannot run the program on a computer with a different processor because C++, being a high-level programming language, is machine dependent.
- Section Ref
- 1.3
- Title
- What step should you take to run a C++ program on a (different) processor?
- section
- 1.3 Machine Code and Programming Languages
- Difficulty
- Medium
- id
- testbank-bc-2-ch01-13
High level programming languages
- Are made up primarily of ones and zeros
- Are independent of the underlying hardware
- Are not standardized
- Use syntax that is close to the underlying hardware's instruction set
- Section Ref
- 1.3
- Title
- What are the characteristics of high level programming languages?
- section
- 1.3 Machine Code and Programming Languages
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-14
Which one of the following translates high-level descriptions into machine code?
- Assembler
- Linker
- Compiler
- Editor
- Section Ref
- 1.3
- Title
- Which translates high-level descriptions into machine code?
- section
- 1.3 Machine Code and Programming Languages
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-15
Computer scientists have devised something that allows programmers to describe tasks in words that are closer to the syntax of the problems being solved. This is called
- Embedded system
- Machine instructions
- High level programming language
- Compiler
- Section Ref
- 1.3
- Title
- What are the tools used to describe and solve high-level problems?
- section
- 1.3 Machine Code and Programming Languages
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-16
Small computers that control devices like automobile engines or cellular telephones are called
- Embedded systems
- Compilers
- CPUs
- Peripheral devices
- Section Ref
- 1.3
- Title
- What are small control devices called?
- section
- 1.3 Machine Code and Programming Languages
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-17
What is one of the benefits of using a high-level programming language like C++?
- Its syntax is very similar to the hardware instruction set
- No tools other than a text editor are required for programming
- Statements in the high-level language are just like English
- Problems solved in a high-level language are independent of the underlying computer hardware
- Section Ref
- 1.3
- Title
- What are the benefits of using high level languages?
- section
- 1.3 Machine Code and Programming Languages
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-18
What name do you use for small computers that are programmed to control automobile engines and cell phones?
- Mainframe computers
- Mini computers
- Embedded systems
- Virtual systems
- Section Ref
- 1.3
- Title
- What are small computers programmed to control engines and phones called?
- section
- 1.3 Machine Code and Programming Languages
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-19
An integrated development environment (IDE) bundles tools for programming into a unified application. What kinds of tools are usually included?
- An editor and a compiler
- A web browser
- Presentation tools
- A multimedia creation package
- Section Ref
- 1.4
- Title
- What kinds of tools are included in an IDE?
- section
- 1.4 Becoming Familiar with Your Programming Environment
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-20
What is the difference between an editor and a compiler?
- An editor converts program files into an executable program; a compiler allows program files to be written and stored
- An editor allows program files to be written and stored; a compiler produces an organized list of files
- An editor allows program files to be written and stored; a compiler produces an indexed database of terms and keywords
- An editor allows program files to be written and stored; a compiler converts program files into an executable program
- Section Ref
- 1.4
- Title
- What is the difference between an editor and a compiler?
- section
- 1.4 Becoming Familiar with Your Programming Environment
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-21
Suppose you define a C++ symbol MadCitie
and another symbol Madcitie
. What can be said about these two symbols?
- Since C++ is case-sensitive, these are considered to be completely distinct
- Because "citie" is misspelled, the C++ compiler will reject it
- Since these C++ symbols both have the same letters, they are considered to be the same
- They are the correct length because all C++ symbols must have exactly eight characters.
- Section Ref
- 1.4
- Title
- What are some of the rules for defining and understanding variable names in C++?
- section
- 1.4 Becoming Familiar with Your Programming Environment
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-22
What statements about the integrated development environment (IDE) are true?
I. You may run an executable program even after exiting the IDE
II. The IDE contains a program called the linker, which is required to build an executable program
III. Translating C++ source code into machine code is not enough to actually run the program
- I, II
- I, III
- II, III
- I, II, III
- Section Ref
- 1.4
- Title
- What are the steps in building an executable file in C++?
- section
- 1.4 Becoming Familiar with Your Programming Environment
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-23
Consider the following statements about folders and your integrated development environment (IDE):
I. Hierarchical folders help to organize a project
II. Folders are a way to visualize the layout of a file system
III. Folders make it impossible to lose or accidentally delete a file
- Only I is correct
- I, II, and III are correct
- Only I and II are correct
- Only III is correct
- Section Ref
- 1.4
- Title
- How is your integrated development environment organized?
- section
- 1.4 Becoming Familiar with Your Programming Environment
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-24
Which of the following statements regarding backup strategies for C++ files are true?
I. You should back up your projects often to prevent loss of valuable work.
II. You should check your backups only if you have lost your current working copy.
III. Have more than one backup, from various stages of your development work.
- I, II
- I, III
- II, III
- I, II, III
- Section Ref
- 1.5
- Title
- Which snippet compiles without errors and displays "hello"?
- from
- testbank-bc-2-ch01-25
- section
- 1.4 Becoming Familiar with Your Programming Environment
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-33
Which of the following are NOT windows displayed in a typical IDE?
The compiler
The editor
The folder/file hierarchy or directory tree
The message window
- Section Ref
- 1.4
- Title
- Which of the following are NOT windows displayed in a typical IDE?
- section
- 1.4 Becoming Familiar with Your Programming Environment
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-34
Which of the following are NOT types of code used by an IDE?
- Source code
- Machine code
- Native code
- Library code
- Section Ref
- 1.4
- Title
- Which of the following are NOT types of code used by an IDE?
- section
- 1.4 Becoming Familiar with Your Programming Environment
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-35
Which one of the following statements is true about a C++ compiler?
- It translates the object code into the source code.
- It translates the library code into the machine code.
- It translates the source code into the machine code.
- It translates the machine code into the source code.
- Section Ref
- 1.8
- Title
- Which statement is true about a C++ compiler?
- section
- 1.4 Becoming Familiar with Your Programming Environment
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-62
Which one of the following programs combines the machine code with the library code to build an executable file?
- Assembler
- Linker
- Editor
- Compiler
- Section Ref
- 1.8
- Title
- Which program combines machine code with library code to build an executable file?
- section
- 1.4 Becoming Familiar with Your Programming Environment
- Difficulty
- Medium
- id
- testbank-bc-2-ch01-63
Which one of the following statements is true about C++ syntax?
- The semicolon terminates statements.
- The double quote character cannot appear within a character string.
- The tab character is the only way to produce “whitespace”.
- The single quote character means the same thing as the double quote character.
- Section Ref
- 1.5
- Title
- Which statements are true about C++ syntax?
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-26
Characters that are grouped together between double quotes (quotation marks) in C++ are called
- keywords
- syntax
- symbols
- strings
- Section Ref
- 1.5
- Title
- What is the term for characters grouped together and enclosed with quotes in C++?
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-27
To include a literal special character, such as the double quote, inside a character string, use the following preceding the character:
- a duplicate copy of the same character
- the dollar sign $
- the backslash
- the single quote
- Section Ref
- Special Topic 1.1
- Title
- How are special characters designated and represented in C++?
- from
- testbank-bc-2-ch01-28
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-40
The two lines of code below both produce the same output. Why?
cout << "Hello" << " Goodbye";
cout << "Hello" << " Goodbye";
- Since there are no numerical / arithmetic operators, the spaces don't matter.
- In fact, the two statements do not produce the same output.
- Spacing between symbols in C++ doesn’t affect statements.
- Because there are no escape characters.
- Section Ref
- 1.5
- Title
- Why do the example lines of code behave the way they do (understanding whitespace)?
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-29
What is the output from this code snippet?
cout << "The sum is " << "8 + 6";
- The sum is 14
- The sum is 48
- The sum is 2
- The sum is 8 + 6
- Section Ref
- 1.5
- Title
- What is the output from this code? (arithmetic statements versus character strings)
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-30
Which of the following statements should you include in a C++ program that performs an input or output operation with cin
and/or cout
?
I. using namespace
std;
II. #include
<iostream>
III. int main()
IV. #include "iostream"
- II only
- All of the above
- II and III only
- I, II, and III
- Section Ref
- 1.5
- Title
- Which statements should you include in program with input/output operations?
- from
- testbank-bc-2-ch01-31
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-43
What is the output of the following code snippet?
#include <iostream>
using namespace std;
int main()
{
cout << "Goodbye" << endl << "Come again" << endl;
return 0;
}
Goodbye Come again
Goodbye
Come again
Goodbye
Come
again
- No output due to compilation errors
- Section Ref
- 1.5
- Title
- What is output of code snippet (using cout and endl)?
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-32
Which one of the following code snippets compiles without errors and displays the output "hello
" on the screen?
#include <iostream>
using namespace std;
int main();
{
cout << hello << endl;
return 0;
}
#include <iostream>
using namespace std;
int main();
{
cout << 'hello' << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
cout << "hello" << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
cout << "hello" << "endl";
return 0;
}
- Section Ref
- 1.5
- Title
- Which snippet compiles without errors and displays "hello"?
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-33
Which one of the given code snippet represents the correct way to print the following output?
HI
"HELLO"
#include <iostream>
using namespace std;
int main()
{
cout << HI << endl << "HELLO" << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
cout << "HI << endl << HELLO";
return 0;
}
#include <iostream>
using namespace std;
int main()
{
cout << 'HI' << endl << '"HELLO"';
return 0;
}
#include <iostream>
using namespace std;
int main()
{
cout << "HI" << endl << "\"HELLO\"" << endl;
return 0;
}
- Section Ref
- 1.5
- Title
- Which snippet correctly prints (output on two lines)?
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Medium
- id
- testbank-bc-2-ch01-34
What is the output of the following code snippet?
#include <iostream>
using namespace std;
int main()
{
cout << 2 * 2 << 6;
return 0;
}
- 2 * 26
- 226
- 46
- 4 6
- Section Ref
- 1.5
- Title
- TB 1.14 What is output of snippet (with expressions sent to cout)?
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Medium
- id
- testbank-bc-2-ch01-35
Which of the following statements is valid regarding endl
?
I. The endl
symbol denotes the end of line marker.
II. When the end of line marker is sent out to cout
, the cursor is moved to the first column in the next screen row.
III. endl
is included inside double quotes if the cout
contains a string.
- I only.
- II only,
- I and II only
- I, II and III.
- Section Ref
- 1.5
- Title
- Which statement is true about the usage of endl?
- from
- testbank-bc-2-ch01-36
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Medium
- id
- testbank-bc-3-ch01-48
Which of the following symbols is used to terminate a C++ program statement?
- Colon
- Semicolon
- Single quote
- Period
- Section Ref
- 1.5
- Title
- Which symbol is used to terminate a C++ program statement?
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-37
Which of the following statements is valid with respect to semicolons in C++?
- A semicolon is used to denote the end of a statement.
- A semicolon is used to terminate the
#include
statement. - You cannot use a semicolon to terminate the “
using namespace
” statement. - You cannot put a semicolon within double quotation marks.
- Section Ref
- 1.5
- Title
- Which statement is true about semicolon usage?
- from
- testbank-bc-2-ch01-38
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Medium
- id
- testbank-bc-3-ch01-50
Which of the following statements are valid with respect to the main
function?
- The opening and closing parentheses after the function name
main
are optional. - A semicolon is required after the declaration
int main()
- A semicolon is required after the closing curly braces of the
main
function. - Every executable C++ program has a
main
function.
- Section Ref
- 1.5
- Title
- Which statement is true about the main function?
- from
- testbank-bc-2-ch01-39
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Medium
- id
- testbank-bc-3-ch01-51
Which of the given cout
statements generates the following output?
///"\\\
cout << "///"\\\" << endl;
cout << "///\"\\\\\\" << endl;
cout << "//////""\\\\\\" endl;
cout << ///"\\\ << endl;
- Section Ref
- 1.5
- Title
- Which cout statement generates this output?
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Hard
- id
- testbank-bc-2-ch01-41
Which of the following statements enables the use of input and output operations in a C++ program?
-
using namespace std;
-
#include <iostream>
-
int main()
-
return 0;
- Section Ref
- 1.5
- Title
- Which statements enables the use of input/output operations?
- from
- testbank-bc-2-ch01-42
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-54
What is the output of the following code snippet?
#include <iostream>
using namespace std;
int main()
{
cout << "Hello\n" << " Good Day!" << endl;
return 0;
}
- Hello \n Good Day!
Hello
Good Day!
Hello
Good
Day!
- No output due to compilation errors
- Section Ref
- 1.5
- Title
- What is output of snippet (with cout,
and endl)?
- from
- testbank-bc-2-ch01-43
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-55
Which one of the following code snippets compiles without errors and displays the output "Hello world" on the screen?
#include <iostream>
using namespace std;
int main();
{
cout << Hello world << endl;
return 0;
}
#include <iostream>
using namespace std;
int main();
{
cout << 'Hello world' << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world" << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world" << "endl";
return 0;
}
- Section Ref
- 1.5
- Title
- Which snippet compiles without errors and displays "Hello world"?
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-44
Which one of the given code snippets represents the correct way to print the following output?
GOOD MORNING
"AMERICA"
#include <iostream>
using namespace std;
int main()
{
cout << GOOD MORNING << endl << "AMERICA" << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
cout << "GOOD MORNING << endl << AMERICA";
return 0;
}
#include <iostream>
using namespace std;
int main()
{
cout << 'GOOD MORNING' << endl << '"AMERICA"';
return 0;
}
#include <iostream>
using namespace std;
int main()
{
cout << "GOOD MORNING" << endl << "\"AMERICA\"" << endl;
return 0;
}
- Section Ref
- 1.5
- Title
- Which snippet correctly prints (output on two lines)?
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Medium
- id
- testbank-bc-2-ch01-45
What is the output of the following code snippet?
#include <iostream>
using namespace std;
int main()
{
cout << 4 * 4 << 12;
return 0;
}
- 4 * 412
- 4412
- 1612
- 28
- Section Ref
- 1.5
- Title
- What is output of snippet (with expressions sent to cout)?
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Medium
- id
- testbank-bc-2-ch01-46
What is the output of the following code snippet?
#include <iostream>
using namespace std;
int main()
{
cout << "\"cout << endl\" prints out a new line to " << endl;
cout << "the standard output stream" << endl;
return 0;
}
- The code snippet gives a compilation error because the
cout
statement is inside the quotation marks cout
prints out a new line to
the standard output stream
cout << endl
prints out a new line to
the standard output stream
"cout << endl"
prints out a new line to
the standard output stream
- Section Ref
- 1.5
- Title
- What is the output of snippet (with complex cout statement)?
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Medium
- id
- testbank-bc-2-ch01-47
Which of the given cout
statements generates the following output?
\\\"///
cout << "\\\"///" << endl;
cout << "\\\\\\\"///" << endl;
cout << "\\\\\\""//////" endl;
cout << \\\"/// << endl;
- Section Ref
- 1.5
- Title
- Which cout statement generates this output?
- section
- 1.5 Analyzing Your First Program
- Difficulty
- Hard
- id
- testbank-bc-2-ch01-48
What, if anything, is wrong with the following code snippet?
cout << "Hello, World!" << endl
return 0;
- The double quotes should be single quotes.
- The
< <
symbols are in the wrong direction, and should be > >
.
- There is a missing semicolon.
- Nothing is wrong with the snippet.
- Section Ref
- 1.5: Common Error 1.1
- Title
- What type of error is in this snippet?
- section
- Common Error 1.1 Omitting Semicolons
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-61
What is the output of the following code snippet?
#include <iostream>
using namespace std;
int main()
{
cout << "cout << endl prints out a new line to " << endl
<< "the standard output stream" << endl;
return 0;
}
- The code snippet gives a compilation error because the
cout
statement is inside the quotation marks cout
prints out a new line to
the standard output stream
cout << endl
prints out a new line to
the standard output stream
prints out a new line to
the standard output stream
- Section Ref
- 1.5
- Title
- What is the output of snippet (with complex cout statement)?
- section
- Special Topic 1.1 Escape Sequences
- Difficulty
- Medium
- id
- testbank-bc-2-ch01-40
What is an equivalent way to produce the same output as the following single statement?
cout << "Hello, World!" << endl;
-
cout << "Hello, World!\n";
-
cout << "Hello, "; cout << "World!" << endl;
-
cout << "Hello, Wor"; cout << "ld!\n";
- All of the above
- Section Ref
- 1.5: Special Topic 1.1
- Title
- What is an equivalent way to produce the same output as the following single statement?
- section
- Special Topic 1.1 Escape Sequences
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-62
What kind of error is it when your program has a syntax error?
- Compile-time error
- Logic error
- Run-time error
- Exception
- Section Ref
- 1.6
- Title
- Which kind of error is it when programs do not compile?
- section
- 1.6 Errors
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-49
When a compiler finds a syntax error in a program, what happens?
- The compiler goes ahead and produces an executable program but leaves out the statement where there was an error.
- The compiler stops immediately.
- The compiler requests input from the user before it will continue.
- The compiler continues and may report about other errors but does not produce an executable file.
- Section Ref
- 1.6
- Title
- What happens when the compiler finds a syntax error?
- section
- 1.6 Errors
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-50
What kind of error is created by the following code snippet?
coutt << "Hello, World!" << endl;
- No error: the code is correct
- Logic error: the program will run until it comes to this statement
- Syntax error: the program will not compile
- Exception: the statement will generate an exception
- Section Ref
- 1.6
- Title
- What kind of error is created by the code snippet?
- section
- 1.6 Errors
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-51
What kind of error is created by the following code snippet?
cout << "The sum of 8 and 12 is " << 8 * 12 << endl;
- No error: the code is correct
- Logic error: the program does not produce the desired result
- Syntax error: the code will not compile
- Exception: the statement will generate an exception
- Section Ref
- 1.6
- Title
- What kind of error is created by the code snippet?
- section
- 1.6 Errors
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-52
What is a logic error?
- An error that occurs when a program is running because, for example, the wrong operator was used.
- An error in a statement that does not conform to the syntax of the programming language.
- An error in the hardware from overheating.
- An error introduced by the compiler when it guesses at how to fix a syntax error.
- Section Ref
- 1.6
- Title
- What is the definition of a logic error?
- section
- 1.6 Errors
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-53
How do programmers find exceptions and run-time errors?
- Running the compiler and examining output messages
- Testing the compiled program with a variety of input values
- Carefully reading over the program code
- Compiling with the run-time-error detection option activated
- Section Ref
- 1.6
- Title
- How do programmers find exceptions and run-time errors?
- from
- testbank-bc-2-ch01-54
- section
- 1.6 Errors
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-68
The programmer, not the compiler, is responsible for testing a program to identify
- Syntax errors
- Compile-time errors
- Run-time errors
- Undefined symbols
- Section Ref
- 1.6
- Title
- Who is responsible for what (programmer vs. compiler)?
- section
- 1.6 Errors
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-55
Which one of the following errors represents a part of a program that is incorrect according to the rules of the programming language?
- Syntax errors
- Run-time errors
- Logic errors
- Out-of-memory errors
- Section Ref
- 1.6
- Title
- Which kind of error violates rules of the programming language?
- section
- 1.6 Errors
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-56
Which of the following statements would generate a compile-time error?
-
cout << "eleven" << endl;
-
cout << eleven << endl;
-
cout << 4 + 7 << endl;
-
cout << "4 + 7" << endl;
- Section Ref
- 1.6
- Title
- Which of the following statements would generate a compile-time error?
- section
- 1.6 Errors
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-71
Which of the following statements represents a logic error, but not a compile-time error?
-
cout << "The sum of 5 and 6 is 10" << endl;
-
cout << The sum of 5 and 6 is 10 << endl;
-
cout << "The sum of 5 and 6 is 11" << endl;
-
cout << "The sum of 5 and 6 is " << 5 + 6 << endl;
- Section Ref
- 1.6
- Title
- Which of the following statements represents a logic error, but not a compile-time error?
- section
- 1.6 Errors
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-72
The following code snippet is written to calculate the miles per gallon of two cars and print out both values.
#include <iostream>
using namespace std;
int main()
{
int miles1 = 420;
int miles2 = 500;
int gallons1 = 10;
int gallons2 = 15;
cout << miles1 / gallons1 << endl;
cout << miles1 / gallons2 << endl;
return 0;
}
Based on the given code snippet, identify the correct statement:
- The output is correct, and there are no errors.
- The mileage of the first car is calculated correctly, but the mileage of the second car is incorrect due to a logic error.
- The mileage of the second car is calculated correctly, but the mileage of the first car is incorrect due to a logic error.
- The mileage of both cars is incorrect due to a logic error.
- Section Ref
- 1.7
- Title
- Which is true about this snippet that calculates and prints mpg?
- section
- 1.6 Errors
- Difficulty
- Hard
- id
- testbank-bc-2-ch01-57
What is the error in the following code snippet, which is used for calculating the average score for a student in three subjects?
#include <iostream>
int main()
{
int subject1 = 75;
int subject2 = 65;
int subject3 = 70;
int average = subject1 + subject2 + subject3 / 3;
cout << "The average is " << average;
return 0;
}
- The code snippet has a syntax error from an incorrect use of arithmetic operators.
- The code snippet has a logic error.
- The code snippet uses variable names that are not allowed in C++.
- There is no error; the code snippet is completely accurate.
- Section Ref
- 1.7
- Title
- Is there an error in snippet that calculates average score?
- section
- 1.6 Errors
- Difficulty
- Hard
- id
- testbank-bc-2-ch01-58
Who or what is responsible for inspecting and testing the program to guard against logic errors?
- Programmer
- Linker
- Compiler
- End-user
- Section Ref
- 1.7
- Title
- Who/what is responsible for ... guarding against logic errors?
- section
- 1.6 Errors
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-59
While developing a program, the programmer adds the discount amount to the total payable instead of reducing the discount amount from the total. What type of an error does this denote?
- A syntax error
- A logic error
- A human error
- A compilation error
- Section Ref
- 1.7
- Title
- What type of error is (adding instead of subtracting)?
- section
- 1.6 Errors
- Difficulty
- Medium
- id
- testbank-bc-2-ch01-60
What type of error can you identify in the following code snippet?
#include <iostream>
int main
{
int a = 10;
int b = 20;
int c = a + b;
return 0;
}
- A logic error.
- A syntax error.
- A run-time error.
- No errors; the code snippet is completely accurate.
- Section Ref
- 1.7
- Title
- What type of error is in this snippet?
- section
- 1.6 Errors
- Difficulty
- Medium
- id
- testbank-bc-2-ch01-61
What if anything is wrong with the following code?
#include <iostream>
using namespace std
int Main()
{
cout << "Hello, World!" << endl;
return 0;
}
- Nothing is wrong.
- It is missing a semicolon.
-
Main
should be lowercase main
.
- Both b and c are correct.
- Section Ref
- 1.6: Common Error 1.2
- Title
- What if anything is wrong with the following code?
- section
- Common Error 1.2 Misspelling Words
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-73
What is the purpose of the following algorithm?
num = 0
Repeat the following steps 10 times
input var1
if var1 > num then
num = var1
end of if
end of repeat
print num
- To find the highest among 10 numbers
- To print out the 10 numbers
- To find the smallest among 10 numbers
- To search for a particular number among 10 numbers
- Section Ref
- 1.9
- Title
- What is the purpose of this algorithm?
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Medium
- id
- testbank-bc-2-ch01-64
Consider a situation where you are buying books online. The bookseller charges $19.95 as the price per book and $4.95 as the handling cost for up to three books. For every book purchased in addition to three books, there is a handling charge of $1.50. In addition, there is a 7% tax on the cost of the books but not on the handling charges. Assuming that num_books
represents the number of books you are purchasing, which of the following is the correct algorithm for calculating the total cost of the books that you are purchasing?
Total charge for the books = 4.95 * num_books
Tax on the books = num_books * .7
if (books <= 3) then Handling charges = 4.95
else Handling charges = 1.50 * num_books
Total cost of order = total charge for books + tax + handling charges
Total charge for the books = 4.95 * num_books
Tax on the books = num_books * .07
if (books <= 3) then Handling charges = 4.95
else Handling charges = 1.50 * num_books
Total cost of order = total charge for books + tax + handling charges
Total charge for the books = 4.95 * num_books
Tax on the books = num_books * .07
if (books < 3) then Handling charges = 4.95
else Handling charges = 4.95 + 1.50 * (num_books – 3)
Total cost of order = total charge for books + tax + handling charges
Total charge for the books = 4.95 * num_books
Tax on the books = Total charge for the books * .07
if (books <= 3) then Handling charges = 4.95
else Handling charges = 4.95 + 1.50 * (num_books – 3)
Total cost of order = total charge for books + tax + handling charges
- Section Ref
- 1.7
- Title
- Which is the correct algorithm for calculating total cost with tax/shipping?
- from
- testbank-bc-2-ch01-65
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Hard
- id
- testbank-bc-3-ch01-80
Consider a situation where you are planning on purchasing a new cell phone. You are considering two cell phones. These cell phones have different purchase prices. Each mobile service provider charges a different rate for each minute that the cell phone is used. To determine which cell phone is the better buy, you need to develop an algorithm to calculate the total cost of purchasing and using each cell phone. What are all the inputs needed for this algorithm?
- The cost of each cell phone and the rate for each minute for each cell phone
- The cost of each cell phone and the number of minutes provided with each cell phone
- The cost of each cell phone, the rate per minute for each cell phone, and the number of minutes provided with each cell phone
- The cost of each cell phone, the rate per minute for each cell phone, and the number of minutes you would use the cell phone
- Section Ref
- 1.9
- Title
- Which inputs do you need to calculate cost of purchasing/using cell phone?
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Medium
- id
- testbank-bc-2-ch01-66
Which one of the following methodologies is a sequence of precise steps formulated in English for solving a problem?
- Flowcharts
- Pseudocode
- Algorithms
- Terminations
- Section Ref
- 1.7
- Title
- Which methodology is an informal description of steps for solving a problem?
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Easy
- id
- testbank-bc-2-ch01-67
Consider a situation where you are assigned to develop an algorithm to calculate the total cost of a purchase order that contains several items. The cost of each item and the tax rate is known. The standard shipping charge for the entire order is $4.95, and the special delivery charge is $19.95. In addition, there is no tax on the shipping cost. Which of the following is the correct pseudocode for the required algorithm?
For each item on the purchase order:
Order cost = order cost + item cost
Total purchase order cost = order cost + tax rate + 4.95
For each item on the purchase order:
Order cost = order cost + item cost
If standard shipping
Shipping cost = 4.95
Else
Shipping cost = 19.95
Total purchase order cost = order cost * tax rate + shipping cost
If standard shipping
Shipping cost = 4.95
Else
Shipping cost = 19.95
For each item on the purchase order:
Order cost = order cost + item cost + shipping cost
Total purchase order cost = order cost * tax rate
If special delivery
Shipping cost = 4.95
Else
Shipping cost = 19.95
For each item on the purchase order:
Order cost = order cost + item cost
Total purchase order cost = order cost * tax rate + shipping cost
- Section Ref
- 1.7
- Title
- Which is the correct pseudocode for algorithm to calculate total cost?
- from
- testbank-bc-2-ch01-68
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Medium
- id
- testbank-bc-3-ch01-83
Consider the given scenario for describing an algorithm using pseudocode.
UML Supermarket has different ways of awarding discounts to its customers for each purchase they make. A 10% discount is given on the total value of the purchase. In addition, a standard loyalty discount is given if customers have a permanent customer card. Your program should indicate the amount payable by the customer after the discounts. Identify the inputs that the program requires from the given set of options.
I. The discount percentage
II. The total value of the purchase
III. The loyalty-discount amount
IV. The customer card number
V. The amount payable after discount
- I, II, and III
- I and III
- II, IV, and V
- II and IV
- Section Ref
- 1.9
- Title
- What are the inputs required to solve this problem?
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Hard
- id
- testbank-bc-2-ch01-69
Evaluate the given pseudocode to calculate the payment (pmt
) with the following test values:
The total number of hours worked (working_hours
) = 50
The rate paid for hourly work (rate
) = 10
input working_hours
input rate
pmt = working_hours * rate
if working_hours > 45 then
extra_hours = working_hours – 45
extra_pmt = extra_hours * rate * 2
pmt = pmt + extra_pmt
end if
output pmt
- 400
- 500
- 600
- 1,000
- Section Ref
- 1.7
- Title
- Evaluate this pseudocode with these test values.
- from
- testbank-bc-2-ch01-70
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Hard
- id
- testbank-bc-3-ch01-85
The following code snippet is written to calculate the kilometers per liter of two cars and print out both values.
#include <iostream>
using namespace std;
int main()
{
int km1 = 600;
int km2 = 800;
int lit1 = 15;
int lit2 = 20;
cout << "Car 1: " << km1 / lit2 << endl;
cout << "Car 2: " << km2 / lit2 << endl;
return 0;
}
Based on the given code snippet, identify the correct statement:
- The output is correct, and there are no errors.
- There is a logic error, but the mileage of the first car in this case still ends up correct, while the mileage of the second car is incorrect
- There is a logic error, but the mileage of the second car in this case still ends up correct, while the mileage of the first car is incorrect
- There is a logic error and the mileage of both cars ends up incorrect as a result
- Section Ref
- 1.7
- Title
- Which is true about this snippet that calculates and prints km per liter?
- from
- testbank-bc-2-ch01-71
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Hard
- id
- testbank-bc-3-ch01-86
Is there any error in the following code snippet, which is used for calculating the average age for a group of three students?
#include <iostream>
int main()
{
int age1 = 15;
int age2 = 18;
int age3 = 24;
int average = (age1 + age2 + age3) / 3;
cout << "The average is " << average;
return 0;
}
- Yes, the code snippet has a syntax error.
- Yes, the code snippet has a logic error.
- Yes, the code snippet has a run-time error.
- No error; the code snippet is completely accurate.
- Section Ref
- 1.7
- Title
- Is there an error in snippet that calculates average age?
- from
- testbank-bc-2-ch01-72
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Hard
- id
- testbank-bc-3-ch01-87
What is the purpose of the following algorithm?
somenum = 0
Repeat the following steps 50 times
input variable1
if variable1 > somenum then
somenum = variable1
end of if
end of repeat
print somenum
- To find the highest among 50 numbers
- To print out the 50 numbers
- To find the smallest among 50 numbers
- To search for a particular number among 50 numbers
- Section Ref
- 1.7
- Title
- What is the purpose of this algorithm?
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Medium
- id
- testbank-bc-2-ch01-73
Consider a situation where you are buying videos online. The video seller charges $21.50 as the price per video and $6.75 as the handling cost for up to three videos. For every video purchased in addition to three videos, there is a handling charge of $1.50. In addition, there is a 9% tax on the cost of the videos but not on the handling charges. Assuming that num_videos
represents the number of videos you are purchasing, which of the following is the correct algorithm for calculating the total cost of the videos that you are purchasing?
Total charge for the videos = 21.50 * num_videos
Tax on the videos = num_videos * .9
if (num_videos <= 3) then Handling charges = 6.75
else Handling charges = 1.50 * num_videos
Total cost of order = total charge for videos + tax + handling charges
Total charge for the videos = 21.50 * num_videos
Tax on the videos = num_videos * .09
if (num_videos <= 3) then Handling charges = 6.75
else Handling charges = 1.50 * num_videos
Total cost of order = total charge for videos + tax + handling charges
Total charge for the videos = 21.50 * num_videos
Tax on the videos = num_videos * .09
if (num_videos < 3) then Handling charges = 6.75
else Handling charges = 6.75 + 1.50 * (num_videos – 3)
Total cost of order = total charge for videos + tax + handling charges
Total charge for the videos = 21.50 * num_videos
Tax on the videos = total charge for videos * .09
if (num_videos <= 3) then Handling charges = 6.75
else Handling charges = 6.75 + 1.50 * (num_videos – 3)
Total cost of order = total charge for videos + tax + handling charges
- Section Ref
- 1.7
- Title
- Which is the correct algorithm for calculating total cost with tax/shipping?
- from
- testbank-bc-2-ch01-74
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Hard
- id
- testbank-bc-3-ch01-89
Consider a situation where you are planning on purchasing a new cable TV dish. You are considering two cable TV dishes. These cable TV dishes have different purchase prices. Each channel service provider charges a different rate for each month that the cable TV dish is used. To determine which cable TV dish is a better buy, you need to develop an algorithm to calculate the total cost of purchasing and using each cable TV dish. What are all of the inputs that you need for this algorithm?
- The cost of each cable TV dish and the rate for each month for using each cable TV dish
- The cost of each cable TV dish and the number of months provided with each cable TV dish
- The cost of each cable TV dish, the rate per month for using each cable TV dish, and the number of months provided with each cable TV dish
- The cost of each cable TV dish, the rate per month for using each cable TV dish, and the number of months you would use the cable TV dish
- Section Ref
- 1.7
- Title
- Which inputs do you need to calculate cost of purchasing/using cable dish?
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Medium
- id
- testbank-bc-2-ch01-75
Consider a situation where you are assigned to develop an algorithm to calculate the total cost of a purchase order that contains several T shirts. The cost of each T shirt and the tax rate is known. The standard shipping charge for the entire order is $5.75, and the special delivery charge is $23.65. In addition, there is no tax on the shipping cost. Which of the following is the correct pseudocode for the required algorithm?
For each T shirt on the purchase order:
Order cost = order cost + T shirt cost
Total purchase order cost = order cost + tax rate + 5.75
For each T shirt on the purchase order:
Order cost = order cost + T shirt cost
If standard shipping
Shipping cost = 5.75
Else
Shipping cost = 23.65
Total purchase order cost = order cost * tax rate + shipping cost
If standard shipping
Shipping cost = 5.75
Else
Shipping cost = 23.65
For each T shirt on the purchase order:
Order cost = order cost + T shirt cost + shipping cost
Total purchase order cost = order cost * tax rate
If special delivery
Shipping cost = 5.75
Else
Shipping cost = 23.65
For each T shirt on the purchase order:
Order cost = order cost + T shirt cost
Total purchase order cost = order cost * tax rate + shipping cost
- Section Ref
- 1.7
- Title
- Which is the correct pseudocode for algorithm to calculate total cost?
- from
- testbank-bc-2-ch01-76
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Medium
- id
- testbank-bc-3-ch01-91
Consider the given scenario for describing an algorithm using pseudocode.
WALMART Supermarket has different ways of awarding discounts to its customer IDs for each purchase they make. An 8% discount is given on the total value of the purchase. In addition, a standard loyalty discount is given if customers have a permanent customer ID card. Your program should indicate the amount payable by the customer after the discounts. Identify the inputs that the program requires from the given set of options.
I. The discount percentage
II. The total value of the purchase
III. The loyalty-discount amount
IV. The customer ID card number
V. The amount payable after discount
- I, II, and III
- I and III
- II, IV, and V
- II and IV
- Section Ref
- 1.7
- Title
- What are the inputs required to solve this problem?
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Hard
- id
- testbank-bc-2-ch01-77
Evaluate the given pseudocode to calculate the payment (pmt
) with the following test values:
The total number of hours worked (working_hours
) = 60
The rate paid for hourly work (rate
) = 15
input working_hours
input rate
pmt = working_hours * rate
if working_hours > 40 then
extra_hours = working_hours – 40
extra_pmt = extra_hours * rate * 2
pmt = pmt + extra_pmt
end of if
output pmt
- 900
- 1,200
- 1,500
- 1,800
- Section Ref
- 1.7
- Title
- Evaluate this pseudocode with these test values.
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Hard
- id
- testbank-bc-2-ch01-78
Which of the following is NOT a requirement for the characteristics of a good algorithm?
- It is simple.
- It is unambiguous.
- It is executable.
- It terminates.
- Section Ref
- 1.7
- Title
- Which of the following is NOT a requirement for the characteristics of a good algorithm?
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-94
An algorithm should be written first in:
- English.
- pseudocode.
- C++.
- a generic programming language.
- Section Ref
- 1.7
- Title
- How to write an algorithm
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-95
An algorithm should be written first in:
- English.
- pseudocode.
- C++.
- a generic programming language.
- Section Ref
- 1.7
- Title
- Which of the following is NOT part of the software development process?
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-96
What is wrong with this algorithm for sorting a deck of playing cards according to suit?
Pick up the top card from the deck
Put it into the pile corresponding to its suit (heart, diamond, spade, club)
Repeat
- It is ambiguous.
- It is not executable.
- It is not terminating.
- Nothing is wrong.
- Section Ref
- 1.7
- Title
- What is wrong with this algorithm for sorting a deck of playing cards according to suit?
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-97
What is the correct order for the following steps in creating an algorithm?
D. Describe each task with pseudocode
T. Test the pseudocode on a sample set of inputs
B. Break down the problem into small tasks
L. List the inputs and outputs
- The order does not matter.
- D, T, L, B
- B, D, L, T
- L, B, D, T
- Section Ref
- 1.7
- Title
- What is the correct order for the following steps in creating an algorithm?
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-98
Say you are writing an algorithm to arrange tiles to fill a rectangular floor with alternating black and white tiles. What would be the required inputs to the algorithm?
- The total floor area and each tile’s area
- The number of tiles available and the floor area
- The length and width of the floor and of the tiles
- A and C both are required inputs
- Section Ref
- 1.7
- Title
- Determining Inputs to an Algorithm
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-99
What is the problem with the following algorithm?
Repeat a number of times
Add sales amount to total sales.
- The algorithm has a Repeat instruction, but statements in a program cannot be repeated.
- The Add statement in the algorithm is not executable.
- The Add statement in the algorithm does not clearly specify what is to be added.
- The algorithm is ambiguous because it does not specify how many times to repeat the Add statement.
- Section Ref
- 1.7
- Title
- What is the problem with the following algorithm?
- section
- 1.7 Problem Solving: Algorithm Design
- Difficulty
- Easy
- id
- testbank-bc-3-ch01-100