Thursday 30 October 2014

Update Freelancer PHP Test Question and Answer

Question No 01 - 50

1) Which function returns (and caches) the owner ID number?
fileowner()

2) Which of the following is the correct way to implement a do-while loop?
$j=0; do { print "$j"; } while ($j > 0);

3)Which statement will skip the rest of the current loop iteration and continue execution at the beginning of next iteration.
continue

4) Which of the following is correct to show a message for an exception?
throw new Exception ("Invalid data");

5) What term refers to the ability to shorten Extra_Long_Names improving readability of source code?
Aliasing

6) Which operator performs the same function as x=x%y?
%=

7)The control error operator is:
@

8)Which of the following is the not equal operator?
!=

9) What are the levels of visibility possible for a variable or method?
Public, Private and Protected

10) Which Perl Compatible Regex function takes a regex pattern as first argument, a string to match against as second argument, and an optional array variable for returned matches?
preg_grep

11) Which Perl Compatible Regex function inserts escape characters into strings that are intended for use as regex patterns.
preg_quote

12)Which of the following shifts the bits of $a $b steps to the left?
$a << $b

13) What PHP function returns the arctangent in radians of a numerical argument?
atan()
14) Which function is used to start tracking a user?
session_start();
15) What statement will delete session files?
session_destroy();
16) How are sessions tracked on PHP With code rewriting using the PHP Session reference variable
17) Which function changes server parameters and status at runtime?
Memcache::setServerParams
18) Which function forces a write of all buffered output to the resource pointed to by the file handle?
fflush
19) Single-line comments in PHP use the following:
 //
20) The ability of a class to protect access to its internal member variables is called:
encapsulation
21) You can use what function in order to check if a constant is set?
defined();
22) Which of these will perform integer rather than floating point division?
intval(x/y);
23) ______________ is a mechanism for storing data in the remote browser and thus tracking or identifying return users.
Cookies
24) Using the Zip Archive Class, which of the following will include a file to a ZIP archive from a given path?
zipArchive::addFile
25) Which of the following is an example of predefined cURL constant?
All of these CURLAUTH_ANYSAFE CURLFTPSSL_NONE CURLOPT_FILE CURLOPT_VERBOSE
26) Which of the following refers to a set of functions that allows you have access to multiple supported databases without writing your own wrapper functions?
PHP DBX
27) Which of the following is the correct syntax to retrieve an object from the memcache module?
 $result = $memcache->get('key');
28) _____________ attempts to establish an FTP connection to a remote server by emulating an FTP client.
FTP ftp_connect()

29) Which of the following will open the file "time.txt" as readable?
fopen("time.txt","r");

30) Which character must be set in the $mode argument for fopen($file, $mode) to open a file for reading and writing?
r+;

31) Which of the following is the correct way to implement a "for" control structure?
for($i=0; $i<10; $i++){ // do something }

32) Which of the following is the only keyword that can be written before the namespace at the top of the file?
declare
33) What is the correct way to access the property of a PHP object?
$obj->property
34) Select the convention sign used to indicate private variables and functions:
_ for $_name

35) Arrays can be sorted with which of the following functions?
arsort(), ksort() and uksort();

36) Private members are accessible to:
The class itself and the classes that inherit from it

37) Which function returns the square root of its argument, with number of decimal places set by the optional scale factor?
bcsqrt()

38) What 2 types of parsers are used in PHP?
39) What does MIME stand for?
Multipurpose Internet Mail Extensions

40) Which configuration directive defines a comma separated list of server urls to use for session storage?
session.save_path

41) Which function gets permissions for the given file?
fileperms

42) Which function checks whether a file or directory exists?
file_exists

43) PHP constants:
All of these

Do not have a dollar sign ($) before them.
May be defined and accessed anywhere without regard to variable scoping rules
May not be redefined or undefined once they have been set.
May only evaluate to scalar values.

44) Which PHP operator type allows evaluation and manipulation of specific bits within an integer?
Bitwise operators

45) At compile time static values are bound with
a name

46) Which Perl Compatible Regex character will cause any special character to be treated as a simple matching character?
\

47) Session files should not be stored on a directory viewable from the Web server because:
Malicious users may access other users' login details

48) Which API reads in an XML file and creates a "walkable" object tree in memory, so it can be used in large documents?
DOM

49) What APIs are used for handling XML documents?
Document Object Model (DOM) and Simple API for XML (SAX)

50) ________________ tests for the end of file on a file pointer.
feof()

0 comments:

Post a Comment