Unit 3 and Unit 4 Review Materials with
Answers
Note: The questions on the exam will be based on variations of the
following pool of questions and exercises in Unit 3 and Unit 4.
1. Batch File Creation
a. Name the file output.bat.
b. The file should receive as input two parameters-a command and a file name-and
should redirect the output of the command to the specified file:
output command filename
c. The output.bat batch file should error-check to determine if a file by the name of
filename already exists.
d. If a file by the name of filename already exists, the batch file should not
overwrite the existing file but return an error message that reads:
filename already exists.
Sample answer:
@ECHO OFF
IF EXIST %2 GOTO ERRORMSG
%1 > %2
ECHO The output of %1 is redirected to %2
GOTO END
:ERRORMSG
ECHO The file %2 already exists, aborting...
:END
2. Batch Files and Macros
a. What is a DOS batch file?
A batch file is an automated script of DOS commands that execute sequentially as
soon as the batch file is run.
b. What is an Excel macro?
A macro in Excel is a series of Excel commands that are designed to run
automatically one after the other when the macro is run.
c. What types of tasks can a batch file or macro perform?
Batch files and macros can perform any type of task that the script or program will
support. In other words, if it can be done manually, it can be automated with batch
files or macros.
d. What are the benefits of using batch files and macros?
The benefit of using batch files and macros is ability to automate routine tasks. Tasks
that normally require several commands but are always completed the same way
every time can be automated, so that one command now executes the entire set of
commands reducing man-hours and increasing productivity.
e. What are the drawbacks of using batch files and macros?
The drawbacks to using batch files and macros are that they are automated and are