Web Programming (3160713) MCQs

MCQs of Server Side Programmingwith PHP

Showing 21 to 30 out of 49 Questions
21.
What will be the output of the following PHP code?
<?php
    $states = array("gujarat" => array
    ("population" => "123456789", "capital" => "Gandhinagar"),
    "Tamil Nadu" => array( "population" => "17,90,000",
    "capital" => "Chennai") );
    echo $states["gujarat"]["population"];
    ?> 
(a) Gujarat 123456789
(b) 123456789
(c) 123456789 gujarat
(d) error
Answer:

Option (b)

22.
Which of the following PHP function will return true if a variable is an array or false if it is not an array?
(a) this_array()
(b) is_array()
(c) do_array()
(d) in_array()
Answer:

Option (b)

23.
Which in-built function will add a value to the end of an array?
(a) array_unshift
(b) into_array
(c) inend_array
(d) array_push
Answer:

Option (d)

24.
What will be the output of the following PHP code?
<?php
    $state = array ("Karnataka", "Goa", "Tamil Nadu",
    "Andhra Pradesh");
    echo (array_search ("Tamil Nadu", $state) );
    ?> 
(a) TRUE
(b) FALSE
(c) 1
(d) 2
Answer:

Option (d)

25.
What will be the output of the following PHP code?
<?php
    $fruits = array ("apple", "orange", "banana");
    echo (next($fruits)); 
    echo (next($fruits));
    ?> 
(a) orangebanana
(b) appleorange
(c) orangeorange
(d) appleapple
Answer:

Option (a)

26.
Which of the functions is used to sort an array in descending order?
(a) sort
(b) asort
(c) rsort
(d) dsort
Answer:

Option (c)

27.
What will be the output of the following PHP code?
<?php
    $fruits = array ("apple", "mango", "peach", "pear",
    "orange");
    $subset = array_slice ($fruits, 2);
    print_r ($subset);
    ?> 
(a) Array ( [0] => peach )
(b) Array ( [0] => apple [1] => mango [2] => peach )
(c) Array ( [0] => apple [1] => mango )
(d) Array ( [0] => peach [1] => pear [2] => orange )
Answer:

Option (d)

28.
The filesize() function returns the file size in ___________
(a) bits
(b) bytes
(c) kilobytes
(d) gigabytes
Answer:

Option (b)

29.
Which one of the following PHP function is used to determine a file’s last access time?
(a) fileltime
(b) filectime
(c) fileatime
(d) filetime
Answer:

Option (c)

30.
Which one of the following function is capable of reading a file into a string variable?
(a) file_contents
(b) file_get_contents
(c) file_content
(d) file_get_content
Answer:

Option (b)

Showing 21 to 30 out of 49 Questions