Complete the code to convert the string to uppercase.
$text = "hello" $upper = $text.[1]()
The ToUpper() method converts all characters in the string to uppercase.
Complete the code to get the length of the string.
$text = "PowerShell" $length = $text.[1]
The Length property gives the number of characters in the string.
Fix the error in the code to replace spaces with dashes.
$text = "Hello World" $newText = $text.[1](" ", "-")
The Replace method replaces all occurrences of a substring with another substring.
Fill both blanks to extract the first 5 characters of the string.
$text = "Automation" $firstFive = $text.[1](0, [2])
The Substring method extracts a part of the string starting at index 0 for length 5.
Fill all three blanks to create a dictionary of word lengths for words longer than 3 characters.
$words = @("code", "is", "fun", "and", "easy") $lengths = @{} foreach ($word in $words) { if ($word.[1] [2] 3) { $lengths[$word.[3]] = $word.[1] } }
This code checks if the word length is greater than 3, converts the word to uppercase, and creates a dictionary with the uppercase word as key and its length as value.