PHP Language | 10 Minute‐Test 24


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.

Which one of the following should not be used while sending passwords or other sensitive information?

A.
GET
B.
POST
C.
REQUEST
D.
NEXT

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

Because the data is visible to everyone.

2.

In which authentication method does changing the username or password can be done only by entering the code and making the manual adjustment.

A.
Hard-coding a login pair directly into the script
B.
Data-based authentication
C.
PEAR’S HTTP authentication
D.
PEAR’S HTTP authentication

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

This is one of the drawbacks of Hard-coding a login pair directly into the script.

3.

Which directive sets a maximum allowable amount of memory in megabytes that a script can allow?

A.
max_size
B.
post_max_size
C.
max_memory_limit
D.
memory_limit

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

Its default value is 16M.

4.

Which one of the following function returns the port number of a specified service?

A.
getportname()
B.
getservername()
C.
getserverbyname()
D.
getservbyname()

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

Example- getservbyname(“http”,”tcp”) will return 80.

5.

If the directive session.cookie_lifetime is set to 3600, the cookie will live until..

A.
3600 sec
B.
3600 min
C.
3600 hrs
D.
the browser is restarted

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The lifetime is specified in seconds, so if the cookie should live 1 hour, this directive should be set to 3600.

6.

Which parameter determines whether the old session file will also be deleted when the session ID is regenerated?

A.
delete_old_file
B.
delete_old_session
C.
delete_old_session_file
D.
delete_session_file

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

By default, this behavior is disabled.

7.

Which Apache directive outputs Apache’s server version, server name, port and compile-in modules?

A.
ServerSignature
B.
ServerName
C.
ServerDetails
D.
ServerInfo

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

It is capable of displaying output like: Apache/2.2.11 (Ubuntu) Server at localhost Port 80.

8.

What will be the output of the following PHP code?

    <?php

    $str = "Hello! My name is Cameron Fox. Coffee?"

    $find = array('/is/','/coffee/');

    $replace = array('/was/','/tea/');

    echo preg_replace ($find, $replace, $str);

    ?>

A.
Hello! My name was Cameron Fox. tea?
B.
Hello! My name is Cameron Fox. tea?
C.
Hello! My name is Cameron Fox. Coffee?
D.
Hello! My name was Cameron Fox. Coffee?

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

Coffee was not replaced because the preg_replace function is case sensitive. Therefore it treats coffee and Coffee differently.

9.

Which one of the following statements instantiates the mysqli class?

A.
mysqli = new mysqli()
B.
$mysqli = new mysqli()
C.
$mysqli->new.mysqli()
D.
mysqli->new.mysqli()

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

If you choose to interact with MySQL server using the object-oriented interface, you need to first instantiate the mysqli class via its constructor.

10.

Which version of MySQL introduced the prepared statements?

A.
MySQL 4.0
B.
MySQL 4.1
C.
MySQL 4.2
D.
MySQL 4.3

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

When the query() method is looped repeatedly it comes at a cost of both overhead, because of the need to repeatedly parsing of the almost identical query for validity, and coding convenience, because of the need to repeatedly reconfigure the query using the new values for each iteration. To help resolve the issues incurred by repeatedly executed queries, MySQL introduced prepared statements.


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