Does PHP 5 support exceptions? | PHP MCQs

a. Yes
b. No

Ans: a

Which of the following is a PHP resource? | PHP MCQs

a. Domxml document
b. Odbc link
c. File
d. All of the above

Ans: d

Which of the following are useful for method overloading? | PHP MCQs

a. __call, __get, __set
b. _get,_set,_load
c. __get,__set,__load
d. __overload

Ans: a

You have defined three variables $to, $subject and $body to send an email. Which of the following methods would you use for sending an email? | PHP MCQs

a. mail($to,$subject,$body)
b. sendmail($to,$subject,$body)
c. mail(to,subject,body)
d. sendmail(to,subject,body)

Ans: a

Which of the following is not true regarding XForms? | PHP MCQs

a. PHP provides support for XForm
b. It can be used on PDF documents
c. The data is sent in XML format
d. The action and method parameters are defined in the body
Ans: d

PHP Multiple choice questions | What will be the output of following code?

$a = 10;
echo 'Value of a = $a';
a. Value of a = 10
b. Value of a = $a
c. Undefined
d. Syntax Error

Ans: a

How would you start a session? | PHP MCQs

a. session(start);
b. session();
c. session_start();
d. begin_session();

Ans: c


Which of the following functions output text? | PHP MCQs

a. echo()
b. print()
c. println()
d. display()

Ans: a,b

Which of the following is correct with regard to echo and print? | PHP MCQs

a. echo is a construct and print is a function
b. echo is a function and print is a construct
c. Both are functions
d. Both are constructs

Ans: d

You need to count the number of parameters given in the URL by a POST operation. The correct way is: | PHP MCQs

a. count($POST_VARS);
b. count($POST_VARS_PARAM);
c. count($_POST);
d. count($HTTP_POST_PARAM);

Ans: c


In your PHP application you need to open a file. You want the application to issue a warning and continue execution, in case the file is not found. The ideal function to be used is: | PHP MCQs

a. include()
b. require()
c. nowarn()
d. getFile(false)

Ans: a


What will be the output of the following code? | PHP MCQs echo 30*5 . 7;

a. 150.7
b. 1507
c. 150.7
d. you can't concatenate integers
e. error will occur

Ans: b

Which of the following is not supported in PHP5? | PHP MCQs

a. Type Hinting
b. Reflection
c. Magic Methods
d. Multiple Inheritance
e. Object Cloning

Ans: d

You wrote the following script to check of the right category: | PHP MCQs

Correct category!
Incorrect category!
What will be the output of the program if value of 'cate' remains 5?
a. Correct category!
b. Incorrect category!
c. Error due to use of invalid operator in line 6:'if ($cate==5)'
d. Error due to incorrect syntax at line 8, 10, 12 and 14

Ans: a

Which of the following regular expressions can be used to check the validity of an e-mail addresses? | PHP MCQs

a. ^[^@ ]+@[^@ ]+.[^@ ]+$
b. ^[^@ ]+@[^@ ]+.[^@ ]+$
c. $[^@ ]+@[^@ ]+.[^@ ]+^
d. $[^@ ]+@[^@ ]+.[^@ ]+^

Ans: b

The following php variables are declared: | PHP MCQs

$company = 'ABS Ltd';
$$company = ',Sydney';
Which of the following is not a correct way of printing 'ABS Ltd,Sydney'?
a. echo '$company $$company';
b. echo '$company ${$company}';
c. echo '$company ${'ABS Ltd'}';
d. echo '$company {$$company}';

Ans: a


How would you store order number (34) in an 'OrderCookie'? | PHP MCQs

a. setcookie('OrderCookie',34);
b. makeCookie('OrderCookie',34);
c. Cookie('OrderCookie',34);
d. OrderCookie(34);

Ans: a

Which of the following is used to maintain the value of a variable over different pages? | PHP MCQs

a. static
b. global
c. session_register
d. None of the above

Ans: c

Which of the following variable declarations within a class is invalid in PHP5? | PHP MCQs

a. private $type = 'moderate';
b. internal $term= 3;
c. public $amnt = '500';
d. protected $name = 'Quantas Private Limited';

Ans: b

Blogger news