每日一题(14)

上一篇 / 下一篇  2007-10-24 21:03:15 / 个人分类:每日一题

5. What will be the net effect of running the following scrīpt on the $s string? (Choose 2)

<?php

$s = '<p>Hello</p>';

$ss = htmlentities ($s);

echo $s;

?>

A. The string will become longer because the angular brackets will be converted to their HTML meta character equivalents

B. The string will remain unchanged

C. If the string is printed to a browser, the angular brackets will be visible

D. If the string is printed to a browser, the angular brackets will not be visible and it will be interpreted as HTML

E. The string is destroyed by the call to htmlentities()

Answer:

This question tests nothing about your knowledge of HTML encoding—and everything about your ability to properly interpret code. The $s function is left unaltered by the call to htmlentities(), which returns the modified string so that it can be assigned to $ss. Therefore, Answers B and D are correct. If you’re wondering whether this is an unfair “trick” question, do keep in mind that, often, the ability to find and resolve bugs revolves around discoveringlittle mistakes like this one.

 

6. If no expiration time is explicitly set for a cookie, what happens to it?

A. It expires right away

B. It never expires

C. It is not set

D. It expires at the end of the user’s browser session

E. It expires only if the scrīpt doesn’t create a server-side session

Answer:

Cookies automatically expire at the end of the user’s browser session if no explicit expiration time is set. Cookies are not necessary to maintain a server-side session, so answer D is correct.

 


TAG: 每日一题

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

数据统计

  • 访问量: 16944
  • 日志数: 87
  • 建立时间: 2007-09-29
  • 更新时间: 2008-04-15

RSS订阅

Open Toolbar