Question

in powershell

Question 7 Given the statement below: ForEach ($number in 1,2,3,4,5,6,7,8,9,10) { $number * 7} will print multiples of 7 one

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer to question 7

Yes, ForEach ($number in 1,2,3,4,5,6,7,8,9,10) {$number * 7} will print multiples of 7 one under the other strating from 7 to 70

Answer to question 8

FIlL CONDITION : $Number -lt 0

$Number = -10
if($Number -gt 0)
{"$Number is bigger than zero"}
elseif($Number -lt 0)
{"$Number is negative"}

Code $Number = -10 if($Number -gt 0) { $Number is bigger than zero} elseif ($Number -lt 0) {$Number is negative} Footer I

Answer to question 9

The second statement $d = $a.ToUpperCase(); will give error while running, as there is no such method called ToUpperCase() associated with string.

Chaneg ToUpperCase() to ToUpper() and execute it. This will work;

Correct code:

$a = "Texas A&M University"
$d = $a.ToUpper();

Answer to question 10

The operator to be used is -notlike which will remove all strings in array cars which starts with T

updated code:

$cars = @("Buick","Ciltron","Toyota","Nissan","Alpha Romeo","Jaguar","Porsche","Tesla")
$cars = $cars | where {$_ -notlike "T*"}
Write-Host $cars

v Code $cars = @(Buick, Ciltron, Toyota, Nissan, Alpha Romeo, Jaguar, Porsche, Tesla) $cars = $cars | where {

Add a comment
Know the answer?
Add Answer to:
in powershell Question 7 Given the statement below: ForEach ($number in 1,2,3,4,5,6,7,8,9,10) { $number * 7}...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT