Unit 5: PowerShell Basics and Core Concepts - Subjective Questions

CSC104 — It Fundamentals • Practice Questions with Detailed Answers

20 questions

1

Define PowerShell and explain how it differs from a traditional command-line shell.

2

Compare the PowerShell Console and PowerShell ISE. Describe a suitable use case for each.

3

Describe the steps required to create, save, and execute a PowerShell script file. Also explain the purpose of the execution policy.

4

Explain how variables are declared and used in PowerShell. Discuss variable naming, data types, and type casting with examples.

5

Explain how PowerShell accepts user input. Write and explain a script that reads two numbers and displays their sum.

6

Distinguish between single-line comments, block comments, and comment-based help in PowerShell.

7

What is a PowerShell cmdlet? Explain its naming convention, parameters, aliases, and command-discovery facilities.

8

Explain the PowerShell pipeline and demonstrate how objects move through a multi-stage pipeline.

9

Classify the major operators available in PowerShell and provide examples of their use.

10

Describe the syntax and working of if, elseif, and else statements. Write a PowerShell example that assigns a grade from a numeric score.

11

Explain the switch statement in PowerShell. How can it be used for exact, wildcard, and regular-expression matching?

12

Compare the for, foreach, while, and do loops in PowerShell. State when each loop is appropriate.

13

Explain arrays in PowerShell. Describe how to create, access, modify, iterate over, and inspect an array.

14

What is a PowerShell hashtable? Explain how to create, access, update, remove, and enumerate key-value pairs.

15

Describe how functions are defined in PowerShell. Write an advanced function with a parameter, validation, pipeline support, and a return value.

16

Explain variable scope in PowerShell. Distinguish among global, script, local, and private scopes.

17

Explain basic error handling in PowerShell using try, catch, finally, throw, and -ErrorAction.

18

Describe how PowerShell's help system is used to discover command syntax, parameters, concepts, and examples.

19

What is a PowerShell profile? Explain how profiles are located, created, edited, and used safely.

20

Design a PowerShell script that reads a list of service names, checks each service, and reports its status. Explain how the script combines parameters, arrays, loops, pipelines, functions, and error handling.