0% found this document useful (0 votes)
8 views3 pages

Internet Technology Sample Quest

The document contains a series of PHP programming questions and tasks, including creating constants, defining functions, manipulating arrays, and generating outputs. It also covers concepts related to web servers, OSI model protocols, and string handling in PHP. Additionally, it includes practical exercises such as converting temperature and printing multiplication tables.

Uploaded by

Aisosa Otote
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Internet Technology Sample Quest

The document contains a series of PHP programming questions and tasks, including creating constants, defining functions, manipulating arrays, and generating outputs. It also covers concepts related to web servers, OSI model protocols, and string handling in PHP. Additionally, it includes practical exercises such as converting temperature and printing multiplication tables.

Uploaded by

Aisosa Otote
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1. Write a PHP statement to create a constant value holding the name of your school.

2. What is the output of the following PHP script?


<?php
$x = 80;
define ('ABC', $x+1);
$x += ABC;
echo "X = $x";
echo "ABC = ".ABC;
?>
3. What do you think the output of the following statement is?
<?php
define ('NUM', '7');
$a = NUM;
echo gettype($a);
?>
4. Write an if-statement that checks the value of a variable $cityand displays a message
if it is equal to 'Ilishan'
5. Using a whileloop, write a program that prints a multiplication table for the number 5
in this format: 5 * 1 = 5 all the way to 5 * 10 = 50
6. Name the functions you would use to: a) Round a number down c) Generate a
random number. d) Count words in a string

Given the following PHP array:


<?php
$meats = array( 'fish', 'chicken', 'ham','beef');
?>

7. Write a line of code to change 'ham' to 'turkey'.


Ans:
<?php $meats[2] = 'turkey'; ?>

8. Write a line of code to remove 'fish'.


Ans:
<?php unset($meats[0]); ?>
9. What are the two types of PHP arrays, and how do they differ?
Ans:
The two types of PHP arrays are numerically indexed arrays and string-indexed
arrays
(also known as associative arrays). With the former, numbers are used to identify
array
elements; with the latter, unique string labels (keys) are used.
10. What is the output of the following?
<?php
$arr = array(23,45,2,67,17,12,5,68,14,78,192,4);
foreach ($arr as $n) {
if($n<15){
echo "$n <br>";
}
}
?>
11. State a reason why you would prefer to use functions in PHP?
12. List two (2) protocols each that run on Layer 7 and Layer 4 of the OSI model
13. Distinguish with an example and output between the use of single quotes ‘…’ and
double quotes “…” for strings in PHP.
14. What is a Web Server? Give an example.
15. You have decided to apply for a job at Arikzy Software Development Company, list 4
possible roles that you can possibly apply for.
16. State the function of an application server.
17. Mention some features of a web browser
18. What is the output of the following?
<?php
define("SCHOOL", "Babcock University");
define("DEPARTMENT", "Computer Science");
echo 'Welcome to '.DEPARTMENT.' department in '.SCHOOL;
?>
19. What is the output of the following?
<?php
echo "<ul>";
for ($x=1; $x<7; $x++)
{
echo "<li> Item $x </li>";
}
echo "</ul>";
?>
20. Which of the following is not a web server scripting software
a) ASP.NET b) PHP c) Python d) C
21. PHP is cross platform. What does it mean?
22. What is the outcome of the following?
<?php
$string = 'Computer';
echo strlen($string)."<br>";
echo ucwords($string)."<br>";
echo strrev($string)."<br>";
echo str_repeat($string,2)."<br>";
?>
23. Identify a tool that can help in version control of applications
24. Write a PHP script to translate ‘internet technologies’ to
i. Internet Technologies
ii. INTERNET TECHNOLOGIES
iii. seigolonhcet tenretni
iv. Internet technologies
25. Write a PHP script that accepts a temperature value in Celsius (C) through a Web
form and converts it to the Fahrenheit (F) scale. The conversion formula to use is: F =
(9/5) * C + 32. Display the output to the user in this format: " _ _ deg. Celsius is
equivalent to: _ _ deg. Fahrenheit”
26. Using only an array, an array sorting function and a foreach loop, write a program
that prints the months of the year alphabetically in descending order in separate lines.
27. Below are the scores of 20 students representing the numerical grades of individual
students in a course – COSC444: 43, 23, 45, 65, 23, 29, 12, 43, 65, 87, 56, 75, 45, 76,
85, 34, 34, 56, 45, 98. Write a PHP script that accepts and stores the above scores in
an array and perform the following task
a. write a PHP array function to sum all the scores.
b. using a PHP in-built function to display the maximum and minimum value of the
array.
28. Using a for loop and a while loop, write a PHP script to print all even numbers from 1
to 1000 in separate lines.

You might also like