9 quizzes found.

What is the output of the following code?


$string = "111221";

for($i = 0; $i < strlen($string); $i++) {
	$current = $string[$i];
	$count = 1;
	while(isset($string[$i + $count]) && ($string[$i + $count] == $current)) $count++;
	$newstring .= "$count{$current}";
	$i += $count-1;

print $newstring;
  1. 312211
  2. 3312212
  3. 11221221
  4. 221131
  5. 3211122

Choose 1 answers

Setting a cookie on the client in PHP 5 can be best accomplished by:

  1. Use the add_cookie() function
  2. Use the setcookie() function
  3. Use the the apache_send_header() function
  4. Setting a variable in the $_COOKIE superglobal

Choose 1 answers

How does one create a cookie which will exist only until the browser session is terminated?

  1. You cannot create cookies that expire when the browser session is terminated
  2. Setting the expiration time for a cookie to a time in the distant future
  3. Do not provide a cookie expiration time
  4. Enable Cookie Security
  5. Set a cookie without a domain

Choose 1 answers

Setting a HTTP cookie on the client which is not URL-encoded is done how in PHP 5?

  1. Use the setrawcookie() function
  2. Set the cookies.urlencode INI directive to false
  3. Use urldecode() on the return value of setcookie()
  4. Setting the $no_encode parameter of setcookie() to a boolean 'true'
  5. All cookies must be URL encoded

Choose 1 answers

When is it acceptable to store sensitive information in an HTTP cookie?

  1. Only under extremely controlled situations
  2. When the cookie is sent over a secure HTTP request
  3. When it is encrypted
  4. It is always acceptable

Choose 1 answers