PHP Programming Solved MCQ 2020-21 | BCA 6 Semester | HNBGU

PHP Programming Solved MCQ 2020-21

BCA 6 Semester | HNBGU

  1. PHP stands for:
    1. Hypertext Preprocessor
    2. Pretext Hypertext Preprocessor
    3. Personal Home Processor
    4. None of the above


  2. Who is known as the father of PHP
    1. Drek Kolkevi
    2. List Barely
    3. Rasmus Lerdrof
    4. None of the above


  3. Variable name in PHP starts with:
    1. ! (Exclamation)
    2. $ (Dollar)
    3. & (Ampersand)
    4. # (Hash)


  4. Which of the following is the default file extension of PHP?
    1. php
    2. hphp
    3. xml
    4. html


  5. Which of the following is not a variable scope in PHP?
    1. Extern
    2. Local
    3. Static
    4. Global


  6. Which of the following is correct to add a comment in php?
    1. &.....&
    2. //.....
    3. /*.....*/
    4. Both (b) and (c)


  7. Which of the following is used to display the output in PHP?
    1. echo
    2. write
    3. print
    4. Both (a) and (c)


  8. Which of the following is the use of strlen() function in PHP?
    1. The strlen() function returns the type of string
    2. The strlen() function returns the length of string
    3. The strlen() function returns the value of string
    4. The strlen() function returns the value and type of string


  9. Which of the following is used for concatenation in PHP?
    1. + (plus)
    2. * (asterisk)
    3. . (dot)
    4. append()


  10. Which of the following starts with __ (double underscore) in php?
    1. Inbuilt constant
    2. User defined constants
    3. Magic constants
    4. Default constants


  11. Which of the following is the use of strops() function in PHP?
    1. The strops() function is used to search for the spaces in a string
    2. The strops() function is used to search for a number in a string
    3. The strops() function is used to search for a character/text in a string
    4. The strops() function is used to search for a capitalize character in a string


  12. What will be the output of the following program
            < ?php
                $var = “Hello World”;
                echo strrev(“$var1“);
            ?>
                    
    1. dlroWolleH
    2. olleHdlreW
    3. Hello DlroW
    4. None of the above


  13. Which of the following is the correct way to create a function in PHP?
    1. Create myFunction()
    2. New_function myFunction()
    3. function myFunction()
    4. None of the above


  14. Which of the following functions converts a string to all uppercase?
    1. upper()
    2. uppercase()
    3. struppercase()
    4. strtoupper()


  15. Which of the following is the correct way of defining a variable in PHP?
    1. $variable name = value;
    2. $variable_name = value;
    3. $variable_name = value
    4. $variable name as value;


  16. Which of the following is the correct use of the strcmp() function in PHP?
    1. The strcmp() function is used to compare the strings excluding case.
    2. The strcmp() function is used to compare the uppercase strings.
    3. The strcmp() function is used to compare the lowercase strings
    4. The strcmp() function is used to compare the strings including case


  17. Which of the following functions is used to compute the difference between two arrays in PHP?
    1. diff_array
    2. array_diff
    3. arrays_diff
    4. diff_arrays


  18. What is the use of isset() function in PHP?
    1. The isset() function is used to check whether variable is set or not
    2. The isset() function is used to check whether variable is free or not
    3. The isset() function is used to check whether variable is string or not
    4. None of the above


  19. What is the use of sprint() function in PHP?
    1. The sprint() function is used to print the output of program
    2. The sprint() function is used to send the output to variable
    3. Both (a) and (b)
    4. None of the above


  20. Which PHP function is used to find the position of the last occurrence of a substring inside another string?
    1. strops()
    2. strrpos()
    3. strtr()
    4. None of the above


  21. Which of the following functions displays the information about PHP and its configuration?
    1. php_info()
    2. phpinfo()
    3. info()
    4. DefaNone of the aboveult


  22. The function in PHP that can be used to concatenate array elements to form a single delimited string is :
    1. implode()
    2. concat()
    3. explode()
    4. concatenate()


  23. Which of the following functions is used to set cookie in PHP?
    1. createcookie()
    2. makecookie()
    3. setcookie()
    4. None of the above


  24. Which of the following funcitons is used to get the ASCII value of a character in PHP?
    1. val()
    2. asc()
    3. asci()
    4. chr()


  25. Which of the following functions is used to unset a variable in PHP?
    1. delete()
    2. unset()
    3. unlink()
    4. None of the above


  26. Which of the following functions is used to sort an array in descending order?
    1. sort()
    2. asort()
    3. dsort()
    4. rsort()


  27. Which of the following is the code editors in PHP?
    1. Notepad++
    2. Notepad
    3. Adobe Dreamweaver
    4. All of the above


  28. Which of the following is used to end a statement in PHP?
    1. . (dot)
    2. ; (semicolon)
    3. ! (exclamation)
    4. / (slash)


  29. Which of the following functions in PHP can be used to test the type of any variable?
    1. showtype()
    2. gettype()
    3. settype()
    4. None of the above


  30. string values in PHP must be enclosed within:
    1. Double quotes
    2. single quotes
    3. Both (a) and (b)
    4. None of the above


  31. Which of the following variable names is invalid?
    1. $newVar
    2. $new_Var
    3. $new-var
    4. All of the above


  32. Which of the following is the correct way to create an array in PHP?
    1. $season = array, [“summer”,”winter”,”spring”,”autumn”];
    2. $season = array (“summer”,”winter”,”spring”,”autumn”);
    3. $season = “summer”,”winter”,”spring”,”autumn”;
    4. All of the above


  33. Which of the following is a built-in function in PHP that adds a value to the end of an array?
    1. array_push()
    2. inend_array()
    3. into_array()
    4. None of the above


  34. Which of the following functions in PHP returns a text in title case from a variable?
    1. toUpper($var)
    2. ucwords($var)
    3. ucword($var)
    4. All of the above


  35. Which of the following is the correct way to print “Hello World” in PHP?
    1. “Hello World”;
    2. write(“Hello World”);
    3. echo “Hello World”;
    4. None of the above