Question

:
You need to count the number of parameters given in the URL by a POST operation. The correct way Is:

a. b. c. d.

count($POST_VARS); count($POST_VARS_PARAM); count($_POST); count($HTTP_POST_PARAM);

Question:
What is the output of the following code? <?php $a = 3; $b = 2; echo (int)$a / (int)$b ?>

a. b. c. d. e.

1 1.5 2 3 Error

Question:
What is the output of the following code? <?php function vec_add (&$a, $b) { $a['x'] += $b['x']; $a['y'] += $b['y']; $a['z'] += $b['z']; } $a = array (x => 3, y => 2, z => 5); $b = array (x => 9, y => 3, z => -7); vec_add (&$a, $b); print_r ($a); ?>

a.

Array (

34). e. 0 1 2 3 4 5 0 1 3 4 2 0 1 2 4 None of the above e.[x] => 9 [y] => 3 [z] => -7 b. Question: How would you store order number (34) in an 'OrderCookie'? a. $i < 5. makeCookie("OrderCookie". b. ++$i) { if ($i == 2) continue print "$i\n". Question: What will be the ouput of the following code? <?php for ($i = 0. . ) Array ( [x] => 3 [y] => 2 [z] => 5 ) Array ( [x] => 12 [y] => 5 [z] => -2 ) Error None of the above c. } ?> a. d.34). setcookie("OrderCookie". c. d. b.

b.'val'.3). These are not closed even after the execution of the script These are mainly used to increase the efficiency of the system These can't be converted to non-persistent connections These are preferably not used in the scripts involving transactions Question: Which of the following built-in functions assist in checking if the actually function exists or not? a. static $varb = sqrt(81). static $varb = new Object. local global static . c. d. b.c. Cookie("OrderCookie". static $varb = 1+(2*90). d. OrderCookie(34). d. b. exists function_exists fexists isFunction Question: Which of the following is a correct declaration? a. Question: Which of the following is not true for a persistent connection? a. d. Question: The value of a local variable of a function has to be retained over multiple calls to that function. c. c. c. How should that variable be declared? a. b.34). static $varb = array(1.

