0
0
PowerShellscripting~20 mins

First PowerShell command - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
PowerShell First Command Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this PowerShell command?
Consider the following PowerShell command:
Write-Output "Hello, World!"

What will this command display in the console?
PowerShell
Write-Output "Hello, World!"
ANothing is displayed
BWrite-Output "Hello, World!"
CError: Command not found
DHello, World!
Attempts:
2 left
💡 Hint
Write-Output sends the text to the console.
💻 Command Output
intermediate
2:00remaining
What does this PowerShell command output?
Look at this command:
Get-Date -Format "yyyy-MM-dd"

What kind of output will it produce?
PowerShell
Get-Date -Format "yyyy-MM-dd"
AThe current time in format like 14:30:00
BAn error about invalid format
CThe current date in format like 2024-06-15
DThe full date and time in default format
Attempts:
2 left
💡 Hint
The -Format parameter controls how the date is shown.
📝 Syntax
advanced
2:00remaining
Which PowerShell command correctly assigns a string to a variable?
You want to store the text "Hello" in a variable named greeting. Which command is correct?
A$greeting = Hello
B$greeting = "Hello"
Cgreeting = "Hello"
D$greeting := "Hello"
Attempts:
2 left
💡 Hint
Strings need quotes and variables start with $ in PowerShell.
🔧 Debug
advanced
2:00remaining
What error does this PowerShell command produce?
Examine this command:
Write-Output Hello World

What happens when you run it?
AOutputs: Hello World
BOutputs: Hello
COutputs: HelloWorld
DError: Missing quotation marks
Attempts:
2 left
💡 Hint
Write-Output can take multiple arguments separated by spaces.
🚀 Application
expert
2:00remaining
How many items does this PowerShell command output?
Consider this command:
1..5 | ForEach-Object { $_ * 2 }

How many numbers will be output?
PowerShell
1..5 | ForEach-Object { $_ * 2 }
A5
B1
C0
D10
Attempts:
2 left
💡 Hint
1..5 creates a list of 5 numbers, each doubled.