We had discussion on our final individual project regarding the steps to design a website and the functions need to include in our project. Dr Syamsul opened a link to allow us to book for our presentation date.
For the lab session
Today is our last class and we had a short online quiz. Below are the questions and answer of my quiz:
1. Which of the following is true in PHP if $x = 4 and $y = 9?
Select one:
$y > "9"
$x % $y > $y - $x
$x == 4
Correct
none of the answer
2. What will be displayed in a browser when the following PHP code is executed:
18. The built-in PHP function ___________ is used to collect values in a form with
21. Other than
<?php
<?php
$variable = 2;
switch ($variable)
{
case 1:
echo "Hello World";
break;
default:
echo "Hello Robert";
break;
}
?>
Select one:
3. Which operator is used to compare two values.
Select one:
Correct
4. The if statement is used to execute some code only if a specified condition is true.
Select one:
5. What will be displayed in a browser when the following PHP code is executed:
<?php$x = 6;
$y = 4;
$sum = $x + $y; //sum = 10
$ten = "Ten";
if ($sum >= 10 && $ten == "Ten") {
$answer = "Correct";
echo "Your answer is: $answer";
}
else {
$answer = "Incorrect";
echo "Your answer is: $answer";
}?>
Select one:
6. What will be printed?
if ('2' == '02') {
echo 'True';
} else {
echo 'False';
}
Select one:
7. How do you get information from a form that is submitted using the "get" method?
Select one:
8. When using the POST method, variables are displayed in the URL.
Select one:
9. Since PHP is _____________, the source code is freely available on the web, and developers can install and use it without paying licensing fees or investing in expensive hardware or software.
Select one:
10. What will be displayed in a browser when the following PHP code is executed:
<?phpif (8 <= 7) {
echo "Hello World";
}
else {
echo "Hello YouTube";
}?>
Select one:
11. What will be printed by the code below?
<?php
FUNCTION TEST()
{
ECHO "HELLO WORLD!\n";
}
test();
?>
Select one:
12. All the following statements are TRUE when describing form controls, EXCEPT:
Select one:
13. PHP server scripts are surrounded by which delimiters?
Select one:
14. What is the correct way to create a function in PHP?
Select one:
15. Which of the following is NOT a valid PHP variable?
Select one:
16. Which one is the expected output of the following codes?
============================
<html><head></head>
<body>
<h4>CSS stands for:</h4>
<?php
//print output
echo '<h4><i>A: Cascading Style Sheet </i></h4>';
?>
</body></html>
==========================
Select one:
17. In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings.
Select one:
18. The built-in PHP function ___________ is used to collect values in a form with method="post"
.
Select one:
19. What is the output of this code?
<?php
function apple($apples=4)
{
$apples=$apples/2;
return $apples;
}
$apples = 10;
apple($apples);
echo $apples;
?>
Select one:
20. What is the expected output of the following PHP codes?
<?php
$dob= "hello";
$age=$dob + 15;
echo "$age";
?>
Select one:
21. Other than echo
, state the other way of printing a statement in PHP.
Select one:
22. What is the output of the following?
<?php
function a($number)
{
return (b($number)*$number);
}
function b($number)
{
++$number;
}
echo a(5);
?>
Select one:
23. What will be displayed in a browser when the following PHP code is executed:
<?php
$bookColor = "red";
$bookName = "The PHP Basics";
if ($bookColor == "red" && $bookName == "Steve Jobs") {
echo "You have the wrong book";
}
else {
echo "You might have the right book";
}?>
Select one:
24. Which one of these variables has a legal name?
Select one:
Correct
25. PHP and JavaScript are the same.
Select one:
26. In PHP, both ________ and ________ can be used for strings.
Select one:
27. What is a correct way to add a comment in PHP?
Select one:
28. What is the output produced by the PHP codes below:
<?php
$x = 1.5;
settype ($x, "integer”);
echo $x;
?>
Select one:
29. Which statement about PHP functions is correct?
Select one:
30. What would be the output of the following PHP codes?
<?php
$languages=array(0 => "Perl", 1 => "PHP");
$search= "PHP";
$limit= count($languages);
for ($i=0;$i<$limit;$i++){
echo "<br>Testing for match with $languages[$i]";
if ($search == $languages[$i])
{
echo "<br> $search is an approved language";
}
}
?>
Select one:
Correct
No comments:
Post a Comment