Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 5 MCQs PowerShell Basics and Core Concepts

CSC104 — It Fundamentals 60 questions. Pick an option to check it.

Read the notes Subjective questions

0 of 60 answered 0 right 0 wrong , 60 left

  1. Question 1 of 60 Introduction to PowerShell Easy

    What is PowerShell primarily used for?

  2. Question 2 of 60 Console and ISE usage Easy

    Which PowerShell environment provides a script editor and an interactive console?

  3. Question 3 of 60 Writing scripts Easy

    What is a key benefit of placing PowerShell commands in a script?

  4. Question 4 of 60 Variables Easy

    Which symbol begins a variable name in PowerShell?

  5. Question 5 of 60 User input Easy

    Which cmdlet reads input entered by a user?

  6. Question 6 of 60 Comments Easy

    Which character starts a single-line comment in PowerShell?

  7. Question 7 of 60 Cmdlets Easy

    Which naming pattern is commonly used for PowerShell cmdlets?

  8. Question 8 of 60 Pipelines Easy

    What does the pipeline operator | do in PowerShell?

  9. Question 9 of 60 Operators Easy

    Which PowerShell operator tests whether two values are equal?

  10. Question 10 of 60 Conditional statements (if, else, switch) Easy

    Which statement runs a block of code only when a condition is true?

  11. Question 11 of 60 Conditional statements (if, else, switch) Easy

    Which statement is useful for selecting among several possible matching values?

  12. Question 12 of 60 Loops (for, foreach, while, do) Easy

    Which loop is commonly used to process every item in a collection?

  13. Question 13 of 60 Loops (for, foreach, while, do) Easy

    Which loop checks its condition before each iteration?

  14. Question 14 of 60 Arrays Easy

    What does a PowerShell array store?

  15. Question 15 of 60 Hashtables Easy

    How does a PowerShell hashtable organize its data?

  16. Question 16 of 60 Functions Easy

    What is a PowerShell function?

  17. Question 17 of 60 Scoping Easy

    Which scope contains variables available throughout the current PowerShell session?

  18. Question 18 of 60 Basic error handling Easy

    Which PowerShell block handles an error produced in a try block?

  19. Question 19 of 60 Working with help Easy

    Which cmdlet displays help information about another PowerShell command?

  20. Question 20 of 60 Profiles Easy

    What is the main purpose of a PowerShell profile?

  21. Question 21 of 60 Introduction to PowerShell Medium

    A command returns several process objects. Why can PowerShell sort these results reliably by CPU usage?

  22. Question 22 of 60 Console and ISE usage Medium

    You want to test a few commands interactively and inspect each result before creating a reusable script. Which environment is most directly suited to this initial task?

  23. Question 23 of 60 Writing scripts Medium

    A script should accept a computer name as a named parameter. Which declaration should appear near the beginning of the script?

  24. Question 24 of 60 Variables Medium

    Given $count = 5, which statement increases the value by 3 and stores the result back in $count?

  25. Question 25 of 60 User input Medium

    The statement $age = Read-Host "Enter age" is used, and the user enters 21. Which expression correctly checks whether the entered age is at least 18 using numeric comparison?

  26. Question 26 of 60 Comments Medium

    Which syntax correctly comments out multiple lines in a PowerShell script?

  27. Question 27 of 60 Cmdlets Medium

    Which command follows the standard PowerShell Verb-Noun naming convention and retrieves running processes?

  28. Question 28 of 60 Pipelines Medium

    Which command retrieves running services and returns only those whose status is Running?

  29. Question 29 of 60 Operators Medium

    What is the result of the expression 5 -gt 3 -and 2 -eq 2?

  30. Question 30 of 60 Conditional statements (if, else, switch) Medium

    A variable $status may contain Started, Stopped, or Paused, and a different action is required for each value. Which construct is generally the clearest choice?

  31. Question 31 of 60 Loops (for, foreach, while, do) Medium

    Which loop prints the numbers 1 through 5 exactly once each?

  32. Question 32 of 60 Loops (for, foreach, while, do) Medium

    A command inside a loop must run at least once before its condition is tested. Which loop structure meets this requirement?

  33. Question 33 of 60 Arrays Medium

    Given $names = @('Ana', 'Ben', 'Chen'), which expression returns Ben?

  34. Question 34 of 60 Hashtables Medium

    Given $server = @{ Name = 'WEB01'; Port = 443 }, which expression changes the port value to 8443?

  35. Question 35 of 60 Functions Medium

    Which function correctly accepts a name and returns the greeting Hello, Sam when called as Get-Greeting -Name Sam?

  36. Question 36 of 60 Scoping Medium

    A script assigns $script:logPath = 'C:/Logs/app.log' inside a function. Where is this value available afterward?

  37. Question 37 of 60 Basic error handling Medium

    You need a missing file error from Get-Content to be handled by a nearby catch block. Which statement is appropriate?

  38. Question 38 of 60 Working with help Medium

    Which command displays the detailed help for Get-Process, including parameter descriptions and examples?

  39. Question 39 of 60 Profiles Medium

    You want a custom function to load automatically whenever you start your current PowerShell host. Where should its definition be placed?

  40. Question 40 of 60 Script files Medium

    You are currently in the directory containing Report.ps1. Which command explicitly runs that script from the current directory?

  41. Question 41 of 60 Introduction to PowerShell Hard

    A command produces process objects and then passes them through Format-Table before another command attempts to sort by the CPU property. Why can the final sort no longer reliably access the original CPU values?

  42. Question 42 of 60 Console and ISE usage Hard

    Two PowerShell ISE tabs are opened using New PowerShell Tab. The first tab executes $global:Rate = 25, but $global:Rate is then queried in the second tab. What is the expected result?

  43. Question 43 of 60 Writing scripts Hard

    A script contains #Requires -RunAsAdministrator near the end of the file inside a branch that would never execute. The script is started by a non-administrative user. What happens?

  44. Question 44 of 60 Variables Hard

    What are the final value and runtime type of $x after [int]$x = '5'; $x = '07'?

  45. Question 45 of 60 User input Hard

    Given $n = Read-Host 'Number', a user enters 10. What does $n + 5 evaluate to if no explicit conversion is performed?

  46. Question 46 of 60 Comments Hard

    What happens when PowerShell parses <# outer <# inner #> outer #> 'Done'?

  47. Question 47 of 60 Cmdlets Hard

    A function named Get-Date shadows the built-in cmdlet in the current session. Which command explicitly invokes the original cmdlet?

  48. Question 48 of 60 Pipelines Hard

    What is the result of (Write-Output -NoEnumerate (1, 2) | Measure-Object).Count?

  49. Question 49 of 60 Operators Hard

    In order, what values are produced by 'PowerShell' -like 'Power*', 'PowerShell' -match '^Power', and 'PowerShell' -contains 'Power'?

  50. Question 50 of 60 Conditional statements (if, else, switch) Hard

    Which branch executes for if (@()) { 'A' } elseif ($null) { 'B' } else { 'C' }?

  51. Question 51 of 60 Conditional statements (if, else, switch) Hard

    What does switch -Regex ('cat') { 'a' { 'A' }; '^c' { 'C' }; default { 'D' } } output?

  52. Question 52 of 60 Loops (for, foreach, while, do) Hard

    What is the final value of $sum after $sum = 0; for ($i = 0; $i -lt 5; $i++) { if ($i -eq 2) { continue }; $sum += $i }?

  53. Question 53 of 60 Arrays Hard

    After $a = 1, 2; $b = ,$a, what are $b.Count and $b[0].Count?

  54. Question 54 of 60 Hashtables Hard

    What does ([ordered]@{ b = 2; a = 1 }).Keys -join ',' produce?

  55. Question 55 of 60 Functions Hard

    Consider function Show-Stage { begin { 'B' } process { "P$_" } end { 'E' } }. What is emitted by 1..3 | Show-Stage?

  56. Question 56 of 60 Scoping Hard

    At script scope, the following runs: $x = 1; function Set-X { $x = 2 }; Set-X; $x. What value is output?

  57. Question 57 of 60 Basic error handling Hard

    Why might try { Get-Item 'missing.file' } catch { 'Caught' } fail to execute the catch block even though Get-Item reports an error?

  58. Question 58 of 60 Working with help Hard

    Which command retrieves help specifically for the Filter parameter of Get-ChildItem?

  59. Question 59 of 60 Profiles Hard

    Which profile path does the automatic variable $PROFILE represent by default?

  60. Question 60 of 60 Script files Hard

    A script SetValue.ps1 contains $value = 42. From an existing session, which invocation makes $value remain available in that caller's current scope after the script finishes?

That's unit 5

Answer a few questions and your score shows up here.