Sie sind auf Seite 1von 6

Which functions relocates the browser to the a specified page (e.g.index.

php)

*
* 1) location('index.php');
* 2) Header('location:index.php');
* 3) None of the above
* 4) $HTTP_SERVER_VAR['PHP_SELF'];
* 5) return('location:index.php');

2
What is the output of this code?
$x = '1';
$x .= '3';
echo $x;

*
* 1) 4
* 2) '1'.'3'
* 3) 1.3
* 4) 13

3
$score is an array with 5 elements,indexed 0 to 4.
How do you list all five elements with a for loop?

*
* 1) for ($i = 0; $i <= 5; $i++) { print $score[$i]; }
* 2) for ($i = 0; $i < 4; $i++) { print $score[$i]; }
* 3) $i =0; for ($i < 5) { i++; print $score[$i]; }
* 4) for ($i = 0; $i < 5; $i++) { print $score[$i]; }
* 5) for ($i = 0, $i < 5, $i++) { print $score[$i]; }

4
What is the result of this code:
$var = 7 % 2;
echo $var;

*
* 1) It displays 1
* 2) It displays 7.00%
* 3) It displays 3 remainder 1
* 4) It displays 1.5
* 5) It displays 3.5

5
Unlike JSP and ASP PHP has no support for the transformation XML documents.

*
* 1) False
* 2) True
6
The array $qry['item'] returns a list of items stored in database. How can we ca
lculate the number of these items?

*
* 1) $total_items = length($qry['item']);
* 2) $total_items = $qry['item'].length;
* 3) $total_items = count($qry['item']);
* 4) $total_items = sizeof($qry['item']);
* 5) $total_items = $qry['item'].count;

7
A member's first name is stored in the variable $firstname and has temporarly be
en assigned the value Michael. Which code will return this HTML code?
<p>First name: Michael.</p>

*
* 1) echo '<p>First name: $firstname</p>';
* 2) None of the above
* 3) echo '<p>First name:' + $firstname + '</p>';
* 4) echo <p>First name: $firstname</p>;
* 5) echo '<p>First name: '.$firstname.'</p>';

8
How do you print to the screen the numerical index values 3 and 7 of the two-dim
ensional array $grid?

*
* 1) print $grid[3.7];
* 2) print $grid(3)(7);
* 3) print $grid['3'.'7'];
* 4) print $grid[3][7];

9
What is the result of this code:
$age = $HTTP_POST_VARS['age'];
$group = ($age >= 18 ? 'Red' : 'Blue');
echo '<p>'.$group.' group.</p>';

*
* 1) It will display 'Red Group' group if the age entered in the form is 1
8 or over.
* 2) It will display either Red or Blue group randomly.
* 3) It will display 'Blue Group' group if the age entered in the form is
18 or over.
* 4) It will display the age entered in the form.
* 5) It displays 'Blue Group'.

10
$SERVER[HTTP_USER_AGENT] returns the identifier string of a browser as well as t
he operating system.
Only Internet Explorer always has MSIE in the string. How do we test if a user h
as MSIE or not?

*
* 1) if ($_SERVER[HTTP_USER_AGENT] = "MSIE") { echo 'Why are you using Int
ernet Explorer?'; } else { echo 'Why don't you use Internet Explorer?'; }
* 2) if (ereg($_SERVER[HTTP_USER_AGENT]) = "MSIE") { echo 'Why are you usi
ng Internet Explorer?'; } else { echo 'Why don't you use Internet Explorer?'; }
* 3) if (ereg($_SERVER[HTTP_USER_AGENT]) == "MSIE") { echo 'Why are you us
ing Internet Explorer?'; } else {<br /> echo 'Why don't you use Internet Explore
r?'; }
* 4) if (ereg("MSIE", $_SERVER[HTTP_USER_AGENT])) { echo 'Why are you usin
g Internet Explorer?'; } else { echo 'Why don't you use Internet Explorer?'; }

11
function test($val= hello world )
{
return $val;
}
echo test( Hello Exa );
What is the output of above code?

*
* 1) Parse error
* 2) None of the above
* 3) hello worldHello Exa
* 4) Hello Exa
* 5) hello world

12
How do you print an array?

*
* 1) print($arr);
* 2) echo $arr;
* 3) print_array($arr);
* 4) print_r($arr);
* 5) printf($arr);

13
Why will this code produce an error:
if ($value >= 90) { echo '<p>You attained an A grade</p>' }

*
* 1) The echo statement should be end in a semicolon ( ; ) within the brac
es.
* 2) The echo statement should be enclosed in parentheses.
* 3) The echo statement should be enclosed in inverted commas.
* 4) The echo statement should be enclosed in square brackets.
* 5) None of the above

14
$CFG= hello world ;
Function test()
{
echo $CFG;
}
test();
What will be the output?

*
* 1) Null
* 2) CFG
* 3) hello world
* 4) Parse error

15
What is the purpose of the stripSlashes() function?

*
* 1) It strips all back slashes from text retrieved from a database.
* 2) It strips all Slashes in text submitted to the database.
* 3) It reformats HTML without back slashes.
* 4) It strips slashes in the PHP code.

16
?id=456 is appended to a URL. What code is required to convert this query string
to a regular variable called $id with register global variables off?

*
* 1) $id = $HTTP_POST_VARS['id'];
* 2) $id = query_string(?id=);
* 3) $id = $HTTP_GET_VARS[$id];
* 4) $id = $HTTP_GET_VARS['id'];

17
What is meant my nl2br()?

*
* 1) None of the above
* 2) Add BR tag after each new line.
* 3) BR tag for each newline
* 4) Add newline after each BR tag
* 5) Newline for each br tag.
18
How can we encrypt the password using php ?

*
* 1) md5()
* 2) htmlentities()
* 3) crypt()
* 4) encrypt()
* 5) All of the above

19
What is the result of this code?
<?php
$str = "Exa India Pvt LTD";
$var = strstr($str, 'i');
$ivar = stristr($str, 'i');
echo $var." -- ".$ivar;
?>

*
* 1) India Pvt LTD -- India Pvt LTD
* 2) ia Pvt LTD -- India Pvt LTD
* 3) nd -- a Pvt LTD
* 4) ia Pvt LTD -- ia Pvt LTD
* 5) India Pvt LTD -- ia Pvt LTD

20
How can we get second of the current time using date function?

*
* 1) date(S);
* 2) TimeDate.now.second();
* 3) date("s");
* 4) now.second();
* 5) 1 And 4

test();
What will be the output?

*
* 1) Null
* 2) CFG
* 3) hello world
* 4) Parse error

Das könnte Ihnen auch gefallen