PHP

PHP Practice Test

0%

What is the meaning of PHP?

Correct! Wrong!

Explanation:
PHP (Hypertext Preprocessor) is a commonly used programming language,a widely used open source general-purpose scripting language. It's well-suited for web development and may be inserted into HTML. PHP is a scripting language. server-side (back-end) scripting language, hence the code written in it must be server-side (back-end) scripting language. The PHP file is run on the server.

Which of the following methods for declaring a PHP variable is incorrect?

Correct! Wrong!

Explanation:
The correct answer
$a Variable;

What is the proper method for defining constants in PHP?

Correct! Wrong!

Explanation:
The define () function in PHP is used to define constants. It takes two arguments: the name of the constant and its value. The constant value can be accessed at any time by referring to its name, once it has been defined.

What are the delimiters that surround PHP server scripts?

Correct! Wrong!

Explanation:
The correct answer

Which of the following methods for declaring a PHP variable is incorrect?

Correct! Wrong!

Explanation:
The correct answer
$a_Number = 9

Which function will you use to quickly transform an HTML page into a database-friendly format?

Correct! Wrong!

Explanation:
Characters are converted to HTML entities using the htmlentities () function. Use the html entity decode () function to convert HTML entities back to characters.

In PHP, how do you type "Hello World"?

Correct! Wrong!

Explanation:
The PHP Hello World code in a single line should be written as: <?php echo '

hello world

' ?> All PHP codes should be placed between the PHP opening and closing tags:

Is it true/false that PHP variables are case sensitive?

Correct! Wrong!

Explanation:
PHP is case sensitive to some extent. The case of variable names is important, but not the case of function names.

To create a CURL session, which of the following functions will be used?

Correct! Wrong!

Explanation:
curl init — This function starts a new cURL session and returns a cURL handle to other functions.

Which symbol is used to begin all variables in PHP?

Correct! Wrong!

Explanation:
A variable is identified by the $ sign, which is followed by the variable's name. The name of a variable must begin with a letter or an underscore. A number cannot be the first character in a variable name. Only alpha-numeric characters and underscores (A-z, 0-9, and _) are allowed in variable names.

What data type will PHP convert the following variable to automatically:? $aVariable = 99;

Correct! Wrong!

Explanation:
A data type called an integer is a type of data. A variable that retains the entire numeric value. 1, 23, 343, -23, -50, and so on are complete (whole) numbers. The value of an integer can be positive, negative, or zero.

To get a SINGLE record from a MySql resultset, which of the following statements will be used?

Correct! Wrong!

Explanation:
The fetch row () / mysqli fetch row () method returns an enumerated array of one row from a result-set.

Is it true/false that once a variable is declared, it can only be used once in the PHP source code?

Correct! Wrong!

Explanation:
A variable can not need to be declared before adding a value. PHP automatically converts the variable to the correct data type, depending on its value. After declaring a variable it can be reused throughout the code. The assignment operator (=) used to assign the value to a variable.

What is the correct MySql database connection syntax?

Correct! Wrong!

Explanation:
The connect () / mysqli connect () functions create a new MySQL server connection.

The syntax of PHP is most similar to:

Correct! Wrong!

Explanation:
In terms of keywords and language syntax, PHP is similar to C style syntax. The syntax of if conditions, for and while loops, and function returns is comparable to that of C, C++, C#, Java, and Perl. Comments in a program are non-executable statements that explain program logic.

Isn't it true/false that all variables in PHP begin with a $(dollar) sign?

Correct! Wrong!

Explanation:
In PHP, all variables must start with a dollar sign ($) and then the variable name. A variable's name can be long and descriptive (like $factorial, $even nos) or short and descriptive (like $n, $f, or $x). A variable's name can only contain alphabetic characters and underscores (i.e., 'a-z', 'A-Z', '0-9, and ' ').

After using the mysql connect() method, which of the following functions must be called?

Correct! Wrong!

Explanation:
The PHP function mysqli_select_db () returns a boolean value that is true if the operation was successful and false if it was not. This function was first introduced in PHP Version 5 and has since been updated to operate with all subsequent versions.

Variables appear in the URL when using the POST method:

Correct! Wrong!

Explanation:
The parameters will appear in $_REQUEST whether you use GET or POST. The key distinction is that when you use POST, the variables will not appear in the URL history. This reduces the visibility of information like passwords that you don't want to appear in URL history.

Select the best appropriate statement to verify that a SELECT SQL query was successfully executed.

Correct! Wrong!

Explanation:
The correct answer
If (mysqli_query($link, "SELECT * FROM keyContacts"))

PHP 5.3.0 introduces a new functionality that allows you to refer to a called class in a static inheritance context. What's the name of it?

Correct! Wrong!

Explanation:
Late static bindings are a PHP feature that can be used to refer to a called class in a static inheritance context. Late static bindings function by storing the class specified in the most recent "non-forwarding call."

The extension ".inc" is required for include files.

Correct! Wrong!

Explanation:
Included files can have any file name extension, however the.inc extension is a recommended practice. The included files will be interpreted by the caller page's interpreter.

The circular reference collector is activated by which function?

Correct! Wrong!

Explanation:
The circular reference collector is activated.

Is it possible to create functions without giving their names using anonymous functions?

Correct! Wrong!

Explanation:
Anonymous functions, often known as closures, allow the development of functions without a name. They're most helpful as the value of callable parameters, but they're also handy for a variety of other things. The Closure class is used to implement anonymous functions.

How do you add a comment in PHP?

Correct! Wrong!

Explanation:
To make a line of code commented, use one of the two symbols # or / at the beginning of the line.

Is it possible to run PHP from the command line?

Correct! Wrong!

Explanation:
You may now execute your PHP script by typing the command to launch the PHP CLI program and specifying the name of the PHP file to run on the command line.