please answer the following questions related to php4 since i am a beginer.
Which one of the following operators has the highest precedence?
Choice 1
^
Choice 2
Xor
Choice 3
And
Choice 4
&&
Choice 5
Or
$x = 5;
$y = 4;
$z = $x % $y; What would be the value of $z after executing the code above?
Choice 1
Choice 2
1
Choice 3
1.25
Choice 4
9
Choice 5
20
Which one of the following database types does NOT support a special numerical datatype for storing monetary (currency) values?
Choice 1
PostgreSQL
Choice 2
Oracle
Choice 3
MySQL
Choice 4
Access
Choice 5
SQL Server
When using sessions, which one of the following is the only cookie that is sent to the user by default?
Choice 1
$VALID
Choice 2
$SETCOOKIE
Choice 3
$COOKIE
Choice 4
$PHPSESSID
Choice 5
$COUNT
Sample Code 1) <?php
2) Function finger ($host, $user= "", $port=80) {
3) $rc=fsockopen($host,$port);
4) fputs($rc, "$user\n");
5) while (!feof($rc)) { $str .= fgets($rc,128); }
6) fclose($rc);
7) return $str;
8) }
9) ?>
What is the problem with the above code?
Choice 1 The port in line two should be 25.
Choice 2 The port in line two should be 79.
Choice 3 The port in line two should be 125.
Choice 4 The port in line two should be 443.
Choice 5 The port in line two should NOT be specified.
)
Which one of the following security configuration options can you set to ensure PHP will NOT parse files outside of the root directory when running in safe mode?
Choice 1
auto_prepend_file
Choice 2
open_basedir
Choice 3
doc_root
Choice 4
engine
Choice 5
include_path
function getFileList( $dirname="." ) {
$flist = array();
$dir = opendir( $dirname );
if ( ! $dir ) { return null; }
while( $file = readdir( $dir ) ) {
if ( ereg( ".$", $file ) || ereg( "..$", $file ) ) continue;
$files[] = $file;
}
return $files;
} In the code above, what directory will be used if no directory is specified?
Choice 1
Current working location
Choice 2
Default as set during configuration
Choice 3
Root of the operating system
Choice 4
One must be specified
Choice 5
Root of the webserver
$var="Rules";
echo "PHP\n$var\n"; What is the meaning of \n in the above code?
Choice 1
Dollar Sign
Choice 2
New Line
Choice 3
Carriage Return
Choice 4
Tab
Choice 5
Backslash
1) if (!isset(#PHP_AUTH_USER)) {
2) header($headerstring);
3) header('HTTP/1.0 401 Unauthorized');
4) echo $badpass;
5) exit;
6) } Which line in the code above contains an error?
Choice 1
Line 1
Choice 2
Line 2
Choice 3
Line 3
Choice 4
Line 4
<?
$userIP = getenv("REMOTE_ADDR");
if ($userIP != "127.0.0.1") {
echo "User is not local...";
} else {
echo "User has authorization...";
}
?> Based on the above code, which one of the following is true?
Choice 1
Only administrators on the internal network can view this site.
Choice 2
Only users viewing the site from the webserver itself can view the contents of this site.
Choice 3
Only local network users on the initial subnet can view this site.
Choice 4
Only remote gateway users can view this site.
Choice 5
Only local network users can view this site.
1) if ($age == "5") {
2) echo "Age equals 5"
3) } else {
4) echo "Age does not equal 5";
5) } What is the problem with the above code?
Choice 1
Line two should have a ; on the end.
Choice 2
Line four should NOT have a ; on the end.
Choice 3
Line five should have }} instead of }.
Choice 4
Line three should be elseif instead of else.
Choice 5
Line one should have && on the end.
while (list($var, $value) = each($HTTP_POST_VARS)) {
echo "$var = $value<br>n";
} Based on the above code, which one of the following will be the result when it is executed?
Choice 1
PHP will use GD support when dealing with post method variables.
Choice 2
Post method variables will be handled.
Choice 3
The maximum execution time for a script will be lengthened for post method variables.
Choice 4
PHP will use your freetype library for post method variables.
Choice 5
The maximum file size barrier will be ignored for post method variables.
1) <?
2) if (!isset($user_id)) {
3) $token = md5(uniqid(rand()))
4) setcookie("user_id",$token,time()+86400,"/",".yourdomain.com");
5) }
6) ?> What is the problem with the above code?
Choice 1
Line three should have a ; on the end.
Choice 2
Line three should have a : on the end.
Choice 3
Line three should have a { on the end.
Choice 4
Line three should have a [ on the end.
Choice 5
Line three should have a ++ on the end.
$example = pow(10, 2); // = 100 When the above function is used, what is the result?
Choice 1
The arc tangent will be calculated.
Choice 2
Integer returned will be raised to the power of a number.
Choice 3
The binary XOR is executed.
Choice 4
Checkbox values will be calculated.
Choice 5
A number is exponentiated.
When using PHP for database connectivity, which one of the following SQL commands permanently removes tables and fields?
Choice 1
DROP
Choice 2
UPDATE
Choice 3
SELECT
Choice 4
ALTER
Choice 5
DELETE
You are installing PHP on your Windows NT Server that is running IIS 4.0. You have extracted the distribution file of your choice into a directory and have copied php3.ini-dist to the %Windows% directory.Based on the above, what must you now rename php3.ini-dist to in order to proceed?
Choice 1
php3.dist
Choice 2
php3.dll
Choice 3
php3.ini
Choice 4
php3.html
Choice 5
php3.txt
$var = "PHP";
$$var = "Rules"; Using the above code as a reference, which one of the following choices is a valid variable name?
Choice 1
$PHP
Choice 2
$"Rules PHP"
Choice 3
$Rules
Choice 4
$PHPRules
Choice 5
$PHP Rules
1) <?
2) $files = array("foo","bar");
3) while (list(,$file)=each($files)) {
4) require($file);
5) }
6) > What is the problem in the above code?
Choice 1
Line six should be ?>.
Choice 2
Line five is NOT necessary.
Choice 3
Line four should NOT end in an ;.
Choice 4
Line three requires {{ at the end.
Choice 5
Line two should have $foo and $bar.
<?
session_start();
session_register('count');
$count++;
echo "<P>$count</p>";
?> Based on the above code, which one of the following will be the result when executed?
Choice 1
Counts the total time all visitors have spent on your site
Choice 2
Counts the total number of visitors to a page
Choice 3
Counts the number of times a user accesses a page
Choice 4
Counts the time spent on each page within your site
Choice 5
Counts the total time a single user has spent within your site
1) <function ismynet($ip_host,$ip_net,$netmask) {
2) # ismynet(ip_host,ip_net,netmask)
3) $ip_octetos=explode(".",$ip_host);
4) $msk_octetos=explode(".",$netmask);
5) $net_octetos=explode(".",$ip_net);
6) return (((int) $ip_octetos[0] & (int)
7) $msk_octetos[0])==(int)$net_octetos[0] and
8) ((int) $ip_octetos[1] & (int) $msk_octetos[1])==(int)$net_octetos[1] and
9) ((int) $ip_octetos[2] & (int) $msk_octetos[2])==(int)$net_octetos[2] and
10) ((int) $ip_octetos[3] & (int) $msk_octetos[3])==(int)$net_octetos[3]);
11) }
12) ?> What is the problem with the above code?
Choice 1
Line one should begin with <?php.
Choice 2
Line two should have a ; on the end.
Choice 3
The function in line one does NOT have the correct syntax.
Choice 4
(((int) in line six should be (int).
Choice 5
Line eleven is not valid syntax.
with regards,
R.GOPALSANKAR