PHP MCQ Arrays in PHP MCQ MCQ Details
MCQ Practice Single Best Answer Topic: Arrays in PHP MCQ

Q What will be the output of the following php code?
< ?php 
    $states = array("karnataka" => array
    ( "population" => "11,35,000", "captial" => "Bangalore"),
    "Tamil Nadu" => array( "population" => "17,90,000",
    "captial" => "Chennai") );
    echo  $states["karnataka"]["population"];
?>

Question ID
#2382
Subchapter
Arrays in PHP MCQ
Action
Choose one option below

Choose Your Answer

Click an option to check whether your answer is correct.

  • A karnataka 11,35,000
  • B 11,35,000
  • C population 11,35,000
  • D karnataka population
Correct Answer: B

Explanation

Treat states as a multidimensional array and accordingly traverse it to get the value.

Share This Question

Share this MCQ with your friends or study group.