HNB Garhwal University Exam Paper 2020- 21
PHP Programming
1. PHP stands for:
(A) Hypertext Preprocessor
(B) Pretext Hypertext Preprocessor
(C) Personal Home Processor
(D) None of the above
2. Who is known as the father of PHP
(A) Drek Kolkevi
(B) List Barely
(C) Rasmus Lerdrof
(D) None of the above
3. Variable name in PHP starts with:
(A) ! (Exclamation)
(B) $ (Dollar)
(C) & (Ampersand)
(D) # (Hash)
4. Which of the following is the default file extension of
PHP?
(A) .php
(B) .hphp
(C) .xml
(D) .html
5. Which of the following is not a variable scope in PHP?
(A) Extern
(B) Local
(C) Static
(D) Global
6. Which of the following is correct to add a comment in
php?
(A) &.....&
(B) //.....
(C) /*.....*/
(D) Both B and C
7. Which of the following is used to display the output in
PHP?
(A) echo
(B) write
(C) print
(D) Both A and C
8. Which of the following is the use of strlen() function in PHP?
(A) The strlen() function returns the type of string
(B) The strlen() function returns the length of string
(C) The strlen() function returns the value of string
(D) The strlen() function returns the value and type of
string
9. Which of the following is used for concatenation in PHP?
(A) + (plus)
(B) * (asterisk)
(C) . (dot)
(D) append()
10. Which of the following starts with __ (double
underscore) in php?
(A) Inbuilt constant
(B) User defined constants
(C) Magic constants
(D) Default constants
11. Which of the following is the use of strops() function
in PHP?
(A) The strops() function is used to search for the spaces
in a string
(B) The strops() function is used to search for a number in
a string
(C) The strops() function is used to search for a
character/text in a string
(D) 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“);
?>
(A) dlroWolleH
(B) olleHdlreW
(C) Hello DlroW
(D) None of the above
13. Which of the following is the correct way to create a
function in PHP?
(A) Create myFunction()
(B) New_function myFunction()
(C) function myFunction()
(D) None of the above
14. Which of the following functions converts a string to
all uppercase?
(A) upper()
(B) uppercase()
(C) struppercase()
(D) strtoupper()
15. Which of the following is the correct way of defining a
variable in PHP?
(A) $variable name = value;
(B) $variable_name = value;
(C) $variable_name = value
(D) $variable name as value;
16. Which of the following is the correct use of the
strcmp() function in PHP?
(A) The strcmp() function is used to compare the strings
excluding case.
(B) The strcmp() function is used to compare the uppercase
strings.
(C) The strcmp() function is used to compare the lowercase
strings
(D) 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?
(A) diff_array
(B) array_diff
(C) arrays_diff
(D) diff_arrays
18. What is the use
of isset() function in PHP?
(A) The isset() function is used to check whether variable
is set or not
(B) The isset() function is used to check whether variable
is free or not
(C) The isset() function is used to check whether variable
is string or not
(D) None of the above
19. What is the use of sprint() function in PHP?
(A) The sprint() function is used to print the output of
program
(B) The sprint() function is used to send the output to
variable
(C) Both A and B
(D) None of the above
20. Which PHP function is used to find the position of the
last occurrence of a substring inside another string?
(A) strops()
(B) strrpos()
(C) strtr()
(D) None of the above
21. Which of the following functions displays the
information about PHP and its configuration?
(A) php_info()
(B) phpinfo()
(C) info()
(D) None of the above
22. The function in PHP that can be used to concatenate
array elements to form a single delimited string is :
(A) implode()
(B) concat()
(C) explode()
(D) concatenate()
23. Which of the following functions is used to set cookie
in PHP?
(A) createcookie()
(B) makecookie()
(C) setcookie()
(D) None of the above
24. Which of the following funcitons is used to get the
ASCII value of a character in PHP?
(A) val()
(B) asc()
(C) asci()
(D) chr()
25. Which of the
following functions is used to unset a variable in PHP?
(A) delete()
(B) unset()
(C) unlink()
(D) None of the above
26. Which of the following functions is used to sort an
array in descending order?
(A) sort()
(B) asrot()
(C) dsort()
(D) rsort()
27. Which of the following is the code editors in PHP?
(A) Notepad++
(B) Notepad
(C) Adobe Dreamweaver
(D) All of the above
28. Which of the following is used to end a statement in
PHP?
(A) . (dot)
(B) ; (semicolon)
(C) ! (exclamation)
(D) / (slash)
29. Which of the following functions in PHP can be used to
test the type of any variable?
(A) showtype()
(B) gettype()
(C) settype()
(D) None of the above
30. string values in PHP must be enclosed within:
(A) Double quotes
(B) single quotes
(C) Both A and B
(D) None of the above
31. Which of the following variable names is invalie?
(A) $newVar
(B) $new_Var
(C) $new-var
(D) All of the above
32. Which of the following is the correct way to create an
array in PHP?
(A) $season = array, [“summer”,”winter”,”spring”,”autumn”];
(B) $season = array (“summer”,”winter”,”spring”,”autumn”);
(C) $season = “summer”,”winter”,”spring”,”autumn”;
(D) All pf the above
33. Which of the following is a built-in function in PHP
that adds a value to the end of an array?
(A) array_push()
(B) inend_array()
(C) into_array()
(D) None of the above
34. Which of the following functions in PHP returns a text
in title case from a variable?
(A) toUpper($var)
(B) ucwords($var)
(C) ucword($var)
(D) All of the above
35. Which of the following is the correct way to print “Hello
World” in PHP?
(A) “Hello World”;
(B) write(“Hello World”);
(C) echo “Hello World”;
(D) None of the above
0 Comments