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 ( [x] => 9 [y] => 3

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

3). d. . How should that variable be declared? a. static $varb = array(1. static $varb = 1+(2*90). OrderCookie(34). d. c. d. Question: Which of the following is not true for a persistent connection? a. exists function_exists fexists isFunction Question: Which of the following is a correct declaration? a. static $varb = sqrt(81). local global static None of the above Question: What will be the output of the following code? echo 12 . b. d. Cookie("OrderCookie". 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.c. static $varb = new Object. 6. b. c. b. d.'val'. c.34). b. Question: The value of a local variable of a function has to be retained over multiple calls to that function. c.

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

. $var= $_POST['username']. $var= $_REQUEST['username']. All of the above Question: What will be the output of the following code? function fn(&$var) { $var = $var . d.d. b.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. import_request_variables('p'. echo "$company {$$company}". 'p_'). c. e. c. Question: Which of the following are 'magic constants'? a.php' webpage? a. b. True False Question: You have designed a user login form as follows: <form action="Validate. d. b. $var= $p_username. } echo fn(100).($var/10 * 5). return $var. __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.

b. e. d. c. c. d. d. script ?p % ?php Question: Which of the following statement is not correct for PHP? a.$fp). d. 100 50 98 Error message None of the above Question: Which one is correct? a. 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. strtoupper() ucfirst() strtolower() strsplit() . $s=fwrite($fp. b.a. b. $s=fwrite("a string here". d."a string here"). b. c. none of the above Question: Which of the following is not a valid PHP parser tag? a. $s=fwrite("a string here"). c. It is a server side scripting language A php file may contain text. c. b.

session_start(). c. 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. d. A class can implement multiple interfaces An abstract class cannot implement multiple interfaces An interface can extend multiple interfaces Methods with same name. . b. Type Hinting Reflection Magic Methods Multiple Inheritance Object Cloning Question: Which of the following variable is supported by 'str_replace()' function? a. function Argument() { $count++. c. arguments. Question: Which of the following is not supported in PHP5? a. Integer String Boolean Array Question: Which of the following statements is incorrect with regard to interfaces? a. d. e. c. b. session(start). d. session().Question: How would you start a session? a. d. b. begin_sesion(). c. b.

b. 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. ?> a. echo() print() println() display() Question: Which of the following is correct with regard to echo and print ? a. b. d. } Argument(). d. d. c. c. b. Off On . d. c. //PHP Comment /*PHP Comment*/ #PHP Comment /#PHP Comment Question: The default value of register_globals in PHP is: a. c. 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. b.echo $count.

and are instances of a different class. < Question: Which of the following is not a file related function in PHP? a. 70 19 34 21 Question: Which composite data types are supported by php? a. b. Array Enumeration List Object Integer Question: Which of the following statements is true with regard to comparisons in PHP5? a. With (===) operator. object variables are identical if and only if they refer to the different instance of the same class. b. c. d. two object instances are equal if they have the same attributes and values. fclose fopen fwrite fgets fappend Question: . c. and are instances of the same class. d. b. e. c. With "= =" operator two object instances are equal if they have the same attributes and values. c. With (===) operator. object variables are identical if and only if they refer to the same instance of the same class. With "= =" operator. d. d. e.Question: What is the result of the following expression? 5+2 * 4+6 a. b.

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

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

b. Insurance::clsName(). Which of the following makes this happen? a. d. c. and 10 should be left as it is Question: Which of the following is not true regarding XForms? a.9. c.Question: Which of the following is used to maintain the value of a variable over different pages? a. Which of the following Lines should be commented to print the class name without errors? a. } } $cl = new Insurance(). b. PHP provides support for XForm . b." Question: Consider the following class: 1 2 3 4 5 6 7 8 9 10 class Insurance { function clsName() { echo get_class($this). d. Line 8 and 9 Line 10 Line 9 and 10 All the three lines 8. 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. $cl->clsName(). 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. d. c.

d. d. d. . c. public $amnt = '500'. private $type = 'moderate'. c.. protected $name = 'Quantas Private Limited'. c. b. 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.htaccess directive in Apache All of the above Question: Which of the following variable declarations within a class is invalid in PHP5? a.. Question: Given below is a small php script: <?php class person{ function getSal() { . aborted normal open timeout Question: How can you hide the fact that web pages are written in PHP? a. } } class emp extends person{ function getSal() { ??? } } . var $term =3.. By using AddType application/x-httpd-php asp Specify all file names without any dot and extension By using .b. b. b.. c. d.

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

b. c.Which of the following statements is not true with regard to abstract classes in php5? a. 7 1507 150. e. 150 . 7 a. c. d. b. 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 . d. c.7 you can't concatenate integers Question: Which of the following are not considered as boolean False? a. b. b. c. d. STDIN STDOUT STDPRT STDERR Question: What is the output of the following code? <?php $a = 3. . FALSE 0 "0" "FALSE" 1 NULL Question: Which of the following Command Line Interface constant is not defined in the CLI SAPI? a. d. f.

b. $$var1="b". echo "$var1 $a".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. c. \x23 Choose the correct options: a. b. d. Text Line1Text Line2 Text Line1 Text Line2 'Text Line1' 'Text Line2' Error message will be printed Question: We have two variable definitions: 1. 1 1. b. c. echo (int)$a / (int)$b ?> a. c. d. e.$b = 2. . 1 is octal 2 is hexadecimal 2 is octal 1 is hexadecimal Question: What will be the output of following code? $var1="a". e. d. \023 2.

ab $var1 $a Error: $a is undefined Error: Parse error in line 2 ($$var1 = "b") . d. c.a. b.

Sign up to vote on this title
UsefulNot useful