Advanced PHP Test Fiverr

What enctype is required for file uploads to work?

multipart/form-data
multipart
file
application/octect-stream
None of the above

What is the output of the following code?

<?

$a = (1 << 0);
$b = (1 << 1);


echo $b | $a;

?>

0
1
2
3
8
32
Syntax error

What will be the output of the following code?

<?

$a = (1 << 0);
$b = (1 << 1);


echo ($b | $a) << 2 ;

?>

1
2
3
4
8
12
Syntax error

Which of the following is the operator with the highest precedence?

+
instanceof
new
=
None of the above

What will be the output of the following code?

<?

$a = 0x01;
$b = 0x02;

printf ("%x", ($a << $b.$b));

?>

0
1
10000
400000
800000
Syntax error

Is the following code valid?

<?
$a = 5;

if ($a == 5):
    echo "Hello";
    echo "1";
else:
    echo "Not hello";
    echo "2";
endif;

?>

yes
no

In the following list, which one is not a string literal definition?

single quoted
heredoc syntax
nowdoc syntax
double quoted
All are string literals

Is the ||= operator present in PHP?

yes
no

What function would you use to delete a file?

delete ()
delete_file ()
unlink ()
fdelete ()
file_unlink ()

What is "?:"  ?

A logical operator
A comparison operator
A ternary operator
A bitwise operator
None of the above

What is the output of the following code?

echo '1'.print(2) + 3;

123
321
511
155
432

Will the trim function strip NULL bytes?

Yes
No

Is sizeof() function returns the number of elements in an array?

yes
no

Knowing that the output of the first echo is "2.5", what will be the output of the third echo on Unix Machine?

<?php
setlocale(LC_ALL, "fr_FR");
echo (string)2.5;
echo "\n";
echo (float)(string)2.5;
?>

2.5
25
2,5
2
Syntax error

What will be the output of the following code?

<?
<?php
$s = "Hello world!";
print $s[4];
?>

H
e
l
o
" " (a space)

What is the output of the following code?

<?php
echo 0x500;
?>

500
0x500
0500
1280
320

Is the PHP float type guaranteed to be 64 bit IEEE?

yes
no

With the following code, will the word Hello be displayed on screen?

<?
//?>Hello

yes
no

What is the string concatenation operator in PHP?

+
||
.
|||
None of the above

Should assert () be used to check user input?

yes
no

Which of the following is the operator with the lowest precedence?

new
and
, (comma)
=

What will be the output of the following code?

<?

$a = "print";
$a ("hello");

?>

print
hello
print hello
fatal error
None of the above

What will be the output of the following code?

<?

$a = "printf";
$a ("hello");

?>

hello
printf hello
printf
Syntax error
None of the above

What is the difference between the float and the double type in PHP?

the float is 32 bit while the double is 64 bit
the float represents only rational numbers
the float and the double are aliases for the same thing
None of the above

What is the size limit of strings in php?

1024 bytes
100 Mbytes
256 Kbytes
Can be as large as 2GB
None of the above

Which of the following is a type of array in PHP?

string
compound
callback
scalar
struct

Which statement will return true?

is_numeric ("200")
is_numeric ("20,0")
is_numeric ("$200")
is_numeric (".25e4")
None

What kind of regular expression does PHP include?

PCRE
Java REGEX
Ruby REGEX
None of the above

What is the output of the following code?
<?php
echo (2) . (3 * (print 3));
?>

233
29
329
323
Syntax error

What is the output of the following code?

<?

$a = 0;
echo ~$a;

?>

-1
0
1
10
Syntax error

What will be the output of the following code on a machine using IEEE 754 floats?

<?
print (19.6*100) !== (double)1960;
?>

0
1
Nothing
Syntax error

With what encoding does chr () work?

ASCII
UTF-8
UTF-16
Implementation dependent
None of the above

What will be the output of the following code?

<?
$a = 3;
print '$a';
?>

3
$a
Syntax error
None of the above

What is the associativity of +=?

left
right
it is non-associative

What will be the output of the following code?

<?php
print null == NULL;
?>

1
0

Which of the following is not a PHP magic constant?

__FUNCTION__
__TIME__
__FILE__
__NAMESPACE__
__CLASS__

What will be the output of the following code?

<?
$a = "NULL";
echo !empty ($a);
?>

0
1
TRUE
FALSE
NULL

What will be the output of the following code?

<?
$a = "Hello";
if (md5($a) === md5($a))
    print "True";
else
    print "False";
?>

True
False

What will be the output of the the following code?

<?
echo !!!0;
?>

1
Syntax error
0

What will be the output of the following code?

<?

$a = 0x01;
$b = 0x02;

echo $a === $b >> $a;

?>

0
1
Syntax error

What will be the output of the following code?

<?

echo false;

?>

0
false
FALSE
Nothing
Syntax error

Can feof () be used with a file opened by fsockopen () ?

yes
no

What is the precedence between && and "and"?

&& is higher than "and"
"and" is higher than &&
They have the same precedence
Those operators don't exist

What function should you use to join array elements with a glue string?

join_str
implode
connect
make_array
None of the above

What is the initial value of a integer and float variable?

0
1
NULL
Any value

What is the output of the following code?
<?
echo  0500;
?>

100
500
0500
320
None of the above

What will be the output of the following code?

<?

echo "5.0" == "5";

?>

0
1
5.0
Syntax error
None of the above

Which fopen option opens the file for reading and writing; placing the file pointer at the beginning of the file without truncating it.

r
r+
w
W+
a

What will be the output of the following code?

<?
$foo = 5 + "10 things";
print $foo;
?>

510 things
5 10 things
15 things
15
None of the above

What does the array_unshift () function do?

It shifts an element off the beginning of array
It shifts all bits of the array to the left
It undo what array_shift does
None of the above

What will be the output of the following code on a machine using IEEE 754 floats?

<?
print (19.6*100) !== (double)1960;
?>

0
1
Nothing
Syntax error

When comparing two arrays, what is the difference between == and === ?

== compares keys while === compares keys and values
=== also compares the order and types of the objects
=== compares the array references
They are identical
None of the above

Can PHP use Gettext?

yes
no

What will be the output of the following code?

<?php

$a = (1 << 0);
$b = (1 << $a);
$c = (1 << $b);

echo ($c || $b) << 2 * $a | $a;

?>

1
3
5
12
27
32
Syntax error

What will be the output of the following code?

<?
echo 5 * 6 / 2 + 2 * 3;
?>

1
20
21
23
34

What is empty () ?

A function
A language construct
A variable
A reference
None of the above

What does the array_combine (a, b) function do?

It appends b to a
It associates all keys of a with the values of b and returns a new array
It returns a new array with all values of b added to the values of a
It doesn't exist
None of the above

How can you check if a function exists?

With function_exists function
With has_function function
With $a = "function to check"; if ($a ()) // then function exists
It can't be done
None of the above

What function will you use to remove the first element of an array?

array_remove_first_element
array_shift
array_ltrim
a[0] = nil
None of the above

Advanced PHP Fiverr Test 2020