Home
Current Affairs January 2024

What is the correct answer?

4

Which of following variables can be assigned a value to it?
i) $3hello
ii) $_hello
iii) $this
iv) $This


A.

All of the mentioned


B.

Only ii)


C.

ii), iii) and iv)


D.

ii) and iv)


Correct Answer :

D.

ii) and iv)



A variable can’t start with a number. Also $this is a special variable that can’t be assigned, but $This can be assigned


Related Questions

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  $color1 = red;
$color2 = 1;
echo $color1 + $color2;
?>

A. red1

B. red 1

C. 0

D. 1

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  $color = red;
$color = green;
echo $color;
?>

A. red

B. green

C. red green

D. error

What is the correct answer?

4

Which function displays the web pages most recent modification date?

A.

lastmod()

B.

getlastmod()

C.

last_mod()

D.

get_last_mod()

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  define(NEW_GOOD_NAME_CONSTANT, I have a value);
define(OLD_BAD_NAME_CONSTANT, NEW_GOOD_NAME_CONSTANT);
�echo NEW_GOOD_NAME_CONSTANT;
echo OLD_BAD_NAME_CONSTANT;
?>

A. I have a value

B. I have a valueI have a value

C. ERROR

D. I have a valueNEW_GOO_NAME_CONSTANTS

What is the correct answer?

4

The date() function returns ___ representation of the current date and/or time.

A. Integer

B. String

C. Boolean

D. Float

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  $color = red;
echo $color . red ;
?>

A. red red

B. red

C. error

D. nothing

What is the correct answer?

4

If the format is F then which one of the following will be returned?

A. Complete text representation of month

B. Day of month, with leading zero

C. Daylight saving time

D. Day of month, without zeros

What is the correct answer?

4

PHP files have a default file extension of..


A.

.html


B.

.xml


C.

.php


D.

.ph


E.

.asp


F.

.jsp


What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  /*echo Hello world;
*/ ?>

A. Hello world

B. Nothing

C. Error

D.

/* Hello world */

What is the correct answer?

4

What will be the output of the following code?



<?php
$foo = 'Bob';
$bar = &$foo;
$bar = "My name is $bar";
echo $bar;
echo $foo;
?>

A.

Error


B.

My name is BobBob


C.

My name is BobMy name is Bob


D.

My name is Bob Bob


What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  define(__LINE__, PHP is a scripting language);
echo __LINE__;
?>

A. PHP is a scripting language

B. __LINE__

C. 2

D. ERROR

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  $i = 0;
while(++$i || --$i){ print $i;
} ?>

A. 1234567891011121314….infinitely

B. 01234567891011121314…infinitely

C. 1

D. 0

What is the correct answer?

4

What will be the output of the following PHP code?
 <?php  $cars = array(Volvo, BMW, Toyota, Honda, Mercedes, Opel);
print_r(array_chunk($cars, 2));
?>

A.

Array ( [0] => Array ( [1] => Volvo [2] => BMW ) [1] => Array ( [1] => Toyota [2] => Honda ) [2] => Array ( [1] => Mercedes [2] => Opel ) )

B.

Array ( [1] => Array ( [1] => Volvo [2] => BMW ) [2] => Array ( [1] => Toyota [2] => Honda ) [3] => Array ( [1] => Mercedes [2] => Opel ) )

C.

Array ( [0] => Array ( [0] => Volvo [1] => Volvo ) [1] => Array ( [0] => BMW [1] => BMW ) [2] => Array ( [0] => Toyota [1] => Toyota ) )

D.

Array ( [0] => Array ( [0] => Volvo [1] => BMW ) [1] => Array ( [0] => Toyota [1] => Honda ) [2] => Array ( [0] => Mercedes [1] => Opel ) )

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  define(GREETING, PHP is a scripting language);
echo $GREETING;
?>

A. $GREETING

B. no output

C. PHP is a scripting language

D. GREETING

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  $i = 2;
while (++$i){ while ($i --> 0) print $i;
} ?>

A. 210

B. 10

C. no output

D. infinite loop

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  class Constants{    define('MIN_VALUE', '0.0');
define('MAX_VALUE', '1.0');
public static function getMinValue() { return self::MIN_VALUE;
} public static function getMaxValue() { return self::MAX_VALUE;
}}echo Constants::getMinValue();
echo Constants::getMaxValue();
?>

A. 0.01.0

B. 01

C. No output

D. ERROR

What is the correct answer?

4

What will be the output of the following PHP code? If say date is 22/06/2013.
     <?php      printf( date(t) )     ?> 

A. 30

B. 22

C. JUNE

D. 2013

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  class myObject { }define('myObject::CONSTANT', 'test');
echo myObject::CONSTANT;
?>

A. test

B. error

C. myObject::CONSTANT

D. no output

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  $i = 5;
while (--$i > 0){ $i++;
print $i;
print hello;
} ?>

A. 4hello4hello4hello4hello4hello…..infinite

B. 5hello5hello5hello5hello5hello…..infinite

C. no output

D. error

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  $i = 5;
while (--$i > 0 && ++$i){ print $i;
} ?>

A. 5

B. 555555555…infinitely

C. 54321

D. error

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  $i = ;
while ($i = 10){ print hi;
}print hello;
?>

A. hello

B. infinite loop

C. hihello

D. error

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  $i = 0;
while ((--$i > ++$i) - 1){ print $i;
} ?>

A. 00000000000000000000….infinitely

B. -1-1-1-1-1-1-1-1-1-1…infinitely

C. no output

D. error

What is the correct answer?

4

What will be the output of the following PHP code?
 <?php  $a = array(red, green, blue);
array_pop($a);
print_r($a);
?>

A.

Array ( [0] => red [1] => green )

B.

Array ( [0] => green [1] => blue )

C.

Array ( [0] => red [1] => blue )

D.

Array ( [0] => blue [1] => blue )

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  define(VAR_NAME,test);
${VAR_NAME} = value;
echo VAR_NAME;
echo ${VAR_NAME};
?>

A. test

B. testtest

C. testvalue

D. error, constant value cannot be changed

What is the correct answer?

4

Which one of the following format parameter can be used to identify timezone?

A. T

B. N

C. E

D. I

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  $color1 = red;
$color2 = green;
echo $color1 . $color2;
?>

A. red

B. green

C. red green

D. redgreen

What is the correct answer?

4

What will be the output of the following PHP code?
 <?php  $cars = array(Volvo, BMW, Toyota);
echo I like . $cars[0] . , . $cars[1] . and . $cars[2] . .;
?>

A. I like Volvo BMW and Toyota.

B. I like Volvo, BMW and Toyota)

C. I like Volvo, BMW and Toyota.

D. I like. Volvo.,. BMW. and. Toyota)

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  $color1 = red;
$color2 = 1;
$color3 = greyecho $color1 + $color2 . $color3;
?>

A. 1grey

B. grey

C. 0

D. red1grey

What is the correct answer?

4

What will be the output of the following PHP code ?
 <?php  $i = 0;
while ($i = 10){ print hi;
}print hello;
?>

A. hello

B. infinite loop

C. hihello

D. error

What is the correct answer?

4

Which of following variables can be assigned a value to it?
i) $3hello
ii) $_hello
iii) $this
iv) $This


A.

All of the mentioned


B.

Only ii)


C.

ii), iii) and iv)


D.

ii) and iv)