PowerShell Variables MCQ Questions & Answers
PowerShell Variables MCQs : This section focuses on "Variables" in Powershell. These Multiple Choice Questions (MCQ) should be practiced to improve the Powershell skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.
1. Variables are the fundamental part of the Windows PowerShell.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, Variables are the fundamental part of the Windows PowerShell.
2. In Windows PowerShell, the name of a variable starts with the dollar?
A. @
B. #
C. &
D. $
View Answer
Ans : D
Explanation: In Windows PowerShell, the name of a variable starts with the dollar ($) sign, such as $process, $a.
3. The name of the variables are?
A. case-sensitive
B. not case-sensitive
C. Both A and B
D. None of the above
View Answer
Ans : B
Explanation: The name of the variables are not case-sensitive, and they include spaces and special characters.
4. By default, the value of all the variables in a PowerShell is?
A. zero
B. empty
C. null
D. one
View Answer
Ans : C
Explanation: By default, the value of all the variables in a PowerShell is $null.
5. If we use the special characters in the variable names, we will need to enclose them in the?
A. ()
B. []
C. {}
D. ||
View Answer
Ans : C
Explanation: In Windows PowerShell, special characters have special meaning. If we use the special characters in the variable names, we will need to enclose them in the braces {}.
6. Is variable name $my-variable is valid?
A. Invalid variable names
B. Valid variable names
C. Can be A and B
D. Can not say
View Answer
Ans : A
Explanation: Invalid variable names
7. We use an = operator to assign a specified value to the variable.
A. greater than
B. less than
C. dollar
D. equal to
View Answer
Ans : D
Explanation: We use an assignment operator (=) to assign a specified value to the variable. We can create a variable by assigning it a value.
8. Which command is used to delete a variable?
A. delete-variable
B. drop-variable
C. cls-variable
D. clear-variable
View Answer
Ans : D
Explanation: If you want to delete the value of the variable, use the clear-variable cmdlet, or change the value of it to $null
9. If you want to find the type of a variable, you can use the GetType() method.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, If you want to find the type of a variable, you can use the GetType() method.
10. To display the value of a variable, type the name of a variable, followed by a dollar sign $.
A. Yes
B. No
C. Can be yes or no
D. Can not say
View Answer
Ans : A
Explanation: Yes, To display the value of a variable, type the name of a variable, followed by a dollar sign $.
11. Operators are the building blocks of the Windows PowerShell.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, Operators are the building blocks of the Windows PowerShell.
Discussion