Home
Current Affairs January 2024

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 )

Correct Answer :

A.

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


The array_pop() function deletes the last element of an array.

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  define('GOOD_OCTAL', 0700);
define('BAD_OCTAL', 0600);
print GOOD_OCTAL;
print '
';
print BAD_OCTAL;
?>

A. 448
384

B. 0700
0800

C. ERROR

D. No output

What is the correct answer?

4

What will be the output of the following PHP code?
     <?php      echo (checkdate(4,31,2010) ? 'Valid' : 'Invalid');
?>

A. TRUE

B. FALSE

C. Valid

D. Invalid

What is the correct answer?

4

What does PHP stand for?


i) Personal Home Page
ii) Hypertext Preprocessor
iii) Pretext Hypertext Processor
iv) Preprocessor Home Page


A.

Both i) and iii)


B.

Both ii) and iv)


C.

Only ii)


D.

Both i) and ii)


What is the correct answer?

4

What will be the output of the following PHP code?
 <?php  $age = array(Peter=>35, Ben=>37, Joe=>43);
print_r(array_change_key_case($age, CASE_UPPER));
?>

A.

Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )

B.

Array ( [peter] => 35 [ben] => 37 [joe] => 43 )

C.

Array ( [PETER] => 35 [BEN] => 37 [JOE] => 43 )

D.

Array ( [PeTeR] => 35 [BeN] => 37 [Joe] => 43 )

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

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  $a = array(a=>red, b=>green, c=>blue);
echo array_shift($a);
print_r ($a);
?>

A.

green

B.

red

C.

redArray( [c] => green [c] => blue )

D.

redArray( [b] => green [c] => blue )

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

Which one of the following function is used to start a session?

A.

start_session()

B.

session_start()

C.

session_begin()

D.

begin_session()

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 the following is/are a PHP code editor?
i) Notepad
ii) Notepad++
iii) Adobe Dreamweaver
iv) PDT


A.

Only iv)


B.

All of the mentioned.


C.

i), ii) and iii)


D.

Only iii)


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

Which directive determines how the session information will be stored?

A.

save_data

B.

session.save

C.

session.save_data

D.

session.save_handler

What is the correct answer?

4

Say you want to calculate the date 45 days from the present date which one of the following statement will you use?

A.

totime(+45)

B.

totime(+45 days)

C.

strtotime(+45 days)

D.

strtotime(-45 days)

What is the correct answer?

4

Neglecting to set which of the following cookie will result in the cookies domain being set to the host name of the server which generated it.

A.

session.domain

B.

session.path

C.

session.cookie_path

D.

session.cookie_domain

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. no output

D. error

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  $i = 5;
while (--$i > 0 || ++$i){ print $i;
} ?>

A. 54321111111….infinitely

B. 555555555…infinitely

C. 54321

D. 5

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? 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

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  define('GREETING_TEST', 'PHP is a scripting language', true);
echo GREETING_TESt;
$changing_variable = 'test';
echo constant('GREETING_' . strtoupper($changing_variable));
?>

A. PHP is a scripting language
PHP is a scripting language

B. GREETING_TESt

C. PHP is a scripting language

D. PHP is a scripting language
GREETING_TEST

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

Which one of the following is the default PHP session name?

A. PHPSESSID

B. PHPSESID

C. PHPSESSIONID

D. PHPIDSESS

What is the correct answer?

4

If the directive session.cookie_lifetime is set to 3600, the cookie will live until..

A. 3600 sec

B. 3600 min

C. 3600 hrs

D. the browser is restarted

What is the correct answer?

4

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

A. redgreen

B. red green

C. 0

D. 1

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

B. red green

C. 0

D. error

What is the correct answer?

4

What will be the output of the following code? If say date is 22/06/2013.
     <?php      echo Today is .date(F d, Y)     ?> 

A. Today is 22 June, 2013

B. Today is 22-06-2013

C. Today is 06-22-2013

D. Today is June 22, 2013

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