PHP Language | 10 Minute‐Test 12


Instruction

  • Total number of questions : 10.
  • Time alloted : 10 minutes.
  • Each question carry 1 mark.
  • No Negative marks
  • DO NOT refresh the page.
  • All the best :-).

1.

PHP recognizes constructors by the name..

A.
classname()
B.
_construct()
C.
function _construct()
D.
function __construct()

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

A double underscore followed by the construct keyword. Its syntax is function __construct ([ argument1, argument2,…..]) { Class Initialization code }

2.

Which one of the following is the right way to clone an object?

A.
_clone(targetObject);
B.
destinationObject = clone targetObject;
C.
destinationObject = _clone(targetObject);
D.
destinationObject = clone(targetObject);

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

You can clone an object by prefacing it with the clone keyword.

3.

Which version of PHP introduced E_STRICT Error level?

A.
PHP 4
B.
PHP 5
C.
PHP 5.2
D.
PHP 5.3

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

Description for E_STRICT is PHP version portability suggestions

4.

Which version added the method getPrevious()?

A.
PHP 4
B.
PHP 5
C.
PHP 5.1
D.
PHP 5.3

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

None.

5.

Which one of the following filter is used to filter several variables with the same or different filters?

A.
filter_var_array()
B.
filter_var()
C.
filter_input
D.
filter_input_array

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

None

6.

[:alpha:] can also be specified as..

A.
[A-Za-z0-9]
B.
[A-za-z]
C.
[A-z]
D.
[a-z]

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

[:alpha:] is nothing but Lowercase and uppercase alphabetical characters.

7.

Say we have two compare two strings which of the following function/functions can you use?
i) strcmp()
ii) strcasecmp()
iii) strspn()
iv) strcspn()

A.
i) and ii)
B.
iii) and iv)
C.
None of the mentioned
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

All of the functions mentioned above can be used to compare strings in some or the other way.

8.

Which one of the following function is capable of reading a file into an array?

A.
file()
B.
arrfile()
C.
arr_file()
D.
file_arr()

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

None

9.

Which one of the following format parameter can be used to identify timezone?

A.
T
B.
N
C.
E
D.
I

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

When the format is E the timezone is identified and returned…example America/New_York.

10.

Which method is simply an object-oriented version of date()?

A.
DateTime::format()
B.
DateTime::modify()
C.
DateTime::setTime()
D.
DateTime::setDate()

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The format() method is simply an object-oriented version of date(). It takes $dateFormat as an argument. $dateFormat is a string consisting of the same date formatting characters accepted by the procedural date() function.


Submit your test now to view the Results and Statistics with answer explanation.