PHP Language | 10 Minute‐Test 27


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.

To validate an e-mail address, which flag is to be passed to the function filter_var()?

A.
FILTER_VALIDATE_EMAIL
B.
FILTER_VALIDATE_MAIL
C.
VALIDATE_EMAIL
D.
VALIDATE_MAIL

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

None.

2.

In which of the following situations does file-based authentication become inconvenient.
i) small list
ii) large number of user
iii) users are being regularly added
iv) static authentication

A.
i) and iv)
B.
i) and iii)
C.
ii) and iii)
D.
ii) and iv)

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

Such requirements are better satisfied by implementing a database based solution.

3.

How many items are available in the $_FILES array?

A.
2
B.
3
C.
4
D.
5

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

$_FILEs[‘userfile’][‘error’], $_FILEs[‘userfile’][‘name’], $_FILEs[‘userfile’][‘size’], $_FILEs[‘userfile’][‘tmp_name’], $_FILEs[‘userfile’][‘type’] are the five items in the array

4.

How many configuration directives pertinent to PHP’s mail function are available?

A.
4
B.
5
C.
6
D.
7

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

They are- SMTP, sendmail_from, sendmail_path, smtp_port, mail.force_extra_parameters.

5.

What is the default time(in seconds) for which session data is considered valid?

A.
1800
B.
3600
C.
1440
D.
1540

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

The session.gc_maxlifetime directive determines this duration. It can be set to any required value.

6.

The session_start() function must appear..

A.
after the html tag
B.
after the body tag
C.
before the body tag
D.
before the html tag

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

Like this: <?php session_start(); ?> <html>

7.

Say I want to change the extension of a PHP file, which of the following statements should I edit to change from .php to .html in the httpd.conf file?

A.
AddType application/x-httpd-php .php
B.
AddType application/x-httpd-php .asp
C.
AddType application/x-httpd-asp .php
D.
AddType application/x-httpd-asp .asp

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

Just change the .php to .html and your extension will change. This is used for security purpose.

8.

Which one of the following is not a preg PHP function?

A.
preg_match
B.
preg_match_all
C.
preg_matchall
D.
preg_split

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

The function preg_matchall does not exist. preg_match_all is a preg function.

9.

Which method returns the error code generated from the execution of the last MySQL function?

A.
errno()
B.
errnumber()
C.
errorno()
D.
errornumber()

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

Error numbers are often used in lieu of natural-language message to ease software internationalization efforts and allow for customization of error messages.

10.

Which method retrieves each row from the prepared statement result and assigns the fields to the bound results?

A.
get_row()
B.
fetch_row()
C.
fetch()
D.
row()
Submit your test now to view the Results and Statistics with answer explanation.