NEW
Font size
WorksheetsQuiz on Variables in Programming
Total questions: 15
Worksheet time: 8mins
What is a variable?
A fixed value in a program
A storage location identified for data that can change
A type of hardware component
A constant in mathematics
What does an environment variable provide?
Hardware specifications
Network configurations
Settings and configurations
User interface design
What is a shell variable?
A variable inherited by child shells and processes
A variable that is not inherited by child shells and processes
A variable used in web development
A variable that stores user passwords
What is a local variable?
A variable that is always available
A variable defined in scripts and script functions
A variable used for network settings
A variable that stores system logs
What does the HISTSIZE variable determine?
The size of the user's home directory
The number of lines or commands stored in a history list
The number of active users
The size of the system memory
What does OLDPWD represent?
The current working directory
The previous directory the user accessed
The user's password
The user's email address
What does the HISTFILE variable store?
User passwords
Past commands
User emails
System logs
Which variable is typically defined in scripts and does not exist after the script is run?
Environment variable
Shell variable
Local variable
User variable
What does the command `export [name]=[value]` do?
Deletes an environment variable.
Creates a new environment variable.
Lists all environment variables.
Displays the value of a variable.
How does the command `echo $[name]` function in a shell?
Deletes a variable.
Displays the contents of a variable.
Creates a new variable.
Lists all variables.
What is the function of the `env` or `printenv` command?
Deletes environment variables.
Displays current environment variables and their values.
Creates new environment variables.
Modifies existing environment variables.
What does the `set` command do in a shell environment?
Deletes all variables.
Displays a list of all variables and functions.
Creates a new shell function.
Modifies the shell prompt.
What is the purpose of the `unset [name]` command?
Creates a new variable.
Displays the value of a variable.
Removes a variable and its value.
Lists all environment variables.
What does `/etc/profile` do in a shell environment?
Deletes a global environment variable.
Modifies a global environment variable.
Lists all global environment variables.
Displays the current directory.
What is the role of `~./bash_profile` in a shell?
Deletes a global environment variable.
Modifies a global environment variable.
Lists all global environment variables.
Displays the current directory.
