Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

8/14/2019 Graded Quiz Unit 6

CS 3305 Web Programming 2 - Term 5, 2018-2019


Home ► My courses ► CS 3305 - AY2019-T5 ► 25 July - 31 July ► Graded Quiz Unit 6

Started on Wednesday, 31 July 2019, 4:04 PM


State Finished
Completed on Wednesday, 31 July 2019, 4:22 PM
Time taken 18 mins 41 secs
Marks 15.00/20.00
Grade 75.00 out of 100.00

Question 1 What will be the value of $var?


Correct
$var = 1 / 2;
Mark 1.00 out of
1.00
Select one:
a. 0

b. 0.5

c. 1

d. 2

Your answer is correct.


The correct answer is: 0.5

Question 2 What is the valid way to start a PHP function?


Correct

Mark 1.00 out of Select one:


1.00 a. function test{}

b. function test[]

c. def function test{}

d. function test()

Your answer is correct.


The correct answer is: function test()

https://my.uopeople.edu/mod/quiz/review.php?attempt=2033153&cmid=177962 1/10
8/14/2019
Question 3
Graded Quiz Unit 6
PHP variables are weekly typed, which means that:
Correct

Mark 1.00 out of Select one:


1.00 a. you can’t store data in them for a long time

b. you do not have to de ne their type before you initialize them

c. strongly typed languages like Java are better

d. strongly typed languages do not require variable de nitions

Your answer is correct.


The correct answer is: you do not have to de ne their type before you
initialize them

Question 4 When installing online applications on a PHP server, what information is


Correct needed?
Mark 1.00 out of
1.00 Select one:
a. database username

b. database password

c. database host name

d. All of the above

Your answer is correct.


The correct answer is: All of the above

https://my.uopeople.edu/mod/quiz/review.php?attempt=2033153&cmid=177962 2/10
8/14/2019
Question 5
Graded Quiz Unit 6
What will be displayed by this code?
Correct
<?php      
Mark 1.00 out of FUNCTION TEST()    
1.00
 {         
     ECHO "HELLO WORLD!\n";  
 }
     test();
 ?>

Select one:
a. Nothing

b. test()

c. Blinking text

d. HELLO WORLD!

Your answer is correct.

The correct answer is: HELLO WORLD!

Question 6 How do you join strings in PHP?


Correct

Mark 1.00 out of Select one:


1.00 a. $m = “aa” + “bb”;

b. $m = “aa” join “bb”;

c. $m = “aa”.”bb”;

d. $m = join(“aa”,”bb”);

Your answer is correct.


The correct answer is: $m = “aa”.”bb”;

https://my.uopeople.edu/mod/quiz/review.php?attempt=2033153&cmid=177962 3/10
8/14/2019
Question 7
Graded Quiz Unit 6
What does PHP stand for?
Correct

Mark 1.00 out of Select one:


1.00 a. PHP: Hypertext Preprocessor

b. Private Home Page

c. Personal Home Page

d. Personal Hypertext Processor

Your answer is correct.

The correct answer is: PHP: Hypertext Preprocessor

Question 8 What will this code display?


Incorrect
<?php
Mark 0.00 out of
1.00
    $a = 1;

    function Test()


    {
        echo "a = $a";
    }
    Test();
?>

Select one:
a. 1

b. 3

c. Warning or no value

d. An error

Your answer is incorrect.

The correct answer is: Warning or no value

https://my.uopeople.edu/mod/quiz/review.php?attempt=2033153&cmid=177962 4/10
8/14/2019
Question 9
Graded Quiz Unit 6
What is the correct way to add 1 to the $count variable?
Incorrect

Mark 0.00 out of Select one:


1.00 a. $count =+1

b. ++count

c. count+;

d. None of the above

Your answer is incorrect.

The correct answer is: None of the above

Question 10 What is an example of an open source shopping cart PHP application?


Correct

Mark 1.00 out of Select one:


1.00 a. Amazon

b. Facebook

