Category: mcqphp

MCQ Question


MCQ Question Php:-Hi Readers, In this blog, I will provide you most frequently asked interview question on PHP with an answer.I have already provided some question on PHP in the previous blog also.

MCQ Question Php

Here are some most asked MCQ Question Php:- 


Q1 what is the latest version of php language ?

A1- Latest Version of php language is PHP 7.0.2

Q2-How to write a string ‘Mcq’s question ‘ in php language?

A2-In php language,

<?php $string=’Mcq’s question’ ;   echo $string; ?>

Q3-How to unset a session variable in php?

A3- unset ($_SESSION[‘varname’]);

Q4-How to convert string variable to int in php language?


A4
-$string = ‘400’; $int = (int)$string;

Q5-How to check variable is string or not ?

A5-To check string variable type we use is_string($parameter) function.

Q6-How to define function in php language?

A6-
<?php
function Mcqs()
{
echo ‘Mcq’s Question on php’;

}

?>

Q7-How to define function with parameter in php language?

A7-

<?php
function Mcqs($param1,$param2,etc….)
{
echo ‘Mcq’s Question on php’;

}

?>

Q8-How to disclose a active connection in php?

A8-

<?php

mysql_close($conctionlink);

?>

Q9-Official website of Php language ?

A9-http://php.net/

Q10-How to make connection in php language?

A10-

 <?php  $conncetionlink = mysql_connect('localhost', 'mysql_user', 'mysql_password');  if (!$conncetionlink ) {     die('connection not established: ' . mysql_error());  } 
echo 'Congrtats ! Connected successfully';
 mysql_close($conncetionlink );  ?> 

Q11- How can we determine php variable is empty or not?

A11-To determine php variable is empty.we use

<?php $variable = 0; // Evaluates to true because $var is empty if (empty($variable))  {   
echo 'php function to check $variable is either 0, empty, or not set at all';  }  ?> 

Q12-To determine a php variable is SET or NOT then we use which function of php?

A12- We can determine a php variable is set or not by using following code.
<?php

$setvariable = '';

// This will evaluate to TRUE so
 the text will be printed.
if (isset($setvariable)) {
    echo "This variable  is set so 
I will print in this code.";
} ?>

Feedback

I hope you enjoyed this post about “MCQ’s Question Php” and provide your valuable feedback and share your problem in Technical Forum.

MCQ question PHP:- Hi Readers, In this tutorials, we have some objective questions on PHP to prepare fresher for grab jobs and it also helps them to check knowledge on PHP.I have Mentioned 15 Multiple Choice Question of PHP with their answers.Every answer of MCQ question PHP is marked with bold.Each MCQ on PHP has four options and one of them is true.Here we start topic on  MCQ question PHP

MCQ question PHP (Multiple Choice Question of PHP with answer)

1.PHP is …….?

A.Server side scripting language.

B.client side

C.both side

D.None of the above

2.USE of echo in PHP?

A.to print string

B.to call Function

C.To define Constant

D.None of the above

3.PHP stands for

A.Hypertext Preprocessor

B.Hypertext Postprocessor

C.Hyper past

D.None of the above

4.PHP Scripts tag syntax are :-

A.<?p  ?>

B.<?php ?>

C.</pgp ?>

D.None of the above

5.In PHP, every statement are ended with

A.:-

B.;

C.+

D.-

6.How can we declare a variable global using which keyword?

A.static

B.common

C.global.

D.NOT

7.which keyword is used to define constant in PHP

A.contant

B.define();

C.clear

D.NOT

8.How to assign a variable in PHP?

A.$a=4;

B.#a=4;

C.*a=4;

D.@==4;

9.How can we declare an array in PHP?

A.$arr = array(‘ap’, ‘gr’, ‘le’);

B.$aa=(‘c’,’c’,’c’);

C.$array=arr(‘c’,’c’,’c’);

D.ALL above

10.Which function is used to count elements in array or object in PHP?

A.Count()

B.Number()

C.IScount()

D.NONE of above

11.How can we include a file in PHP?

A.<?php include(‘file.php’);?>

B.<?php copy(‘file.php’);?>

C.<?php add(‘file.php’);?>

D.NONE of above

12.Which function is used to start a session in PHP?

A.session_add();

B.session_start();

C.start();

D.All of the above

13.In PHP, How we can create a function or syntax to create or define a function?

A.<?php  function functionName() { ………}  ?>

B.<?php  fun functionName() { ………}  ?>

C<?php   functionName() { ………}  ?>

D.<?php  function () { ………}  ?>

I hope you would like this session on  MCQ question PHP -SET 1

PHP interview questions and answers for freshers ?

PHP interview questions and answers for freshers?

PHP interview questions and answers for freshers? :- To clear PHP Technical interview round, A candidate should be prepared for what type of question can be asked by the interviewer, We have provided a list of questions which are commonly asked by Companies.

PHP interview questions can help you to test knowledge of your programming skills in PHP, Answers to PHP Questions are also explained step by stepwise.

1 > What is PHP?

Php stands for hypertext preprocessor.It is a Server Side Scripting Language used to make websites and Web Applications.Php is also an Object Programming Language.Various types of CMS are built by using PHP like WordPress, Drupal, and Joomla. Zend Framework and Codeigniter Framework are used to built Web Application using MVC (Model Controller View ) architecture.

2>How to include a file in PHP Programming?

To include a file in  “include() ” or “require()” or include_once ?> function with right file name as a parameter .

Ex :- <?php  include(images/abc.jpg)  ?>

3> What’s the difference between include and require?

When you declare require() function in PHP, it will cause a fatal error and stop the execution of the PHP script. In Second Case, if the file is not found by include(), a warning will be issued, but execution will continue.

4>How to Declare Function in PHP?

To declare a function in php you  should follow following php syntax.Php function name always declared with parenthesis;

Ex :- <?php

InterviewAnswersPhp()

{

echo ‘ PHP interview questions and answers for freshers‘;

}

?>

5>Which function of PHP is used to check the length of string ?

To check the length of the string, We can use strlen() function by passing a string variable as a parameter.

Ex :- <?php

$str_length=”Php”;

echo strlen($str_length); 

?>

6: How to declare a variable in  PHP language ?

In php langauge, $ is used to declare a variable in PHP language.

Ex :- <?php

$declare_var=”Php”;

echo strlen($str_length); 

?>

7. How can we send data from HTML Form to Server ?

By using METHOD Attribute of HTML .It determines how to send form data into server by  using two method GET and POST.HTML Form takes default GET Method if we don’t specify

Ex:- <html>

<head> </head>

<form name=”php-interview” method=”POST”>

<input type =”text” />

<input type=”submit”>

</form>

</html>

8 >Why we use of isset()  function in php ?

isset() is used to check variable has a value means it is set and is not NULL.

9> If we have to stop the script then which function should we use ?

To stop the script we use exit() function in PHP.

10> How can we set any PHP page as a homepage in Web Application?

To set Any page as a home page then we should name a file as index.php/