DispersedNet
SiteMap
Unix Concepts
Shell Programming
Shell Scripting
Unix Questions
Shell Variables
«Prev
Next»
Shell Programming
Shell Programming
Unix Shell Available
Determining Unix Shell
Shell Scripts Unix
Interpreted Compiled Programs
Understanding Scripting Options
Shell Compiled Programs
Shell Programming Conclusion
Shell Components
Shell Script Macro
Built in Components
Input Output Tools
Shell Script Tests
Script Variables
shell-script-control-structures
Regex Define Patterns
Shell Program Components
Writing First Script
Interactive Shell Script
Defining Script File
Using Text Editor
Echo Command Display Data
Read Input Command
Including Comments Scripts
Setting File Permissions
Running Command Line
First Script Conclusion
Working With Variables
Command Line Arguments
Predefined System Variables
System Variables
Environment Variables
Syntax Affects Interpretation
Using Strings Variables
Using Numbers-inVariables
Performing Math Variables
Using Array Variables
Scripts Variable Summary
Designing Scripts
Script Objective
Script Flow
loop Tests
Checking Commands
error Trapping
Making Script Portable
Documenting Script
Designing Shell Scripts
Using Numbers in Shell Variables - Quiz
Each question is worth one point. Select the best answer or answers for each question.
1.
What is the difference between strings and numbers when they are used as variable values?
Please select the best answer.
A.
Strings and numbers in variables are treated the same way, though the operations that can be performed on the variables depend on the value stored in the variable.
B.
Variables that contain numbers must be predefined in order to permit calculations on numeric values. String variables do not require this step.
C.
String variables are referenced using different syntax than numeric variables.
D.
String variables can only be used in certain shells; numeric variables can be used in any shell.
2.
What is the meaning of the following statement:
C=expr $A \* $B
Please select the best answer.
A.
The value of A modulus B is calculated by the
expr
command and assigned to C using a positional variable.
B.
The string expr $A * $B is assigned to C because of the quotation marks around it.
C.
This is an invalid syntax in the Bourne shell because it does not support internal calculations.
D.
The value of A times B is calculated by the
expr
command and assigned to C using command substitution.
3.
Which of these are valid numeric variable assignments (that is, which variable can subsequently be used in a numeric calculation)?
Please select all the correct answers.
A.
YEAR=1492
B.
COUNT=1492
C.
DATE=14JAN
D.
TOTAL=1910934
4.
Which of the following statements about string variables are accurate?
Please select all the correct answers.
A.
Only the most basic string manipulations can be performed using shell internal commands.
B.
Only the most basic string manipulations can be performed using external commands.
C.
Shell scripts generally do not need to do a lot of string manipulations.
D.
The shell makes no distinction between variables containing numbers and those containing strings.