PHP Operator MCQs

PHP Operator MCQs : This section focuses on "Operator" in PHP. These Multiple Choice Questions (mcq) should be practiced to improve the PHP skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.

1. Which of the following is type of operators in PHP?

A. Arithmetic Operators
B. Comparison Operators
C. Assignment Operators
D. All of the above

View Answer


2. Assume variable A holds 10 and variable B holds 20 then output for Arithmetic Addition Operators is?

A. 10
B. 20
C. 30
D. 40

View Answer


3. Operator ++ indicate?

A. Decrement operator
B. Increment operator
C. Modulus Operator
D. None of the above

View Answer


4. Assume variable A holds 10 and variable B holds 20 then output of A == B is ?

A. TRUE
B. FALSE
C. Can be true or false
D. Can not say

View Answer


5. Operator ? Means?

A. Assignment Operators
B. Modulus AND assignment operator
C. Conditional Operator
D. Divide AND assignment operator

View Answer


6. Associativity of category unary is?

A. Left to right
B. Left to left
C. Right to right
D. Right to left

View Answer


7. Logical AND operator : If both the operands are true then condition becomes true.

A. TRUE
B. FALSE
C. Can be true or false
D. Can not say

View Answer


8. What will be the output of the following PHP code?

echo $x-- != ++$x;

A. 1
B. 0
C. error
D. no output

View Answer


9. What will be the output of the following PHP code?

$y = 2;
if (--$y == 2 || $y xor --$y)
{
    echo $y;
}

A. 1
B. 0
C. 2
D. no output

View Answer


10. What will be the output of the following PHP code?

$i = 0;
while(++$i || --$i)
{   
    print $i;
}

A. 1
B. 01234567891011121314…infinitely
C. 1234567891011121314….infinitely
D. 0

View Answer




Discussion


* You must be logged in to add comment.