Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Which PHP function returns true if the passed PHP variable exists? a) exists($var) b) empty($var) c) set($var) d) isset($var) e) isempty($var) 2. Which of

1. Which PHP function returns true if the passed PHP variable exists? a) exists($var) b) empty($var) c) set($var) d) isset($var) e) isempty($var)

2. Which of the following is an acceptable way to create a PHP array? a) $example = new $example[10]; b) $example = new string[10]; c) $example = new array(10); d) $example = array(); e) All of the above

3. In the PHP code below, the string "cat" is a(n) ___________ ? $abc = $example["cat"]; a) array b) array value c) ordered map d) array element e) array key

4. The _____________ function in PHP returns an array of strings, each of which is a substring of main string formed by splitting it on boundaries formed by a delimiter. a) explode b) substring c) delimit d) array e) file

5. What will be the output of the following PHP code? a) Nothing (syntax error) b) country=Canada c) country=France d) country=Germany e) country=1

6. To display the second string in the following array (i.e., "France"), which of the following lines of PHP would work? a) echo $countries[1]; b) echo $countries[2]; c) echo France; d) $countries[1]; e) $countries[2];

7. What will be the output of the following PHP code?

$states = array("Canada" => array( "population" => "35,000,000", "capital" => "Ottawa"),

"France" => array( "population" => "64,600,000", "capital" => "Paris")

"Germany" => array( "population" => "82,600,000", "capital" => "Berlin") );

echo "population=" . $states["France"]["population"] . " capital=" . $states["Germany"]["capital"];

?>

  1. Nothing (syntax error)
  2. population=64,600,000 capital=Paris
  3. population=64,600,000 capital=Berlin
  4. population=82,600,000 capital=Berlin
  5. population=82,600,000 . capital=Berlin

For the following question use the HTML code below

source.htm

click

<%

index.php

if ($_GET["name"] == "yes")

if ($_GET["44"] == "id")

echo "one";

else

echo "two";

else

if ($_GET["id"] == 44)

8. Which statement correctly retrieves a field named txtName from a form that uses the post method? a) $_POST["txtName"] b) $_GET[txtName"] c) $_GET["txtName"] d) $_POST[txtName] e) $_SESSION["txtName"]

source.htm

click

<%

index.php

if ($_GET["name"] == "yes")

if ($_GET["44"] == "id")

echo "one";

else

echo "two";

else

if ($_GET["id"] == 44)

echo "three";

else

echo "four";

%>

9. If the above file index.php was called by source.htm in the manner illustrated in the above box, the code fragment illustrated above would display a) one b) two c) three d) four e) five

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

Students also viewed these Databases questions

Question

Explain how CAT bonds work.

Answered: 1 week ago

Question

Technology. Refer to Case

Answered: 1 week ago