PHP Operators Aptitude Questions and Answers

PHP Operators Aptitude Questions and Answers: This section contains aptitude questions and answers on PHP Operators.
Submitted by Nidhi, on May 23, 2020

This section contains Aptitude Questions and Answers on PHP Operators.

1) Which of the following types of operators are used in PHP?
  1. Arithmetic Operators
  2. Logical Operators
  3. Array Operators
  4. String Operators

Options:

  1. A and B
  2. C and D
  3. A, B, and C
  4. A, B, C, and D

2) What is the correct output of the given code snippets?
<?php
	$NUM1 = 3;  
	$NUM2 = 4;
    
	$NUM3 = $NUM1 ** $NUM2;
	echo $NUM3;
?>  
  1. 12
  2. 81
  3. Garbage value
  4. None of the above

3) The "**" operator belongs to which category of operators?
  1. Arithmetic operator
  2. Logical operator
  3. Comparison operator
  4. Conditional operator

4) Which of the following are comparison operators in PHP?
  1. ==
  2. !=
  3. ===
  4. < = >

Options:

  1. A and B
  2. C and D
  3. A, B, and C
  4. A, B, C, and D

5) What is the correct output of given code snippets?
<?php
	$NUM1 = 3;  
	$NUM2 = 4;
    
    var_dump($NUM1<>$NUM2);
?>  
  1. bool(true)
  2. bool(false)
  3. Error
  4. None of the above

6) What is the correct output of given code snippets?
<?php
	$NUM1 = 3;  
	$NUM2 = 4;
    
    var_dump($NUM1!==$NUM2);
?>  
  1. bool(true)
  2. bool(false)
  3. Error
  4. None of the above

7) What is the correct output of given code snippets?
<?php
    $NUM1 = 3;  
    $NUM2 = 4;
    
    var_dump($NUM1<=>$NUM2);
?>
  1. int(0)
  2. int(-1)
  3. int(1)
  4. Error

8) Which of the following operator is not available in PHP?
<?php  
	$num = "Hello";
	var_dump($num);
?>
  1. Dot (.)
  2. =
  3. .=
  4. @

9) What is the correct output of given code snippets?
<?php
   echo $country = $country ?? "india";
?>  
  1. india
  2. garbage value
  3. Error
  4. None of the above

10) Which of the following operator is known as null coalescing in PHP?
  1. < == >
  2. ===
  3. ??
  4. ?






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.