PowerShell Commands and Scripting

Test your knowledge of PowerShell commands, operators, parameters, CmdLets, and output formatting

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which command is used to print the output of a CmdLet?

  1. Out-FIle
  2. Out-Host
  3. Out-Null
  4. None of the above
Question 2 Multiple Choice (Single Answer)

Which CmdLet is used to create a new item in the file system or registry?

  1. New-Item
  2. Create-Item
  3. Move-Item
  4. Invoke-Item
Question 3 Multiple Choice (Single Answer)

Which command is used to list all the Windows PowerShell CmdLets?

  1. Get-Member
  2. Get-ChildItem
  3. Get-Command
  4. Get-AllCommand
Question 4 Multiple Choice (Single Answer)

Which formatting option is used to format the output of a command result to a tabular result set?

  1. Format-List
  2. Format-Table
  3. Format-Wide
  4. Format-Custom
Question 5 Multiple Choice (Single Answer)

Which command is used to get the paged output from a CmdLet?

  1. Out-Host –Paging
  2. Out-String –Paging
  3. Out-Null –Paging
  4. Out-buffer –Paging
Question 6 Multiple Choice (Single Answer)

What will be the value of the variable $X in the below expression $x=10*2 / 5 * 2 + 5 * 5

  1. 31
  2. 32
  3. 33
  4. 34
Question 7 Multiple Choice (Single Answer)

The “-Verbose” parameter is used in a command to

  1. Generate detailed trace info about the operation
  2. Generate programmer level detail about the operation
  3. Determine how the CmdLet responds when an error occurs
  4. Specify a variable to store the output from the command during processing
Question 8 Multiple Choice (Single Answer)

What are the different types of operators available in Windows PowerShell?

  1. Compare Operators
  2. Math Operators
  3. Logical Operators
  4. All of the Above
Question 9 Multiple Choice (Single Answer)

Which among the following is not a valid Logical Operator in PowerShell?

  1. -and
  2. - notlike
  3. -!
  4. -or
Question 10 Multiple Choice (Single Answer)

Out of the below options, which one is not a common parameter in PowerShell command?

  1. Confirm
  2. Debug
  3. Warn
  4. Force
Question 11 Multiple Choice (Single Answer)

Which among the following is not a suggested parameter in PowerShell command?

  1. ComputerName
  2. Exclude
  3. OutBuffer
  4. All of the above
Question 12 Multiple Choice (Single Answer)

Which CmdLet can be used to export all the processes running in a system to a CSV file?

  1. Get-Process | Export-CSV
  2. Set-Service| Export-CSV Processes.csv
  3. Get-AllProcess | Export-CSV Processes.csv
  4. Get-Process | Export-CSV Processes.csv
Question 13 Multiple Choice (Single Answer)

“-Confirm” is what type of parameter in PowerShell

  1. Permissive Parameters
  2. System State Parameters
  3. Ubiquitous Parameters
  4. Suggested Parameters
Question 14 Multiple Choice (Single Answer)

Which command is used to explain what will happen if the command is executed, without actually executing the command?

  1. -WhatIf
  2. -WhatIIf
  3. -WhatHappens
  4. All of the above
Question 15 Multiple Choice (Single Answer)

Which command is used to create an alias in PowerShell?

  1. Get-alias
  2. Set-alias
  3. Create-alias
  4. Remove-alias
Question 16 Multiple Choice (Single Answer)

Which operator is used to do a case sensitive text data comparison in PowerShell?

  1. -eq
  2. -neq
  3. -ceq
  4. -ieq
Question 17 True/False

The statement “PowerShell Commands are not Text-based rather Object-based” is true/false?

  1. True
  2. False
Question 18 Multiple Choice (Multiple Answers)

Which are the valid array declarations in PowerShell among the following options

  1. $Number = 1,2,3,4,5
  2. $DescriptionArray= “This”, “is”, “a”, “Sample”, “Variable”
  3. $x = @(1, 2, 3, 4, 5)
  4. $y = @[6,7, 8, 9, 10]
Question 19 True/False

What will be the value of $X if the below statement will be executed? $X = (1 -eq 1) -and (2 -eq 2)

  1. True
  2. False
Question 20 Multiple Choice (Multiple Answers)

What are the valid wild card characters can be used in PowerShell while executing the Get-ChildItem CmdLet?

  1. * ( A star)
  2. ? (A Question Mark)
  3. [..] (Opening left and closing right Bracket )
  4. . {..} (curly brackets)