Professional Documents
Culture Documents
i
1.0 QUESTION 1 (Escaping The Character)
ANSWER :
1
REASON :
Notice how echo 5x5=$foo outputs $foo rather than replacing it with 25
This is true for both variables and character escape-sequences (such as \n or \\)
OUTPUT :
2
2.0 QUESTION 2 (Arithmetic Operator)
ANSWER :
3
REASON :
$a - $b // subtraction
$a * $b // multiplication
$a / $b // division
$a += 5 // $a = $a+5 Also works for *= and /=
OUTPUT :
4
3.0 QUESTION 3 (Concatenation)
ANSWER :
REASON :
OUTPUT :
5
4.0 QUESTION 4 (Escaping the Character)
ANSWER :
REASON :
If the string has a set of double quotation marks that must remain visible, use the \
[backslash] before the quotation marks to ignore and display them.
OUTPUT :
6
5.0 QUESTION 5 (IF ELSE)
ANSWER 1:
OUTPUT 1:
7
ANSWER 2:
OUTPUT 2:
REASON :
Control Structures: Are the structures within a language that allow us to control the
flow of execution through a program or script.
Grouped into conditional (branching) structures (e.g. if/else) and repetition
structures (e.g. while loops).
8
6.0 QUESTION 6 (While Loop)
ANSWER :
9
REASON :
While (condition)
{
Statements;
}
OUTPUT :
10
7.0 QUESTION 7 (Functions)
ANSWER :
11
REASON :
Unlike variables, function names are not case sensitive (foo() == Foo() ==
FoO())
OUTPUT :
12