[urgent] need solution of Questions, in context of PHP5 [message #171582] |
Tue, 11 January 2011 11:23 |
Abdul Qadir Memon
Messages: 1 Registered: January 2011
Karma:
|
Junior Member |
|
|
I need the solution of the following questions in Context of PHP5.
For the following code: <?php
Function Expenses()
{
function Salary()
{
}
function loan()
{
function Balance()
{
}
}
}
?>
a. Expenses();Salary();Loan();Balance();
b. Salary();Expenses();Loan();Balance();
c. Expenses();Salary();Balance();Loan();
d. Balance();Loan();Salary();Expenses();
What will be the output of following code?
$arr = "a";
$arr[0]="b";
echo $arr;
echo $arr[0];
a. ab
b. $arr is undefined
c. bb
d. Parse error
Which of the following regular expressions can be used to check the
validity of an e-mail address?
A) ^[^@ ]+@[^@]+\.[^@ ]+$
B) ^[^@ ]+@[^@]+.[^@ ]+$
C) $[^@ ]+@[^@ ]+\.[^@ ]+^
D) $[^@ ]+@[^@ ]+.[^@ ]+^
Which of the following type cast in not correct?
$fig=23;
$varbl=(real)$fig;
$varb2=(double)$fig;
$varb3=(decimal)$fig;
$varb4=(bool)$fig;
?>
a. real
b. double
c. decimal
d. Boolean
which of the following is not a correct way of starting a session?
a)session.auto_start
b)session_register()
c)session_initiate()
d)session_start()
the inbuilt function to get the number of parameter passed in:
a)arg_num()
b)func_args_count()
c) func_num_args()
d)none of the above
which of the following is/are invalid data types in PHP?
A) string
b) integer
c)float
d)char
e)array
f)object
you have a 2D array in PHP
$array=array(array(141,151,161),2,3,array(101,202,303));
you want to display all the values in the array. The correct way is
a. function DisplayArray($array){
foreach($array as $value){
if(array_valid($value)){
DisplayArray($value);
}else{
echo $value. “<br>”;
}
}
}
DisplayArray($array);
b. function DisplayArray($array){
for($array as $value){
if(valid_array($value)){
DisplayArray($value);
}else{
echo $value. “<br>”;
}
}
}
DisplayArray($array);
c. function DisplayArray($array){
for($array as $value){
if(is_array($value)){
DisplayArray($value);
}else{
echo $value. “<br>”;
}
}
}
DisplayArray($array);
d. function DisplayArray($array){
foreach($array as $value){
if(is_array($value)){
DisplayArray($value);
}else{
echo $value. “<br>”;
}
}
}
DisplayArray($array);
What will be the result of the following operations?
Print 4<<5
A 3
B 128
C 120
D 6
Which of the following is not true regarding XForms?
a. PHP provides support for XForm
b. It can be used on PDF documents
c. The data is sent in XML format
d. The action and method parameters are defined in the body
What do u infer from the following code?
<?PHP
$str=’Dear Customer,\nThanks for your query.We will reply very soon?
\nCustomer Service Agent’;
print $str;
?>
a) Only first \n character will be recognized and new line will be
inserted.
b) Last \n will not be recognized and only first two parts will come
in new lines.
c) All the \n will work and text will be printed on respective new
lines.
d) All will be printed on one line irrespective of the \n.
Which of the following statements is true with regard to comparisons
in PHP5?
a. With "= =" operator, two object instances are equal if they have
the same attributes and values, and are instances of a different
class.
b. With "==" operator two object instances are equal if they have the
same attributes and values, and are instances of the same class.
c. With (===) operator, object variables are identical if and only if
they refer to the same instance of the same class.
d. With (===) operator, object variables are identical if and only if
they refer to the different instance of the same class.
Late PHP versions support remote file accessing for the functions:
a. include()
b. include_once()
c. require_once()
d. Both a and b
e. Both b and c
which of the following variables names are invalid
a) $var_1
b) $var1
c) $var-1
d) $var/1
e) $v1
consider the following two statements
I- while($expr) statement
II- while($exp): statement … endwhile;
which of the following are true in context of the given statements?
a) I is correct and II is wrong
b) I is wrong and II is correct
c) Both I & II are wrong
d) Both I & II are correct
How would you store order number (34) in an Order Cookie?
a)setcookie(“OrderCookie”,34);
b)makeCookie(“OrderCookie”,34);
c)Cookie(“OrderCookie”,34);
d)OrderCookie(34);
which of the following functions output text?
A) echo()
B) print()
C) println()
D) display()
which fo the following is not a file related function in PHP?
a) fclose
b) fopen
c) fwrite
d) fgets
e) fappend
what will be the output of the following code?
<?PHP
if(-1){
echo(“true”);
}else{
echo(“false”);
}
a) true
b) false
what will be the output of the following script?
$count=50;
function Argument()
{
$count++;
echo $count;
}
Argument();
?>
a. It will print 50
b. It will print 51
c. It will print 52
d. It will print 1
which of the following is a ternary operator?
a) &
b) =
c) :?
d) ?:
e) +=
f) &&
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) include()
b) require()
c) nowarn()
d) getfile(false)
which of the following is not a valid PHP parser tag?
a) script
b) ?p
c) %
d) ?php
which of the following does not represent logical AND operator in PHP?
a) &
b) &&
c) And
d) AND
Which of the following are PHP file upload related functions?
a) upload_file()
b) is_uploaded_file()
c) move_uploaded_file()
d) none of the above
which of the following printing contruct/function accepts multiple
parameters?
A) echo
B) print
C) printf
D) all of the above
which of the following are ‘magic contants’?
a) __LINE__
b) __FILE__
c) __PRETTY_FUNCTION__
d) __CLASS__
e) __METHOD__
which of the following variable declarations within a class is invalid
in PHP5?
a. private $type = 'moderate';
b. var $term =3;
c. public $amnt = '500';
d. protected $name = 'Quantas Private Limited';
the classes are defined as follows:
Abstract class BaseCls(
Protected abstract function getName();
}
Class childCls extends BaseCls{
}
Which of the following implementations of getName() in invalid in
childCls?
a. Protected function getName(){}
b. Function getName(){}
c. Private function getName(){}
d. Public function getName(){}
What will be the output of following code?
$var1="a";
$$var1="b";
echo "$var1 $a";
a. a b
b. $var1 $a
c. Error: $a is undefined
d. Error: Parse error in line 2 ($$var1 = "b")
Does PHP 5 support exceptions?
a) yes
b) no
which composition data types are supported by php?
a) array
b) enumeration
c) list
d) Object
e) Integer
Which of the following is the correct way of specifying default value?
a. function GetDiscount($Type = "Special") { . . . }
b. function GetDiscount(Type := "Special") { . . . }
c. function GetDiscount($Type := "Special") { . . . }
d. function GetDiscount($Type : "Special") { . . . }
The Manager and Office classes are as follows:
class Manager{
function printName() {
echo "Manager";
}
}
class Office{
function getManager() {
return new Manager();
}
}
$ofc = new Office();
???
?>
Which of the following should replace '???' to obtain the value of
printName() function?
a. $ofc->getManager()->printName();
b. new Office()->getManager()->printName();
c. $ofc->getManager->printName;
d. Office::getManager()::printName();
which of the following operator has the hieghest precedence?
a) &
b) %
c) +
d) &&
e) +=
what will be the output of the following code?
$a=10;
if($a > 5 OR < 15)
echo “true”;
else
echo “false”;
a) true
b) false
c) no output
d) parse error
Paamayim nekudotayim operator allows access only to the static members
of a class?
a. True
b. False
which of the following variables is not related to file uploads?
a) max_file_size
b) max_execution_time
c) post_max_size
d) input_time_max
which of the following is not a predefined constant?
a) true
b) false
c) null
d) __file__
e) constant
Following is a php code block:
$m=9;
$n=99;
$z=8;
$z=$n++/$m++ + --$z;
echo $z;
what will be the output?
a. 16
b. 18
c. 19
d. 20
e. 17
|
|
|