Novell Previous Years Solved Sample Placement Papers
-
Which of the following function is used to set cookie in PHP?
A. createcookie()
B. makecookie()
C. setcookie() Answer: Option C
D. None of the above
- Solution: PHP cookie is a small piece of information that is stored at the client browser. It is used to recognize the user. PHP setcookie() function is used to set a cookie with HTTP response. Once the cookie is set, you can access it by the $_COOKIE superglobal variable.
-
Which of the following function is used to get the ASCII value of a character in PHP?
A. val()
B. asc()
C. ascii()
D. chr() Answer: Option D
- Solution: The PHP chr() function is used to generate a single byte string from a number. In other words, it returns a character from a specified ASCII value.
-
Which of the following function is used to unset a variable in PHP?
A. delete()
B. unset() Answer: Option B
C. unlink()
D. None of the above
- Solution: The unset() function is a predefined variable handling function of PHP, which is used to unset a specified variable. In other words, "the unset() function destroys the variables".
-
Which of the following function is used to sort an array in descending order?
A. sort()
B. asrot()
C. dsort()
D. rsort() Answer: Option D
- Solution: The PHP rsort() function is used to sort an array in descending order. This function was introduced in PHP 4.0.
-
Which of the following is/are the code editors in PHP?
A. Notepad++
B. Notepad
C. Adobe Dreamweaver
D. All of the above Answer: Option D
- Solution: PHP programs can be written on any editor, such as Notepad, Notepad++, Dreamweaver, etc. These programs are saved with a .php extension, i.e., filename.php inside the htdocs folder.
-
Which of the following is used to end a statement in PHP?
A. . (dot)
B. ; (semicolon) Answer: Option B
C. ! (exclamation)
D. / (slash)
- Solution: PHP statements end with a semicolon (;).
-
Which of the following function in PHP can be used to test the type of any variable?
A. showtype()
B. gettype() Answer: Option B
C. settype()
D. None of the above
- Solution: The gettype() function is an inbuilt function in PHP, and as its name implies, it returns the type of a variable. The gettype() function in PHP is used to check the type of an existing variable.
-
String values in PHP must be enclosed within -
A. Double Quotes
B. Single Quotes
C. Both (a) and (b) Answer: Option C
D. None of the above
-
Solution: There are 4 ways to specify a string literal in PHP:
- single quoted
- double quoted
- heredoc syntax
- newdoc syntax (since PHP 5.3)