You are on page 1of 12

1-3.

STUDENT REGISTRATION FORM


OUTPUT:
SOURCE CODE:
4. MULTIPLICATION TABLE
OUTPUT:
SOURCE CODE:

5. FIBONACCI
OUTPUT:
SOURCE CODE:

6. FACTORIAL
OUTPUT:
SOURCE CODE:
QUESTION AND ANSWER
1. What is a variable?
- Variables are "containers" for storing information. A variable
can have a short name (like x and y) or a more descriptive name
(age, carname, total_volume).
2. What are the rules in creating a variable?

 A variable starts with the $ sign, followed by the name of


the variable
 A variable name must start with a letter or the underscore
character
 A variable name cannot start with a number
 A variable name can only contain alpha-numeric characters
and underscores (A-z, 0-9, and _ )
 Variable names are case-sensitive ($age and $AGE are two
different variables)

3. Is it important to know HTML and CSS before using PHP?


Explain
- I think it is not necessary to study the HTML and CSS since
HTML is a scripting language while PHP is a programming language
but we should have basic knowledge about HTML because in HTML it
can display your content. PHP is server side language while in
HTML & CSS is more on client side language.
4. What is the difference between operator precedence and
operator associativity?
- Precedence of operators decides the order of execution of
operators in an expression, in other words, it is like the
direction of associativity of an operator. While, the
associativity of an operator is a property that determines how
operators of the same precedence are grouped in the absence of
parentheses specifically the symbols.

5. What are the different control structures? Explain each


- The different conditional statements are IF, IF ELSE, IF
ELSEIF IF and the SWITCH. IF ELSE is used to a condition of
codes whether it is satisfied or not. Switch statements are used
to different actions that basing on the different condition
also.
6. Explain the rules of break, continue, and go to statements.
- Break Statement: ends execution of the current structure.
Break accepts an optional numeric argument which tells it how
much execution of nested structures to be interrupted.
- Continue Statement: is used to stop processing the current
block of code in the loop and goes to the next iteration.
- Go to Statement: which is the operator of unconditional
transition. It used to go into another area of the code. A place
where you must go to the program is indicated by the label (a
simple identifier), followed by a colon. For the transition
after the goto statement is put the desired label.

You might also like