You are on page 1of 13

IT ELEC1

MIDTERM PRACTICE ACTIVITY 1


INSTRUCTION:

1. Run the Notepad++ application.


INSTRUCTION: CONTINUE…

2. In Notepad++, click File and select New.


INSTRUCTION: CONTINUE…

3. Solve the problem below:


Create a PHP file with PHP scripts that has four variables (val1, val2, val3, val4) with values 2, 3, 1, and 4. It will perform the following tasks:
• Displays the text, “IT ELEC1 Midterm Practice Activity 1” using an echo statement.
• Displays your complete name as the author in separate line using another echo statement.
• Displays the date today in separate line using another echo statement.
• Displays a blank line.
• Displays the four variables with values in separate lines using separate echo statements.
• Displays another blank line.
• Displays in separate line using another echo statement the text, “Is val2 less than val4? ”, and compares val2 and val4 using less than
operator.
• Displays in separate line using another echo statement the text, “Is val1 greater than val3? ”, and compares val1 and val3 using greater than
operator.
• Displays in separate line using another echo statement the text, “Is val1 less than or equal to val2? ”, and compares val1 and val2 using less
than or equal to operator.
• Displays in separate line using another echo statement the text, “Is val3 greater than or equal to val4? ”, and compares val3 and val4 using
greater than or equal to operator.
• Displays in separate line using another echo statement the text, “Is val1 equal to val4? ”, and compares val1 and val4 using equal to operator.
• Displays in separate line using another echo statement the text, “Is val2 not equal to val3? ”, and compares val2 and val3 using not equal to
operator.
Save your file as itelec1_midterm1.php in your folder (itelec1).
INSTRUCTIONS: CONTINUE…

4. In Notepad++, type the codes below:

NOTE: Change Gilbert C. Gungob to your complete name.


INSTRUCTIONS: CONTINUE…

5. In Notepad++, go to File on the menu bar and click Save.


INSTRUCTIONS: CONTINUE…

6. In Save As dialog box,


• Locate and select your folder (itelec1).
• In File name textbox, type: itelec1_midterm1.
• In Save as type, choose PHP Hypertext Preprocessor File.
• Click Save button.
INSTRUCTIONS: CONTINUE…
INSTRUCTIONS: CONTINUE…

7. Run or open the XAMPP Control Panel.


INSTRUCTIONS: CONTINUE…

8. In the XAMPP Control Panel, click the Start button for Apache.
INSTRUCTIONS: CONTINUE…

9. Run or open a web browser.


INSTRUCTIONS: CONTINUE…

10. In the address bar of the browser, type:


//localhost/itelec1/itelec1_midterm1.php
INSTRUCTIONS: CONTINUE…

11. The output of your work must be like the figure below:

NOTE: PHP will return a value of 1 if the expression is true and will not return a value if
the expression is false.

You might also like