InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which of the functions is used to sort an array in descending order?(a) sort()(b) asort()(c) rsort()(d) dsort()The question was asked in an online quiz.I want to ask this question from Arrays in section Arrays and Functions of PHP |
|
Answer» The CORRECT answer is (C) rsort() |
|
| 2. |
Which function should we use to sort the array in natural order?(a) dsort()(b) casesort()(c) natcasesort()(d) naturalsort()This question was posed to me in exam.Question is taken from Arrays topic in portion Arrays and Functions of PHP |
|
Answer» The correct option is (C) natcasesort() |
|
| 3. |
Which of the following function is used to get the value of the previous element in an array?(a) last()(b) before()(c) prev()(d) previous()I had been asked this question in unit test.This question is from Arrays-1 in section Arrays and Functions of PHP |
|
Answer» CORRECT answer is (C) PREV() To explain: The prev() FUNCTION returns the previous element in the ARRAY. |
|
| 4. |
Which function returns an array consisting of associative key/value pairs?(a) count()(b) array_count()(c) array_count_values()(d) count_values()I had been asked this question in examination.Origin of the question is Arrays-1 in chapter Arrays and Functions of PHP |
|
Answer» Correct CHOICE is (c) array_count_values() |
|
| 5. |
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()The question was posed to me at a job interview.This intriguing question comes from Arrays-1 in section Arrays and Functions of PHP |
|
Answer» Right answer is (b) is_array() |
|
| 6. |
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()The question was asked in semester exam.This intriguing question comes from Arrays-1 topic in section Arrays and Functions of PHP |
|
Answer» Correct CHOICE is (d) array_push() |
|
| 7. |
PHP’s numerically indexed array begin with position ___________(a) 1(b) 2(c) 0(d) -1I had been asked this question in exam.This interesting question is from Arrays-1 in portion Arrays and Functions of PHP |
|
Answer» The correct CHOICE is (c) 0 |
|
| 8. |
Which of the following PHP functions can be used to get the current memory usage?(a) get_usage()(b) get_peak_usage()(c) memory_get_usage()(d) memory_get_peak_usage()The question was posed to me in an interview.This intriguing question originated from In-Built Functions in PHP topic in section Arrays and Functions of PHP |
|
Answer» Correct answer is (c) memory_get_usage() |
|
| 9. |
Which one of the following PHP functions can be used to find files?(a) glob()(b) file()(c) fold()(d) get_file()The question was asked in an international level competition.My doubt is from In-Built Functions in PHP topic in division Arrays and Functions of PHP |
|
Answer» Correct answer is (a) glob() |
|
| 10. |
Which of the following PHP functions accepts any number of parameters?(a) func_get_argv()(b) func_get_args()(c) get_argv()(d) get_argc()This question was addressed to me in an interview for internship.This key question is from In-Built Functions in PHP topic in portion Arrays and Functions of PHP |
|
Answer» The correct ANSWER is (b) func_get_args() |
|
| 11. |
A function in PHP which starts with __ (double underscore) is known as __________(a) Magic Function(b) Inbuilt Function(c) Default Function(d) User Defined FunctionI have been asked this question by my school teacher while I was bunking the class.I'm obligated to ask this question of Functions in portion Arrays and Functions of PHP |
|
Answer» RIGHT OPTION is (a) Magic Function The best explanation: PHP functions that START with a double underscore – a “__” – are called magic functions in PHP. They are functions that are always defined inside classes, and are not stand-alone functions. |
|
| 12. |
How to define a function in PHP?(a) function {function body}(b) data type functionName(parameters) {function body}(c) functionName(parameters) {function body}(d) function functionName(parameters) {function body}This question was posed to me in class test.The above asked question is from Functions topic in chapter Arrays and Functions of PHP |
|
Answer» CORRECT answer is (d) function functionName(parameters) {function body} EASIEST explanation: PHP ALLOWS us to create our own user-defined functions. Any name ending with an open and closed PARENTHESIS is a function. The keyword function is always USED to begin a function. |
|
| 13. |
Type Hinting was introduced in which version of PHP?(a) PHP 4(b) PHP 5(c) PHP 5.3(d) PHP 6I had been asked this question in final exam.This intriguing question comes from Functions in chapter Arrays and Functions of PHP |
|
Answer» Correct OPTION is (b) PHP 5 |
|