Friday, 7 November 2014

Freelancer php test answers part-2 for php developers

In part one we provided approx 100 php test answers. Here we are going to provide you more 100 php test answers that's why there is few chance to miss to get good result as me on php test on freelancing marketplace .
php developer test answers




Questionè Which bz library function returns bzip2 encoded data after compressing a given string?
bzcompress()
Questionè $count = $count + 8; can be written as:
$count += 8;
Questionè Which of the following is a special PHP variable that is used under HTTP Authentication?
$_PHP_AUTH_USER
Questionè XML is used for:
All of these
Data manipulation and storage
Display formatted data in a browser using style sheets.
transfer data between organizations
transfer data between software applications
Questionè Which kind of reference action allows you to have two variables referring to the same content?
Assign by reference.
Questionè ____________ describes the structure of a class of XML documents, specifying how elements are related and allowed.
Document Type Definition
Questionè Which files should be used to install cURL in an include directory?
easy.h and curl.h files
Questionè Which function returns the largest number that may be returned by rand()?
getrandmax()
Questionè Which parameter of setcookie() indicates that the cookie should only be transmitted over a secure HTTPS connection from the client?
secure
Questionè Which of the following can be included in a phar file?
All of these
a manifest describing the contents
a signature for verifying integrity
a stub
the file contents
Questionè The file handle argument in fread() allows you to specify ___________.
the number of bytes you wish to read
Questionè Which of the following will encrypt a password?
crypt($password);
Questionè Which of the following will connect to a data base using PEAR?
DB::connect(data_source_name);
Questionè Which of the following will return 1 if the Memcache session handler is available and 0 if not?
MEMCACHE_HAVE_SESSION
Questionè Which function opens a memcached server persistent connection?
Memcache::pconnect
Questionè Which of the following will send queries to a database using PEAR?
none of these
$dbconn=query(QUERY)
$dbconn=query->(QUERY)
DB::query(QUERY)
DB::query->(QUERY)
Questionè Which PHP library allows you to connect to and communicate with different types of servers using many different types of protocol?
cURL
Questionè Which configuration directive sets the size of data chunks for transfers?
memcache.chunk_size
Questionè What does PEAR stand for?
PHP Extension and Application Repository
Questionè Which of the following functions are used to encrypt passwords?
md5() and crypt()
Questionè Which cURL function sets an option on the given cURL session handle?
curl_setopt
Questionè Which of the following are examples of resource types in cURL?
cURL handle and a cURL multi handle
Questionè Which API treats XML as flow-through string data?
CAX
Questionè Which of the following is correct for adding a comment in a PHP script?
/* comment */
Questionè Which function returns (and caches) file permissions level?
fileperms(file)
Questionè What does XML mean?
eXtensible Markup Language
Questionè Which interface type allows you to chain methods of an object together?
Fluent Interfaces
Questionè Interfaces define a “contract” specifying that an object is capable of implementing a method ____________.
Specifying exactly how is to be done.
Questionè What is the correct way to create a function in PHP?
function yourFunction()
Questionè singleton design pattern
Sometimes it’s important to have only one instance for a class. For example, in a system there should be only one window manager (or only a file system or only a print spooler). Usually singletons are used for centralized management of internal or external resources and they provide a global point of access to themselves.
Questionè PHP magic constant
__LINE__
Questionè When a small window pops up in front of the browser asking your username and a password, what kind of Authentication is being used?
HTTP
Questionè In session management cookies are usually not used for:
logging the user in for the first time
Questionè Which function returns the version of the server?
Memcache::getVersion
Questionè Which character must be set in the $mode argument for fopen($file, $mode) to open a file for reading and writing?
r+;
Questionè Which of the following will open the file “time.txt” as readable?
fopen(“time.txt”,”r”);
Questionè Which of the following is the correct syntax to retrieve an object from the memcache module?
$result = $memcache->get(‘key’);
Questionè Which of these will perform integer rather than floating point division?
intval(x/y)
Questionè $count = $count * 3; can be written as:
$count *= 3;
Questionè What is the correct way to add 1 to the $counter variable?
$counter++;
Questionè Which operator appends the argument on the right side to the argument on the left side?
.=
Questionè With the ________ bitwise operator, the bits set in $a are not set, and the not set bits are then set.
~
Questionè Which bitwise operator will set the bits that are set in either $a or $b.
” | “
Questionè Which of the following allows you to set a user-defined exception handler function?
set_exception_handler
Questionè In an object method, which of the following is always a reference to the caller object?
$this
Questionè Which kind of reference is used by creating a local variable in a function and a variable in the calling scope referencing the same content?
Assign by reference.
Questionè Which of the following returns the remainder of $a divided by $b?
$a % $b
Questionè What PHP operator is used to access methods and properties of objects?
” -> “
Questionè _____________ attempts to establish an FTP connection to a remote server by emulating an FTP client.
FTP ftp_connect()
Questionè Which of the following will print “Hi ” followed a name argument passed to the function?
function sayHi ($name){ print “Hi $name”; }
Questionè A special method to perform any activity required to instantiate an object is called a(n) __________.
Constructor
Questionè Which POSIX character matches zero or more instances of the previous regular expression?
*
Questionè Which POSIX character matches any character?
.
Questionè If an exception is not caught, a PHP Fatal Error will be issued with what message?
“Uncaught Exception …”
Questionè Which statement retrieves the value of a function after it is called?
return
Questionè Which “magic” constant implemented inside an include, returns the directory of the included file.
_DIR_
Questionè Which function returns a string containing a byte-stream representation of any value that can be stored in PHP?
serialize()
Questionè How do you write “Hello World 2010″ in PHP?
echo “Hello World 2010″;
Questionè Which file mode will read and write to the end of an existing file or create a new file?
“a+”
Questionè Which server verifies the name password and mail spool location?
SMTP Server
Questionè What does MTA stand for?
Mail Transfer Agent
Questionè The agent used to collect and access the mail spool is called:
Mail Transfer Agent – not sure
Questionè __________ is an extension that provides a way to put entire PHP applications into a single file called PHP Archive for easy distribution and installation.
phar
Questionè Which function is used to connect to a database using Authentication by SQL Database Query?
@mysql_connect(“localhost”,”databaseuser”,”password”)
Questionè Which function takes a single argument and returns the largest integer that is less or equal to that argument?
floor()
Questionè Which function takes a single argument and returns the smallest integer that is greater than or equal to that argument?
ceil()
Questionè What is the expression for returning the square root of 2?
sqrt(2)
Questionè Which Perl Compatible Regex function takes a regex pattern and an array and returns an array of the elements of the input array that matched the pattern?
preg_grep
Questionè Protected members are available to:
The class itself and the classes that inherit from it
Questionè Which of these variables has an illegal name?
$your-Var
Questionè A(n) _____________ is an ordered map that assigns values to keys:
array
Questionè What PHP type represents a series of characters?
string
Questionè Which command returns the filename component of a path?
string basename ( string $path [, string $suffix ] )
Questionè Which of the following is NOT a correct way to specify a string?
alfanum syntax
Strings in PHP can be specified in four different ways: single quoted, double quoted, heredoc syntax and (since PHP 5.3.0) nowdoc syntax
Questionè Which of the following is the correct way to create a reference to a global variable?
$var =& $GLOBALS["var"];
Questionè Which of the following provides a means to access the same content on PHP variables by different names?
References
Questionè Which PHP operator is used to concatenate strings?
“.”
Questionè What PHP token that allows access to static, constant, and overridden properties or methods of a class?
::
Questionè Which PHP operator type returns the result of string arguments?)
String operators
Questionè Which of these restrictions applies to namespace implementation?
Nested namespaces are prohibited.
Questionè What term applies to an identifier with a namespace separator that begins with a namespace separator, such as \Foo\Bar?
Fully qualified name.
Questionè Which of the following objects lets you create code which specifies which methods a class must implement, without specifying how the objects are handled?
Interfaces
Questionè Which Interface allows you to use a design pattern that is characteristically changed with the instantiation of objects?
Instantation Design Interface
Questionè Which POSIX character matches the beginning of a string only?
^
Questionè Which of the following are two broad classes of regular expressions that PHP works with?
POSIX and PHP-compatible regex
Questionè Which statement allows you to end a loop?
break
Questionè This “magic” constant refers to the name of the current namespace and it is defined in compile-time
_NAMESPACE_
Questionè What is the name for instances of a class that contain all the internal data and state information need for the application to run
Objects
Questionè ___________ allows a class to be defined as being a member of more than one category of classes
Polymorphism
Questionè Instantiate an object Demo: require_once(‘class.Demo.php’);
$objDemo = new Demo();
Questionè Which PHP function sets file modification time or creates a file if it does not exist?
touch(file, [time])
Questionè Which of these PHP file open modes are valid for the specified conditions?
All of these
Questionè The ____________ function can be used in combination with the PHP header() construct to assemble and send file downloads.
fpassthru
Questionè Which function returns (and caches) the time a file was last accessed?
fileatime(file)
Questionè How do you modify the php.ini file to have sessions work correctly on windows?
change session.save_path = /tmp to session.save_path=C:/temp
Questionè Which function gets statistics from all servers in a pool?
Memcache::getExtendedStats
Questionè Which of the following functions returns a Boolean value after attempting to send a message?
mail()
Questionè Which of the following is the correct way to connect to a MySQL database?
mysql_connect(“localhost”);
Questionè On the additional header that PHP allows you to include on an email you can add:
All of these
Content-transfer-encoding
Content-type
MIME version
X-mailer and version number
Questionè __________ is the same as setcookie() but the cookie value will not be automatically urlencoded when sent to the browser.
setrawcookie()
Questionè Which function enables automatic compression of large values?
Memcache::setCompressThreshold
Questionè The ability to define a class of one kind as being a subtype of a different kind of class is called:
Inheritance
Questionè Which of the following allows you to express any real number?
double




2 comments:

  1. Fahimshakir Freelancer Developer from Delhi-India,You can provide me part time work for Home,Part Time Developer/Freelancer For PHP , WordPress, Magento, Opencart, Shopify, Codeigniter, Website Maintenance in Delhi -india, www.fahimshakir.com

    ReplyDelete
  2. I think that more relevant answers are here: https://exams.sen.pm/freelancercom/freelancercom-8/

    ReplyDelete