PHP Language | 10 Minute‐Test 26


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 :-).

could potentially wreak havoc on a page.

1.

What will be the value of the variable $input in the following PHP code?

    <?php

    $input = "Swapna<td>Lawrence</td>you are really<i>pretty</i>!";

    $input = strip_tags($input,"<i></i>");

    ?>

A.
Swapna Lawrence you are really pretty!
B.
Swapna <td>Lawrence</td> you are really<i>pretty</i>!
C.
Swapna <td>Lawrence</td> you are really pretty!
D.
Swapna Lawrence you are really<i>pretty</i>!

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

Italic tags might be allowable, but table tags

2.

Which function is used to split a string into a series of substrings, with each string boundary is determined by a specific separator?

A.
break()
B.
divide()
C.
explode()
D.
md5()

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

Although they are similar function, you should use explode() instead of split().In fact split() function has been deprecated altogether.

3.

Which superglobal stores a variety of information pertinent to a file uploaded to the server via a PHP script?

A.
$_FILE Array
B.
$_FILEs Array
C.
$_FILES_UPLOADED Array
D.
$_FILE_UPLOADED Array

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None

4.

Which one of the following function is used to send a e-mail using PHP script?

A.
mail_send()
B.
send_mail()
C.
mailrr()
D.
mail()

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

mail(string to, string subject, string message,) using this you can send any mail.

5.

What is the default number of seconds that cached session pages are made available before the new pages are created?

A.
360
B.
180
C.
3600
D.
1800

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

The directive which determines this is session.cache_expire.

6.

Which function is used to transform PHP’s session-handler behavior into that defined by your custom handler?

A.
session_set_save()
B.
session_set_save_handler()
C.
Session_handler()
D.
session_save_handler()

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None

7.

Which directive should we disable to obscure the fact that PHP is being used on our server?

A.
show_php
B.
expose_php
C.
print_php
D.
info_php

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

Using the expose_php directive we can prevent PHP version details from being appended on our web server signature. When expose_php is disabled, the server signature will look like: Apache/2.2.11 (Ubuntu) Server.

8.

What will be the output of the following PHP code?

    <?php

    $line = "You like dogs. I hate dogs. We should marry."

    $sen = preg_split('/\./', $line);

    print_r($sen);

    ?>

A.
You like dogs. I hate dogs. We should marry.
B.
Array([0]=>You like dogs. I hate dogs. We should marry.)
C.
Array([0]=>You like dogs. [1]=>I hate dogs. [2]=>We should marry.)
D.
Error

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

We use a ‘.’ period to split the data, therefor giving each sentence it’s own array entry.

9.

Which one of the following methods can be used to diagnose and display information about a MySQL connection error?

A.
connect_errno()
B.
connect_error()
C.
mysqli_connect_errno()
D.
mysqli_connect_error()

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

The mysqli extension includes a few features that can be used to capture error messages or alternatively you can use exceptions.

10.

Which one of the following methods is used to recuperating prepared statements resources?

A.
end()
B.
finish()
C.
final()
D.
close()
Submit your test now to view the Results and Statistics with answer explanation.