Sunteți pe pagina 1din 18

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 [z] => -7 b. ) Array ( [x] => 3 [y] => 2 [z] => 5 ) Array ( [x] => 12 [y] => 5 [z] => -2 ) Error None of the above

c.

d. e.

Question:
What will be the ouput of the following code? <?php for ($i = 0; $i < 5; ++$i) { if ($i == 2) continue print "$i\n"; } ?>

a.

b.

c. d.

0 1 2 3 4 5 0 1 3 4 2 0 1 2 4 None of the above

e.

Question:
How would you store order number (34) in an 'OrderCookie'?

a. b.

setcookie("OrderCookie",34); makeCookie("OrderCookie",34);

c. d.

Cookie("OrderCookie",34); OrderCookie(34);

Question:
Which of the following is not true for a persistent connection?

a. b. c. d.

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. b. c. d.

exists function_exists fexists isFunction

Question:
Which of the following is a correct declaration?

a. b. c. d.

static $varb = array(1,'val',3); static $varb = 1+(2*90); static $varb = sqrt(81); static $varb = new Object;

Question:
The value of a local variable of a function has to be retained over multiple calls to that function. How should that variable be declared?

a. b. c.

local global static

d.

None of the above

Question:
What will be the output of the following code? echo 12 . 6;

a. b. c. d.

12 . 6 126 12.6 Error: You cannot add integers through the concatenation operator(.)

Question:
For passing a variable by reference:

a. b. c. d.

Append a "&" prefix Append a "#" prefix Append a "&" suffix Append a "#" suffix

Question:
What will be the output of the following code? $Rent = 250; function Expenses($Other) { $Rent = 250 + $Other; return $Rent; } Expenses(50); echo $Rent;

a. b. c. d.

300 250 200 Program will not compile

Question:
The following php variables are declared: <?php $company = 'ABS Ltd';

$$company = ', Sydney'; ?> Which of the following is not a correct way of printing 'ABS Ltd, Sydney?'

a. b. c. d.

echo "$company $$company"; echo "$company ${$company}"; echo "$company ${'ABS Ltd'}"; echo "$company {$$company}";

Question:
Which of the following are 'magic constants'?

a. b. c. d. e.

__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.

True False

Question:
You have designed a user login form as follows: <form action="Validate.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.php' webpage?

a. b.

$var= $_POST['username']; $var= $_REQUEST['username'];

c. d.

import_request_variables('p', 'p_'); $var= $p_username; All of the above

Question:
What will be the output of the following code? function fn(&$var) { $var = $var - ($var/10 * 5); return $var; } echo fn(100);

a. b. c. d. e.

100 50 98 Error message None of the above

Question:
Which one is correct?

a. b. c. d.

$s=fwrite("a string here"); $s=fwrite($fp,"a string here"); $s=fwrite("a string here",$fp); none of the above

Question:
Which of the following is not a valid PHP parser tag?

a. b. c. d.

script ?p % ?php

Question:
Which of the following statement is not correct for PHP?

a. b. c. d.

It is a server side scripting language A php file may contain text, 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. c. d.

strtoupper() ucfirst() strtolower() strsplit()

Question:
How would you start a session?

a. b. c. d.

session(start); session(); session_start(); begin_sesion();

Question:
Which of the following is not supported in PHP5?

a. b. c. d. e.

Type Hinting Reflection Magic Methods Multiple Inheritance Object Cloning

Question:
Which of the following variable is supported by 'str_replace()' function?

a. b. c. d.

Integer String Boolean Array

Question:
Which of the following statements is incorrect with regard to interfaces?

a. b. c. d.

A class can implement multiple interfaces An abstract class cannot implement multiple interfaces An interface can extend multiple interfaces Methods with same name, 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; function Argument() { $count++; echo $count; } Argument(); ?>

a. b. c. d.

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. b. c.

echo() print() println()

d.

display()

Question:
Which of the following is correct with regard to echo and print ?

a. b. c. d.

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. c. d.

//PHP Comment /*PHP Comment*/ #PHP Comment /#PHP Comment

Question:
The default value of register_globals in PHP is:

a. b.

Off On

Question:
What is the result of the following expression? 5+2 * 4+6

a. b. c. d.

70 19 34 21

Question:
Which composite data types are supported by php?

a. b. c. d. e.

Array Enumeration List Object Integer

Question:
Which of the following statements is true with regard to comparisons in PHP5?

a. b. c. d.

