Unit5 - Subjective Questions

CSC104 • Practice Questions with Detailed Answers

1

Define PowerShell and explain its primary purpose in the context of system administration.

2

Distinguish between the PowerShell Console and the PowerShell ISE (Integrated Scripting Environment).

3

Explain the concept of Cmdlets in PowerShell and describe the naming convention used for them.

4

Describe how variables are defined in PowerShell. Explain the significance of dynamic typing.

5

Explain the functionality of the Pipeline (|) in PowerShell. How does it differ from text-based piping in shells like Bash?

6

List and explain the different types of Comparison Operators used in PowerShell.

7

Provide the syntax for the if, elseif, and else conditional statements in PowerShell with an example.

8

Discuss the Switch statement in PowerShell. When is it preferred over multiple if-elseif statements?

9

Explain the difference between the While loop and the Do-While loop in PowerShell.

10

How are Arrays declared and accessed in PowerShell? Provide examples.

11

Define a Hashtable in PowerShell. How does it differ from an Array?

12

Write a PowerShell script that defines a Function named Get-Square. The function should accept an integer as a parameter and return its square.

13

Explain the concept of Variable Scoping in PowerShell (Global, Script, Private, Local).

14

Describe Error Handling in PowerShell using Try, Catch, and Finally blocks.

15

What are PowerShell Profiles? Explain their usage.

16

Explain the difference between Read-Host and Write-Host cmdlets.

17

How does PowerShell handle comments? Describe the syntax for single-line and multi-line comments.

18

Explain the significance of Help System in PowerShell. How is Get-Help used?

19

Compare the Foreach loop statement with the ForEach-Object cmdlet used in pipelines.

20

What are Logical Operators in PowerShell? List the common ones and their function.