PowerShell Unit Test - Comprehensive Assessment
Estimated time: 60-90 minutes
Key Learning Outcomes Assessed
By completing this unit test, you will demonstrate:
- Understanding of file system navigation and path concepts
- Proficiency with file and folder manipulation commands
- Ability to redirect and pipe command output
- Knowledge of environment variables and aliases
- Screen-reader accessibility best practices in terminal environments
- Problem-solving and command chaining skills
Target Audience:
Users who have completed PS-0 through PS-5 and need to demonstrate mastery of PowerShell fundamentals.
Instructions:
Complete all sections below. For multiple choice, select the best answer. For short answers, write one to two sentences. For hands-on tasks, capture evidence (screenshots or output files) and submit alongside your answers.
Part A: Multiple Choice Questions (20 questions)
Select the best answer for each question. Each question is worth 1 point.
-
What is the primary purpose of the
PATHenvironment variable?- A) Store your home directory location
- B) Tell the shell where to find executable programs
- C) Configure the visual appearance of the terminal
- D) Store the current working directory name
-
Which command prints your current working directory?
- A)
ls -n - B)
cd - C)
pwd - D)
whoami
- A)
-
What does the
~symbol represent in PowerShell paths?- A) The root directory
- B) The current directory
- C) The parent directory
- D) The home directory
-
How do you list only file names (not full details) in a way that is screen-reader friendly?
- A)
ls - B)
ls -n - C)
ls -l - D)
cat -n
- A)
-
Which command creates a new empty file?
- A)
mkdir filename - B)
ni filename - C)
touch filename - D)
echo filename
- A)
-
What is the difference between
>and>>?- A)
>redirects to file,>>displays on screen - B)
>overwrites a file,>>appends to a file - C) They do the same thing
- D)
>is for text,>>is for binary
- A)
-
What does the pipe operator
|do?- A) Creates a folder
- B) Sends the output of one command to the input of another
- C) Deletes files matching a pattern
- D) Lists all processes
-
Which command copies a file?
- A)
mv - B)
rm - C)
cp - D)
cd
- A)
-
How do you rename a file from
oldname.txttonewname.txt?- A)
cp oldname.txt newname.txt - B)
mv oldname.txt newname.txt - C)
rename oldname.txt newname.txt - D)
rn oldname.txt newname.txt
- A)
-
What is the purpose of
Select-String?- A) Select files in a directory
- B) Search for text patterns within a file
- C) Select a string to copy to clipboard
- D) Select which shell to use
-
Which key combination allows you to autocomplete a path in PowerShell?
- A)
Ctrl + A - B)
Ctrl + E - C)
Tab - D)
Space
- A)
-
How do you copy text to the Windows clipboard from PowerShell?
- A)
cat filename > clipboard - B)
cat filename | clip - C)
copy filename - D)
cat filename | paste
- A)
-
What does
Get-Command openscaddo?- A) Opens the OpenSCAD application
- B) Gets help about the OpenSCAD command
- C) Locates the full path of the openscad executable
- D) Lists all available commands
-
Which wildcard matches any single character?
- A)
* - B)
? - C)
% - D)
#
- A)
-
What is the purpose of the
&call operator?- A) Run a script or executable by full path
- B) Execute all commands in parallel
- C) Combine multiple commands
- D) Create an alias
-
How do you create a temporary alias for a command?
- A)
alias preview='openscad' - B)
Set-Alias -Name preview -Value openscad - C)
New-Alias preview openscad - D)
Alias preview = openscad
- A)
-
Where is your PowerShell profile typically stored?
- A) C:\Program Files\PowerShell\profile.ps1
- B) The location returned by
echo $PROFILE - C) ~/PowerShell/profile.ps1
- D) ~/.bashrc
-
How do you abort a long-running command in PowerShell?
- A) Press
Escape - B) Press
Ctrl + X - C) Press
Ctrl + C - D) Press
Alt + F4
- A) Press
-
What command shows the history of previously run commands?
- A)
history - B)
Get-History - C)
Show-History - D) Both A and B
- A)
-
How do you permanently set an alias so it persists across PowerShell sessions?
- A) Use
Set-Aliasin the terminal every time - B) Add the
Set-Aliasline to your PowerShell profile - C) Use the Windows Control Panel
- D) Aliases cannot be made permanent
- A) Use
Part B: Short Answer Questions (10 questions)
Answer each question in one to two sentences. Each question is worth 2 points.
-
Explain the difference between absolute and relative paths. Give one example of each.
-
Why is
ls -npreferred overlsfor screen reader users? Describe what flag you would use to list only files. -
What is the purpose of redirecting output to a file, and give an example of when you would use
>instead of>>? -
Describe what would happen if you ran
rm -r ~/Documents/my_folderand why this command should be used carefully. -
How would you search for all files with a
.scadextension in your current directory? Write the command. -
Explain what happens when you pipe the output of
ls -nintoclip. What would you do next? -
What is an environment variable, and give one example of how you might use it in PowerShell.
-
If a program is not in your
PATH, what two methods could you use to run it from PowerShell? -
Describe how you would open a file in Notepad and also add a line to it from PowerShell.
-
What is one strategy you would use if your screen reader stops announcing terminal output while using PowerShell?
Part C: Hands-On Tasks (10 tasks)
Complete each task and capture evidence (screenshots, output files, or command transcripts). Each task is worth 3 points.
Tasks 1-5: File System and Navigation
-
Create a folder structure
~/Documents/PowerShell_Assessment/Projectsusing a single command. Capture thels -noutput showing the creation. -
Create five files named
project_1.scad,project_2.scad,project_3.txt,notes_1.txt, andnotes_2.txtinside theProjectsfolder. Use wildcards to list only.scadfiles, then capture the output. -
Copy the entire
Projectsfolder toProjects_Backupusingcp -r. Capture thels -noutput showing both folders exist. -
Move (rename)
project_1.scadtoproject_1_final.scad. Capture thels -noutput showing the renamed file. -
Delete
notes_1.txtandnotes_2.txtusing a singlermcommand with wildcards. Capture the finalls -noutput.
Tasks 6-10: Advanced Operations and Scripting
-
Create a file called
my_data.txtwith at least four lines usingechoand>>. Then read it withcat my_data.txtand capture the output. -
Use
Select-Stringto search for a keyword (e.g., “project”) inmy_data.txtand pipe the results toclip. Paste the results into Notepad and capture a screenshot. -
List all files in the
Projectsfolder and redirect the output toprojects_list.txt. Open it in Notepad and capture a screenshot of the file. -
Create a temporary alias called
mylsthat runsls -n, test it, and capture the output. Then explain what would be required to make it permanent. -
Run
Get-Help Get-ChildItemand redirect the output tohelp_output.txt. Open the file in Notepad and capture a screenshot showing at least the first page of help content.
Grading Rubric
| Section | Questions | Points Each | Total |
|---|---|---|---|
| Multiple Choice | 20 | 1 | 20 |
| Short Answer | 10 | 2 | 20 |
| Hands-On Tasks | 10 | 3 | 30 |
| Total | 40 | - | 70 |
Passing Score: 49 points (70%)
Helpful Resources for Review
- PowerShell Command Reference
- Navigation and File System
- Using Pipes and Filtering
- Profile and Aliases
- Screen Reader Accessibility Tips
Submission Checklist
- All 20 multiple choice questions answered
- All 10 short answer questions answered (1-2 sentences each)
- All 10 hands-on tasks completed with evidence captured
- Files/screenshots organized and labeled clearly
- Submission includes this checklist