0% found this document useful (0 votes)
3 views

TUTORIAL_2 PHP (1)

PHP challenges

Uploaded by

johnkiduge
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

TUTORIAL_2 PHP (1)

PHP challenges

Uploaded by

johnkiduge
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

PRACTICAL ASSIGNMENT (INDIVIDUAL- 10 MARKS)

1. Create a PHP for a program that will compute and display the sum of the first 100
natural numbers: 1 + 2 + 3 + 4.......... + 100.
2. Develop a PHP for a computer program that will display all odd numbers from 77
down to 5 inclusive.
3. Create a PHP for a program that will compute and display the sum of the first 40
even numbers.
4. Create a PHP for the problem of printing even numbers between 9 and 27.
5. You are a teacher at a prestigious school, and it’s time to evaluate your

students’ performance. You’ve been tasked with creating a program that


assigns grades based on their exam marks. Here are the rules:
▪ If a student’s marks are 60% or more, they receive a First Division.
▪ If their marks fall between 45% and 59%, they earn a Second
Division.
▪ For marks in the range of 33% to 44%, the grade is Third Division.
▪ Any student scoring less than 33% is considered a Fail.
Your task is to write a PHP program using a switch statement that takes a
student’s marks as input and outputs their corresponding grade. Remember
to handle all possible scenarios!
6. Write a program in PHP to calculate and print the factorial of a number using a
for loop. The factorial of a number is the product of all integers up to and including
that number, so the factorial of 4 is 4*3*2*1= 24.
7. Write a program in PHP using a for loop to add all the integers between 0 and 30
and display the total.
8. Write a program in PHP displays 1-2-3-4-5-6-7-8-9-10 on one line. There will be no
hyphen(-) at the starting and ending position.
9. write a PHP program that determines whether a person is eligible to vote based
on their age. If the person is 18 years or older, they are eligible to vote; otherwise,
they are not eligible to vote.
10. Write a program in PHP to calculate Square Root of a number.
CHALLENGE QUESTION N0:1(GROUP- 4 MARKS)

You are building a simple application program that allows users to convert
temperatures between Fahrenheit and Celsius. Users can input a temperature value,
select the desired conversion (Fahrenheit to Celsius or vice versa), and get the
converted result.
Create a simple HTML form and display the results through PHP echo statement.
CHALLENGE QUESTION N0:2 (GROUP- 2 MARKS)

Create a simple HTML form and accept the username and display the name
through PHP echo statement.

Sample output of the HTML form :


CHALLENGE QUESTION N0:3 (GROUP- 4 MARKS)
Suppose you are programmer at ALPHA COMPANY, your responsibility is to
develop a PHP program aimed at assessing and delivering feedback on a
student's academic progress based on their Continuous Assessment (CA) and
Semester Exam (SE) scores. Start by utilizing an HTML form for entering both CA
and SE scores. Upon submission, the program calculates the total score (Total =
CA + SE). The evaluation criteria are straightforward: if the Continuous Assessment
(CA) score is 25 or lower, the student automatically receives a "FAIL Due to CA"
result. For CA scores above 25, the program proceeds to evaluate the Semester
Exam (SE) score. A score below 20 results in a "FAIL Due to SE," while a score of 20
or higher and a total score exceeding 50 leads to a "Pass." If neither condition is
met, the student receives a "FAIL Due to Overall" result. Your objective is to ensure
the PHP program accurately adheres to these evaluation guidelines to provide
clear and timely feedback on student performance.

You might also like