Which of the following is correct about constants vs variables in php
This section presents you various set of Mock Tests related to PHP. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself. Show
PHP Mock Test IIAnswer : CExplanationBoth of the above options are correct. Answer : CExplanationBoth of the above options are correct. Answer : AExplanation_LINE_ − The current line number of the file. Answer : BExplanation_FILE_ − The full path and filename of the file. If used inside an include,the name of the included file is returned. Since PHP 4.0.2, _FILE_ always contains an absolute path whereas in older versions it contained relative path under some circumstances. Answer : CExplanation_FUNCTION_ − The function name. (Added in PHP 4.3.0) As of PHP 5 this constant returns the function name as it was declared (case-sensitive). In PHP 4 its value is always lowercased. Answer : DExplanation_CLASS_ − The class name. (Added in PHP 4.3.0) As of PHP 5 this constant returns the class name as it was declared (case-sensitive). In PHP 4 its value is always lowercased. Answer : AExplanation_METHOD_ − The class method name. (Added in PHP 5.0.0) The method name is returned as it was declared (case-sensitive). Q 8 - Which of the following keyword terminates the for loop or switch statement and transfers execution to the statement immediately following the for loop or switch? A - break B - continue Answer : AExplanationbreak terminates the for loop or switch statement and transfers execution to the statement immediately following the for loop or switch. Q 9 - Which of the following keyword causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating? A - break B - continue Answer : BExplanationcontinue causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating. Answer : AExplanationNumeric array − An array with a numeric index. Values are stored and accessed in linear fashion. Answer : BExplanationAssociative array − An array with strings as index. This stores element values in association with key values rather than in a strict linear index order. Answer : CExplanationMultidimensional array − An array containing one or more arrays and values are accessed using multiple indices. Answer : AExplanationTo concatenate two string variables together, use the dot (.) operator. Answer : BExplanationThe strlen() function is used to find the length of a string. Answer : CExplanationThe strpos() function is used to search for a string or character within a string. Answer : DExplanationPHP provides a function getenv() to access the value of all the environment variables. Answer : AExplanationOne of the environemnt variables set by PHP is HTTP_USER_AGENT which identifies the user's browser and operating system. Answer : BExplanationThe PHP rand() function is used to generate a random number. This function can generate numbers with-in a given range. The random number generator should be seeded to prevent a regular pattern of numbers being generated. This is achieved using the srand() function that specifiies the seed number as its argument. Answer : AExplanationThe PHP default variable $_PHP_SELF is used for the PHP script name and when you click "submit" button then same PHP script will be called. Answer : AExplanationrsort() − Sorts an array in reverse order. Answer : BExplanationThe PHP header() function supplies raw HTTP headers to the browser and can be used to redirect it to another location. The redirection script should be at the very top of the page to prevent any other part of the page from loading. Answer : AExplanationThe PHP provides $_GET associative array to access all the sent information using GET method. Answer : AExplanationThe PHP $_REQUEST variable can be used to get the result from form data sent with both the GET and POST methods. Answer : AExplanationarray() − Creates an array. Answer : AExplanationarray_reverse() − Returns an array in the reverse order. Answer Sheet
php_questions_answers.htm Useful Video Courses
Video
Video
Video
Video
Video
Video Which of the following are correct about constants vs variables in PHP?Q 3 - Which of the following is correct about constants vs variables in PHP? A - Constants may be defined and accessed anywhere without regard to variable scoping rules.
Which of the following is a correct way to declare constant variable in PHP?A valid constant name starts with a letter or underscore (no $ sign before the constant name). Note: Unlike variables, constants are automatically global across the entire script.
Which of the following is true about PHP variables?Q 9 - Which of the following is true about php variables? A - All variables in PHP are denoted with a leading dollar sign ($).
What is difference between variable and constant?What is the Difference between Constant and Variables? A constant does not change its value over time. A variable, on the other hand, changes its value dependent on the equation. Constants are usually written in numbers.
|