c. osCommerce

d. ShopNow

Your answer is correct.


The correct answer is: osCommerce

https://my.uopeople.edu/mod/quiz/review.php?attempt=2033153&cmid=177962 5/10
8/14/2019
Question 11
Graded Quiz Unit 6
How can comments be implemented in PHP?
Correct

Mark 1.00 out of Select one:


1.00 a. // commented code to the end of the line

b. /* commented code can be on multiple lines */

c. # commented code to the end of the line

d. All of the above

Your answer is correct.

The correct answer is: All of the above

Question 12 What will the value of $x be at the end of this script?


Incorrect
<?PHP
Mark 0.00 out of $x=0;
1.00
$x=$x+1;
echo $x.” value”;
$x++;
?>

Select one:
a. 1

b. 2

c. 3

d. There will be an error

Your answer is incorrect.


The correct answer is: 2

https://my.uopeople.edu/mod/quiz/review.php?attempt=2033153&cmid=177962 6/10
8/14/2019
Question 13
Graded Quiz Unit 6
What will be printed?
Correct
$var=’a’;
Mark 1.00 out of $VAR=’b’;
1.00
echo “$var$VAR”;

Select one:
a. aA

b. aa

c. bB

d. ab

Your answer is correct.


The correct answer is: ab

Question 14 What will be printed?


Correct
$var = true;
Mark 1.00 out of if ($var) {
1.00
     echo 'true';
} else {
     echo 'false';
}

Select one:
a. false

b. error

c. warning

d. true

Your answer is correct.


The correct answer is: true

https://my.uopeople.edu/mod/quiz/review.php?attempt=2033153&cmid=177962 7/10
8/14/2019
Question 15
Graded Quiz Unit 6
How do you write "Hello World" in PHP?
Correct

Mark 1.00 out of Select one:


1.00 a. Document.Write("Hello World");

b. echo “Hello World”;

c. “Hello World”

d. system.out.println(“Hello World”);

Your answer is correct.


The correct answer is: echo “Hello World”;

Question 16 PHP server scripts are surrounded by what delimiters?


Correct

Mark 1.00 out of Select one:


1.00 a. <&></&>

b. <?PHP  ?>

c. <?PHP > </?>

d. <script></script>

Your answer is correct.


The correct answer is: <?PHP  ?>

https://my.uopeople.edu/mod/quiz/review.php?attempt=2033153&cmid=177962 8/10
8/14/2019
Question 17
Graded Quiz Unit 6
What character concatenates strings in PHP?
Incorrect a. 
Mark 0.00 out of b. 
1.00 c. 
d.RIGHT 

Select one:
a. ;

b. &

c. *

d. .

Your answer is incorrect.


The correct answer is: .

Question 18 Which one is NOT a valid PHP comparison operator?


Incorrect

Mark 0.00 out of Select one:


1.00 a. !=

b. <>

c. !<

d. ===

Your answer is incorrect.

The correct answer is: !<

https://my.uopeople.edu/mod/quiz/review.php?attempt=2033153&cmid=177962 9/10
8/14/2019
Question 19
Graded Quiz Unit 6
Which of the following is a valid way to start a for loop in PHP that would
Correct print out the numbers 0 through 4?
Mark 1.00 out of
1.00 Select one:
a. for($i < 5; $i = 0;)

b. for($i = 0; $i < 5; $i++)

c. for($i < 5;)

d. for( $i < 5; $i = 0; $i++)

Your answer is correct.

The correct answer is: for($i = 0; $i < 5; $i++)

Question 20 What function can you use to get the position of a string or character inside
Correct a string?
Mark 1.00 out of
1.00 Select one:
a. string_position()

b. length()

c. len()

d. strrpos()

Your answer is correct.


The correct answer is: strrpos()

◀ Self-Quiz Unit 6
Jump to...

Learning Guide Unit 7 ►

https://my.uopeople.edu/mod/quiz/review.php?attempt=2033153&cmid=177962 10/10

You might also like