⟩ Which command can be executed by a user who is already logged into the system, in order to change to the root user? (type the command without any parameters) a) su b) root c) chroot d) user
a) su
a) su
Which variable will display the list of the positional parameters? a) $# b) $* c) $? d) $$
The keyword 'local' is used a) to define a variable within a function for its local scope b) to redefine any global variable c) this is not a valid keyword d) none of the mentioned
What command would send the output of cmd1 to the input of cmd2? a) cmd1 | cmd2 b) cmd1 || cmd2 c) cmd1 && cmd2 d) cmd1 ; cmd2 e) cmd1 cmd2
What is the output of this program?
#!/bin/sh
var="google"
san_function() {
var="Linux"
echo $var
}
san_function
exit 0
a) google
b) Linux
c) command not found
d) none of the mentionedWhat is the output of this program?
#!/bin/bash
function san_function1 {
echo "This is first function"
}
san_function2() {
echo "This is second function"
}
san_function1
san_function2
exit 0
a) This is the first function
b) This is the second function
c) This is the first function
This is the second function
d) program will generate error because first function definition is not correctWhat is the output of this program?
#!/bin/sh
san_function1() {
a=5
echo "This is the first function"
san_function2
}
san_function2() {
echo "This is the second function"
san_function3
}
san_function3() {
echo "This is the third function"
}
san_function1
exit 0
a) This is the first function
This is the second function
This is the third function
b) This is the first function
This is the third function
This is the second function
c) This is the second function
This is the first function
This is the third function
d) This is the third function
This is the first function
This is the second functionWhich one of the following statement is true about variables in shell? a) variables do not require declaration before assigning value to them b) variables are case sensitive c) to extract the contents of a variable, we have to provide the variable a preceding $ d) all of the mentioned
What is the output of this program? #!/bin/bash san_var="google" echo "$san_var" echo '$san_var' echo '"$san_var"' echo "'$san_var'" echo $san_var exit 0 a) google $san_var "$san_var" 'google' $san_var b) google google "google" 'google' google c) program will generate an error message d) program will print nothing
What is the output of this program? #!/bin/bash var1=10 $var1=20 echo $var1 exit 0 a) program will print 10 b) program will generate a warning message c) program will print 20 d) both (a) and (b)
What is the output of this program?
#!/bin/bash
var[1]=san_1
var[2]=san_2
var[3]=san_3
echo ${var[*]}
exit 0
a) san_1
b) san_2
c) san_3
d) san_1 san_2 san_3