a. d. return $Rent.) Question: For passing a variable by reference: a. d. c.6 Error: You cannot add integers through the concatenation operator(. function Expenses($Other) { $Rent = 250 + $Other. echo $Rent. Append a "&" prefix Append a "#" prefix Append a "&" suffix Append a "#" suffix Question: What will be the output of the following code? $Rent = 250. 6. 300 250 200 Program will not compile Question: The following php variables are declared: <?php $company = 'ABS Ltd'. a. 12 . 6 126 12. b. . } Expenses(50). d.d. b. b. c. c. None of the above Question: What will be the output of the following code? echo 12 .

?> Which of the following is not a correct way of printing 'ABS Ltd. echo "$company ${$company}". True False Question: You have designed a user login form as follows: <form action="Validate. e.php' webpage? a. echo "$company ${'ABS Ltd'}". b. c. d.$$company = '. $var= $_POST['username'].php" method="post"> User Name: <input type="text" name="username" /><br /> Password: <input type="password" name="password" /><br /> <input type="submit" name="login" value="Login" /> </form> How can you access the username entered by the user in the 'Validate. b. Question: Which of the following are 'magic constants'? a. b. d. Sydney?' a. echo "$company $$company". b. echo "$company {$$company}". Sydney'. c. $var= $_REQUEST['username']. . __LINE__ __FILE__ __PRETTY_FUNCTION__ __CLASS__ __METHOD__ Question: State whether True or False Paamayim Nekudotayim operator allows access only to the static members of a class? a.

script ?p % ?php Question: Which of the following statement is not correct for PHP? . e. a. d. none of the above Question: Which of the following is not a valid PHP parser tag? a. d. 100 50 98 Error message None of the above Question: Which one is correct? a. All of the above Question: What will be the output of the following code? function fn(&$var) { $var = $var . return $var."a string here"). b. 'p_').($var/10 * 5).$fp). $s=fwrite("a string here"). c. $s=fwrite($fp. d. b. $var= $p_username. b. c. } echo fn(100). import_request_variables('p'.c. d. c. $s=fwrite("a string here".

b. html tags or scripts It can run on windows and Linux systems only It is compatible with most of the common servers used today Question: Which of the following text manipulation functions is not supported by PHP? a. b. d. e. session(). d. c. b. Question: Which of the following is not supported in PHP5? a. begin_sesion().a. c. Type Hinting Reflection Magic Methods Multiple Inheritance Object Cloning Question: Which of the following variable is supported by 'str_replace()' function? . strtoupper() ucfirst() strtolower() strsplit() Question: How would you start a session? a. d. session_start(). c. c. d. b. It is a server side scripting language A php file may contain text. session(start).

It will print 50 It will print 51 It will print 52 It will print 1 Question: Which of the following functions output text? a. c. c. A class can implement multiple interfaces An abstract class cannot implement multiple interfaces An interface can extend multiple interfaces Methods with same name. d. arguments. and sequence can exist in the different interfaces implemented by a class Question: What will be the output of the following script? <?php $count=50. echo() print() println() . } Argument(). c. d. echo $count. c. b. Integer String Boolean Array Question: Which of the following statements is incorrect with regard to interfaces? a. b. d. ?> a. function Argument() { $count++. b. b.a.

Off On Question: What is the result of the following expression? 5+2 * 4+6 a. 70 19 34 21 Question: Which composite data types are supported by php? . b. d. b. b. c. d. c. c.d. //PHP Comment /*PHP Comment*/ #PHP Comment /#PHP Comment Question: The default value of register_globals in PHP is: a. b. echo is a construct and print is a function echo is a function and print is a construct Both are functions Both are constructs Question: Which of the following is a not a correct way of commenting in php? a. d. display() Question: Which of the following is correct with regard to echo and print ? a.

b. and are instances of a different class. two object instances are equal if they have the same attributes and values. b. Array Enumeration List Object Integer Question: Which of the following statements is true with regard to comparisons in PHP5? a. d. < Question: Which of the following is not a file related function in PHP? a. object variables are identical if and only if they refer to the same instance of the same class. With (===) operator. e. e. and are instances of the same class. c. b. d. d. With (===) operator. echo() isset() print() All of the above Question: What will be the output of following code? . b. c. With "= =" operator two object instances are equal if they have the same attributes and values. With "= =" operator. c. d. c. object variables are identical if and only if they refer to the different instance of the same class. fclose fopen fwrite fgets fappend Question: Variable functions in PHP don't work directly with: a.a.

md5() sha1() crc32() All return same length hash Question: Which of the following characters are taken care of by htmlspecialchars? a. c. Value of a = 10 Value of a = $a Undefined Syntax Error Question: For the following code: <?php echo 30 * 5.7 30 * 5. a. < > single quote double quote . echo "Value of a = $a".7 Question: Which of the following crypto in PHP returns longest hash value? a. c. ?> the output will be: a. 171 Expressions can't be used with echo statements 150. c. d. d. d. c. d. b.7. b. b.$a = 10. b.

} class ChildCls extends BaseCls{ } Which of the following implementations of getName() is invalid in ChildCls? a. f. d. c. Checkbox Select File All of the above Question: Which of the following is used to maintain the value of a variable over different pages? . & All of the above Question: The classes are defined as follows: abstract class BaseCls{ protected abstract function getName(). b. protected function getName(){} function getName(){} private function getName(){} public function getName(){} Question: In your PHP application you need to open a file.e. d. include() require() nowarn() getFile(false) Question: Multiple select/load is possible with: a. You want the application to issue a warning and continue execution. d. in case the file is not found. b. c. b. The ideal function to be used is: a. c.

c. $cl->clsName(). and 10 should be left as it is Question: Which of the following is not true regarding XForms? . Which of the following makes this happen? a. c.a. } } $cl = new Insurance(). Which of the following Lines should be commented to print the class name without errors? a. b. d. Add a member variable that gets incremented in the default constructor and decremented in the destructor Add a local variable that gets incremented in each constructor and decremented in the destructor Add a static member variable that gets incremented in each constructor and decremented in the destructor This cannot be accomplished since the creation of objects is being done dynamically via "new. Insurance::clsName(). b. d. c. d.9." Question: Consider the following class: 1 2 3 4 5 6 7 8 9 10 class Insurance { function clsName() { echo get_class($this). b. static global session_register() None of the above Question: You need to keep an eye on the existing number of objects of a given class without introducing a non-class member variable. Line 8 and 9 Line 10 Line 9 and 10 All the three lines 8.

. public $amnt = '500'. b. protected $name = 'Quantas Private Limited'. d. var $term =3. c. aborted normal open timeout Question: How can you hide the fact that web pages are written in PHP? a. c. By using AddType application/x-httpd-php asp Specify all file names without any dot and extension By using . b. d. b. private $type = 'moderate'. Question: Given below is a small php script: <?php class person{ function getSal() { .htaccess directive in Apache All of the above Question: Which of the following variable declarations within a class is invalid in PHP5? a. d. . c. PHP provides support for XForm It can be used on PDF documents The data is sent in XML format The action and method parameters are defined in the body Question: Which of the following is not a valid PHP connection status? a. c. d. b..a.

parent::getSal. c. b. Question: What will be the result of the following expression: 6+4 * 9-3 a. b. d.. b. person::getSal. person::getSal(). c. c. parent::getSal(). $var_1 $var1 $var-1 $var/1 $v1 Question: What will be the ouput of the following code? <?php . e. d. 60 87 39 30 Question: Which of the following variable names are invalid? a. } } class emp extends person{ function getSal() { ??? } } ?> The getSal() of emp has to behave exactly as getSal()of person.. d. Which of the following lines of code would you use to replace the '???' a..

FALSE 0 "0" "FALSE" 1 . ?> a. 7 1507 150. c. c.if (-1) print "true". True False Question: Which of the following statements is not true with regard to abstract classes in php5? a. d. else print "false". d. b. 7 a. b.7 you can't concatenate integers Question: Which of the following are not considered as boolean False? a. d. Abstract classes are introduced in PHP5 A class with a single abstract method must be declared abstract Abstract class can contain non abstract methods Abstract method must have method definition and can have optional empty braces following it Question: What will be the output of the following code? echo 30 * 5 . 150 . b. b. c. e.

d. 1 1. NULL Question: Which of the following Command Line Interface constant is not defined in the CLI SAPI? a. d. c. e. Text Line1Text Line2 Text Line1 Text Line2 'Text Line1' 'Text Line2' . $b = 2. c.5 2 3 Error Question: With reference to the following php script: <?php print 'Text Line1' print 'Text Line2' ?> What will be the output on running the script? a. STDIN STDOUT STDPRT STDERR Question: What is the output of the following code? <?php $a = 3. d. c. b. b. echo (int)$a / (int)$b ?> a. b.f.

d. ab $var1 $a Error: $a is undefined Error: Parse error in line 2 ($$var1 = "b") . echo "$var1 $a". \023 2.e. 1 is octal 2 is hexadecimal 2 is octal 1 is hexadecimal Question: What will be the output of following code? $var1="a". b. c. d. \x23 Choose the correct options: a. Error message will be printed Question: We have two variable definitions: 1. a. c. b. $$var1="b".

Sign up to vote on this title
UsefulNot useful