With "= =" operator, two object instances are equal if they have the same attributes and values, and are instances of a different class. With "= =" operator two object instances are equal if they have the same attributes and values, and are instances of the same class. With (===) operator, object variables are identical if and only if they refer to the same instance of the same class. With (===) operator, object variables are identical if and only if they refer to the different instance of the same class. <

Question:
Which of the following is not a file related function in PHP?

a. b. c. d. e.

fclose fopen fwrite fgets fappend

Question:
Variable functions in PHP don't work directly with:

a. b. c. d.

echo() isset() print() All of the above

Question:
What will be the output of following code?

$a = 10; echo "Value of a = $a";

a. b. c. d.

Value of a = 10 Value of a = $a Undefined Syntax Error

Question:
For the following code: <?php echo 30 * 5.7; ?> the output will be:

a. b. c. d.

171 Expressions can't be used with echo statements 150.7 30 * 5.7

Question:
Which of the following crypto in PHP returns longest hash value?

a. b. c. d.

md5() sha1() crc32() All return same length hash

Question:
Which of the following characters are taken care of by htmlspecialchars?

a. b. c. d.

< > single quote double quote

e. f.

& All of the above

Question:
The classes are defined as follows: abstract class BaseCls{ protected abstract function getName(); } class ChildCls extends BaseCls{ } Which of the following implementations of getName() is invalid in ChildCls?

a. b. c. d.

protected function getName(){} function getName(){} private function getName(){} public function getName(){}

Question:
In your PHP application you need to open a file. You want the application to issue a warning and continue execution, in case the file is not found. The ideal function to be used is:

a. b. c. d.

include() require() nowarn() getFile(false)

Question:
Multiple select/load is possible with:

a. b. c. d.

Checkbox Select File All of the above

Question:
Which of the following is used to maintain the value of a variable over different pages?

a. b. c. d.

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. Which of the following makes this happen?

a. b. c. 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."

Question:
Consider the following class: 1 2 3 4 5 6 7 8 9 10 class Insurance { function clsName() { echo get_class($this); } } $cl = new Insurance(); $cl->clsName(); Insurance::clsName();

Which of the following Lines should be commented to print the class name without errors?

a. b. c. d.

Line 8 and 9 Line 10 Line 9 and 10 All the three lines 8,9, and 10 should be left as it is

Question:
Which of the following is not true regarding XForms?

a. b. c. d.

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. b. c. d.

aborted normal open timeout

Question:
How can you hide the fact that web pages are written in PHP?

a. b. c. d.

By using AddType application/x-httpd-php asp Specify all file names without any dot and extension By using .htaccess directive in Apache All of the above

Question:
Which of the following variable declarations within a class is invalid in PHP5?

a. b. c. d.

private $type = 'moderate'; var $term =3; public $amnt = '500'; protected $name = 'Quantas Private Limited';

Question:
Given below is a small php script: <?php class person{ function getSal() { ...

... } } class emp extends person{ function getSal() { ??? } } ?> The getSal() of emp has to behave exactly as getSal()of person. Which of the following lines of code would you use to replace the '???'

a. b. c. d.

parent::getSal(); person::getSal(); parent::getSal; person::getSal;

Question:
What will be the result of the following expression: 6+4 * 9-3

a. b. c. d.

60 87 39 30

Question:
Which of the following variable names are invalid?

a. b. c. d. e.

$var_1 $var1 $var-1 $var/1 $v1

Question:
What will be the ouput of the following code? <?php

if (-1) print "true"; else print "false"; ?>

a. b.

True False

Question:
Which of the following statements is not true with regard to abstract classes in php5?

a. b. c. 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 . 7

a. b. c. d.

150 . 7 1507 150.7 you can't concatenate integers

Question:
Which of the following are not considered as boolean False?

a. b. c. d. e.

FALSE 0 "0" "FALSE" 1

f.

NULL

Question:
Which of the following Command Line Interface constant is not defined in the CLI SAPI?

a. b. c. d.

STDIN STDOUT STDPRT STDERR

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:
With reference to the following php script: <?php print 'Text Line1' print 'Text Line2' ?> What will be the output on running the script?

a. b. c. d.

Text Line1Text Line2 Text Line1 Text Line2 'Text Line1' 'Text Line2'

e.

Error message will be printed

Question:
We have two variable definitions: 1. \023 2. \x23 Choose the correct options:

a. b. c. d.

1 is octal 2 is hexadecimal 2 is octal 1 is hexadecimal

Question:
What will be the output of following code? $var1="a"; $$var1="b"; echo "$var1 $a";

a. b. c. d.

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

S-ar putea să vă placă și