Professional Test For PHP Web Developers!

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Ksj786
K
Ksj786
Community Contributor
Quizzes Created: 1 | Total Attempts: 7,497
| Attempts: 7,497 | Questions: 15
Please wait...
Question 1 / 15
0 %
0/100
Score 0/100
1. What is correct syntax of connecting to a MySql database

Explanation

The correct syntax for connecting to a MySql database is "mysql_connect("localhost",$username,$password)". This syntax specifies the host as "localhost" and includes the variables $username and $password, which hold the login credentials for the database.

Submit
Please wait...
About This Quiz
Professional Test For PHP Web Developers! - Quiz

What does a PHP web developer do? PHP is a general-purpose programming language that was originally designed for web development. PHP is being used by more developers, especially in the world of freelancers. It is used mostly because of the cost matter. PHP developers create programs, applications, and web sites,... see moreand PHP is known for its web development and business application. Take this impressive quiz to see what you know about web developers.
see less

Personalize your quiz and earn a certificate with your name on it!
2. Which of the following is true about GET & POST methods

Explanation

The POST method allows for the submission of form data without displaying it in the address bar or browser. This is useful when dealing with sensitive information that should not be visible to the user or easily accessible. With the GET method, the variables are displayed in the URL of the address bar, making them visible and potentially accessible to anyone who sees the URL. Additionally, the $_REQUEST[] server-side array can access both GET and POST variables, so the statement that POST variables cannot be accessed by $_REQUEST[] is incorrect.

Submit
3. Which of following statements will be used to fetch SINGLE record  from a MySql resultset

Explanation

The function mysql_fetch_row is used to fetch a single record from a MySQL resultset. It returns an indexed array that contains the values of the fetched row. This function is commonly used when the resultset contains a large number of rows and the memory usage needs to be optimized.

Submit
4. Which of the following is NOT a valid PHP comparison operator?


Explanation

The comparison operator "===" is a valid PHP comparison operator. It is used to compare both the value and the type of two variables. The "!=" operator is used to check if two values are not equal, while the ">=" operator is used to check if the left operand is greater than or equal to the right operand. Therefore, the correct answer is ">=".

Submit
5. Which of the following functions will be used to create a CURL sessions

Explanation

The function curl_init() is used to initialize a CURL session. This function returns a CURL handle, which is then used as the parameter for other CURL functions like curl_setopt() to set various options for the session. Once the session is initialized and options are set, the session can be executed using curl_exec() to perform the desired tasks like making HTTP requests and retrieving data from a remote server. Therefore, curl_init() is the correct function to create a CURL session.

Submit
6. What gets printed?

class MyException extends Exception {}

try {
throw new MyException('Oops!');
} catch (Exception $e) {
echo "Caught Exception\n";
} catch (MyException $e) {
echo "Caught MyException\n";


}

Explanation

The first catch will match because MyException is a subclass of Exception, so the second catch is unreachable

Submit
7. What is a correct way of defining constants in PHP

Explanation

The correct way of defining constants in PHP is by using the "define" function followed by the constant name in quotes. This function allows us to define a constant with a specific value, which cannot be changed throughout the execution of the script.

Submit
8. What will be printed?

if ('2' == '02') {  
echo 'true';
} else {
echo 'false';
}

Explanation

The given code will print "true". This is because the comparison operator used is the loose equality operator (==), which does not consider the data types of the operands. In this case, both '2' and '02' are considered equal because they have the same characters. Therefore, the condition ('2' == '02') evaluates to true, and the code block inside the if statement is executed, resulting in the output "true".

Submit
9. Which of the following functions MUST be called AFTER using mysql_connect() function

Explanation

The function mysql_select_db must be called after using mysql_connect() because it is used to select a specific database to work with. Once the connection to the MySQL server is established using mysql_connect(), this function is necessary to specify the database that will be accessed for subsequent queries and operations.

Submit
10. What will be printed?

$a = array();

if ($a[1]) null;

echo count($a), "\n";

Explanation

checking value in if() does not create an array element

Submit
11. Which function will you use to convert an HTML page into a format that can be saved in database conveniently

Explanation

The htmlentities() function is used to convert special characters in an HTML page into their corresponding HTML entities. By using this function, any special characters in the HTML code will be converted into a format that can be safely stored in a database. This ensures that the HTML code is properly encoded and can be easily retrieved and displayed without causing any issues or conflicts with the database.

Submit
12. What gets printed?


<?php

$RESULT = 11 + 011 + 0x11;

echo "$RESULT";

?>

Explanation

A decimal plus an octal plus a hex number. 11 + 9 + 17 = 37

Submit
13. What will be printed?

$a = array(
null => 'a',
true => 'b',
false => 'c',
0 => 'd',
1 => 'e',
'' => 'f'
);

echo count($a), "\n";

Explanation

Keys will be converted like this: null to '' (empty string), true to 1, false to 0

Submit
14. What will be the value of $var below?

$var = true ? '1' : false ? '2' : '3';

Explanation

In the given code, the value of $var is determined using the ternary operator. The first condition is true, so the value '1' is assigned to $var. However, this is followed by another ternary operator where the condition is false. In this case, the value '2' is assigned to $var. Therefore, the final value of $var is '2'.

Submit
15. What gets printed?

$str = 'a\\b\n'; 

echo $str;

Explanation

\\ is a special case in single-quoted string literals, which gives a single \, \n is not interpolated in single-quoted string literals

Submit
View My Results

Quiz Review Timeline (Updated): Nov 16, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Nov 16, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Feb 16, 2011
    Quiz Created by
    Ksj786
Cancel
  • All
    All (15)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
What is correct syntax of connecting to a MySql database
Which of the following is true about GET & POST methods
Which of following statements will be used to fetch SINGLE...
Which of the following is NOT a valid PHP comparison operator?
Which of the following functions will be used to create a CURL...
What gets printed?class MyException extends Exception {}try { throw...
What is a correct way of defining constants in PHP
What will be printed?if ('2' == '02') { echo 'true';} else { echo...
Which of the following functions MUST be called AFTER using...
What will be printed?$a = array();if ($a[1]) null;echo count($a),...
Which function will you use to convert an HTML page into a format that...
What gets printed?<?php$RESULT = 11 + 011 + 0x11;echo...
What will be printed?$a = array( null => 'a', true => 'b', false...
What will be the value of $var below?$var = true ? '1' : false ? '2' :...
What gets printed?$str = 'a\\b\n'; echo $str;
Alert!

Advertisement