## PHP Quiz for Freshers with one Years of experience

Dear Candidate,

WebSpecia wishes you all the best for this PHP quiz for Freshers. Go ahead and test how much PHP you have learnt.

This quiz is designed to have an overview of the knowledge of a PHP fresher. If you have one or less than one year of experience, this is the best way to know how deeply you know about the concept of PHP programming.

Go head, fill your name and email ID to begin with the questions.

NameEmail
What does PHP stand for?
PHP is a closed source software?
TRUE/FALSE: PHP is a server side language.
What is the correct way to end a PHP statement?
PHP server scripts are surrounded by delimiters, which?
How do you write "Hello World" in PHP
The PHP syntax is most similar to:
How do you get information from a form that is submitted using the "get" method?
When using the POST method, variables are displayed in the URL:
In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings:
Include files must have the file extension ".inc"
What is the correct way to include the file "time.inc" ?

What is the correct way to create a function in PHP?

What is the correct way to open the file "time.txt" as readable?
PHP allows you to send emails directly from a script
What is the correct way to add 1 to the $count variable? What is a correct way to add a comment in PHP? PHP can be run on Microsoft Windows IIS(Internet Information Server): The die() and exit() functions do the exact same thing. Which one of these variables has an illegal name? The setcookie() function must appear BEFORE the tag. In PHP, the only way to output text is with echo. How do you create an array in PHP? The if statement is used to execute some code only if a specified condition is true Which operator is used to check if two values are equal and of same data type? ### Leaderboard for WebSpecia PHP Quiz (Fresher) 1. Dev-130 Points 2. ani-120 Points 3. -115 Points 4. subbarayal-105 Points 5. Pritam Shastrakar-100 Points ## Basic PHP Interview questions with answers for Freshers Cracking a PHP Interview at a reputed company requires strong knowledge of trending topics in the language. Freshers are asked basic PHP questions that are needed while working on live projects. So Interviewee must have the knowledge of the popular and trending topics of the industry. Here we have summerise the most commonly asked PHP interview questions for freshers along with Interview tips. ## Most common PHP Interview Questions for freshers If you are applying as a fresher you must be clear with the following questions/topics in order to qualify. 1. What is PHP? Answer: • PHP or “PHP: Hypertext Preprocessor” is a server side scripting language. • It is usesd to develop web applications. • PHP is an Object Oriented Programming Language (OOP). • Apart from dynamic websites, PHP is used to create many popular CMS such as WordPress, OSCommerce, Joomla etc. (You might get your next question on OOP, which is a very important topic. I have described it below) 2. Tell me some popular usages of PHP? Below are some common uses of PHP − • You add, delete, modify elements within your database thru PHP. • PHP performs system functions, i.e. from files on a system it can create, open, read, write, and close them. • It can access cookies variables and set cookies. • By using PHP, you can restrict users to access some pages of your website. • PHP can encrypt data. • PHP can handle forms, i.e. gather data from files, save data to a file, thru email you can send data, return data to the user. 3. What is echo in PHP and tell me the difference between echo & print? • echo & print both are used to get output. echo has no return value where as print has a return value of 1. • echo is faster than print • echo can take multiple parameters where as print takes only one argument • print is not actually a real function, It is a language construct. So you can use with out parentheses with its argument list. Example print(‘PHP Interview questions’); print ‘Job Interview ‘); The same is not true for echo. • Read more on print & echo here 4. Define include() & require() and their features. • We can include a file using “include() ” or “require()” function with file path as its parameter: such as : include (filename.php); or require(myfile.php); • include() and require() both are used to include a file while executing the current file. • If the include file is missing, the script will show warning message on execution but if we use require(), the script will show a fatal error on execution. 5. Explain GET & POST method in forms? • Both GET & POST methods are used to transfer data on a form. • Using GET method, you can only send 1024 bytes of data, however POST method can transfer any amount of data. • POST is secure than GET. As when you use GET method, data is displayed in the URL section. That is the reason we donot use GET while sending important information (such as passwords). • GET method creates a bookmarkable URL where POST doesn’t • You can set cache while using GET but the same is untrue while using POST. ## Tips from Interviewers I have been into the industry for over 6 years & as an interviewer, the goal is to check the concept of the candidate by asking relevent questions on different topics. – Piyush Gupta, Senior Developer For PHP developers, the Interview starts with some basic questions but we cover all the aspects of PHP programming to know how deep your knowledge is. So donot lose hope when you find some tough questions from interviewer. –Deepak Kumar, PHP Developer #### Recent search terms: • which of the questions are asked in interview to php freshers in it field? • interview questions on php fresh • php fresher interview question • Php interview q for f • php interview question answer ## How to make pyramid with while loop in PHP We need to print a Pyramid which prints stars so that a pryamid could be printed. To do so, we need to print 1 star in the first line and 2 in the second line, 3 in the thrid line and so on. We also need to keep it in mind that the star will be printed in the center, so that it could form a triangular shape of pyramid. <?php$i=0;
while($i<=10){ echo "&nbsp;&nbsp;";$c--;
}
$d = 1; while($d<=$i){ echo "*&nbsp;&nbsp";$d++;
}
echo "&nbsp;&nbsp;";
}
?>



## Explanation

There are three loops used in this program. First one is the outer one which is i, to create the horizontal row second one is $c which prints only spaces The third one is$d which prints stars according to demand.

The $c &$d are inside the $i loop, for every$i loop which prints horizontal line, the $c and$d will run just once to print space and * and then the <br/ >tag in the end will run once so that the cursor will go down to print another line.

#### Recent search terms:

• how to print pyramid using do whilw loop in php
• triangle in while loop in php