Escolar Documentos
Profissional Documentos
Cultura Documentos
a. Duplicated keys are NOT overwritten b. $b is appended to $a c. The + operator is overloaded d. This produces a syntax error
b.
function DisplayArray($array) { for ($array as $value) { if (valid_array($value)) { DisplayArray($value); } else { echo $value. <br>; } } } DisplayArray($array);
c.
function DisplayArray($array) { for ($array as $value) { if (is_array($value)) { DisplayArray($value); } else { echo $value. <br>; } } } DisplayArray($array);
d.
function DisplayArray($array) { foreach ($array as $value) { if (is_array($value)) { DisplayArray($value); } else { echo $value <br>; } } } DisplayArray($array);
Right answer: d.
Question (many answers): Which of the following variable names are invalid?
a. $var_1 b. $var1 c. $var-1 d. $var/1 e. $vl
Question (many answers): Which of the following are not considered as boolean False?
a. FALSE b. 0 c. 0 d. FALSE e. 1 f. NULL
Question: Which of the following regular expressions can be used to check the validity of an e-mail addresss?
a. ^[^@ ]+@[^@ ]+\.[@ ]+$ b. ^[^@ ]+@[^@ ]+[^@ ]+$ c. $[^@ ]+@[^@ ]+\[^@ ]+^ d. $[^@ ]+@[^@ ]+[^@ ]+^
Question: Which of the following statements is not true with regard to abstract classes in php5?
a. Abstract classes are introduced in PHP5 b. A class with a single abstract method must be declared abstract c. Abstract class can contain non abstract methods d. Abstract method must have method definition and can have optional empty braces following it
a. Only first \n character will be recognised and new line will be inserted b. Last \n will not be recognised and only first two parts will come in new lines c. All the \n will work and text will be printed on respective new lines. d. All will be printed on one line irrespective of the \n.
Question: You wrote following script to check for the right category:
1<?php 2 $cate=5 3 4 5 6 if ($cate==5) 7{ 8 ?> 9 Correct category! 10 <?php 11 } else { 12 ?> 13 Incorrect category! 14 <?php 15 } 16 ?> What will be the output of the program if value ofcate remains 5? a. Correct category! b. Incorrect category! c. Error due to use of invalid operator in line 6:if ($cate=5) d. Error due to incorrect syntax at line 8, 10, 12 and 14
Question: If visibility is not defined for a method/member then it is treated as public static.
a. True b. False
Question (many answers): Which of the following statements is incorrect with regard to interfaces?
a. A class can implement multiple interfaces b. An abstract class cannot implement multiple interlaces c. An interlace can extend multiple interfaces d. Methods with same name, arguments, and sequence can exist in the different interlaces implemented by a class
Question: Which of the following are the valid PHP data types?
a. resource b. null c. boolean d. string e. Both a and c f. Both c and d g. All of the above ()
Question: You are using sessions and session_register() to register objects. These objects are serialized automatically at the end of each PHP page and are de-serialized automatically on each of the following pages Is this true or false?
a. True b. False
Question (many answers): Which of the following printing construct/function accepts multiple parameters?
a. echo b. print c. printf d. Allof the above
a. 10 b. 20
c. 120 d. 6
Question: You need to keep an eye on the existing number of objects of a given class without introducing a non-class member variable.Which of the following makes this happen?
a. Add a member variable that gets incremented in the default constructor and decremented in the destructor b. Add a local variable that gets incremented in each constructor and decremented in the destructor c. Add a static member variable that gets incremented in each constructor and decremented in the destructor d. This cannot be accomplished since the creation of objects is being done dynamically via new
Question: Which of the following is used to maintain the value of a variable over different pages?
a. static b. global c. session_register() d. Noneoftheabove
Question: Which of the following variable declarations within a class is invalid in PHP5?
a. private $type = moderate; b. internal $term = 3; c. public $amnt = 500; d. protected $name = Quantas Private Limited;
Question: You have defined three variables $to, $subject, and $body to send an email. Which of the following methods would you use for sending an email?
a. mail($to,$subject,$body) b. sendmail($to,$subject,$body) c. mail(to,subject,body) d. sendmail(to,subject,body)
} $a = array (x => 3, y => 2, z => 5); $b = array (x => 9, y => 3, z => -7); vec_add (&$a, $b); print_r ($a);
a. Array ( [X] => 9 [y] => 3 [Z] => -7 b. Array [x] => 3 [y] => 2 [z] => 5 c. Array [xJ =>12 [yJ => 5 [z] => -2 d. Error e. None of the above
Question: In your PHP application you need to open a file. You want the application to issue a warning and continue execution, in case the file is not found The ideal function to be used is:
a. include() b. require() c. nowarn() d. getFile(false)
Question (many answers); Which of the the following are PHP file upload related functions?
a. upload_file() b. is_uploaded_file() c. move_uploaded_file() d. Noneoftheabove
Question: Which of the following attribute is needed for file upload via form?
Question: The inbuilt function to get the number of parameters passed is:
a. arg_num() b. func_args_count() c. func_num_args() d. None of the above
Which of the following sequence will run successfully? a. Expenses();Salary();Loan; Balance(); b. Salary();Expenses();Loan(); Balance(); c. Expenses();Salary();Balance();Loan(); d. Balance();Loan();Salary(); Expenses();
echo 30 * 5.7 a. 150.7 b. 1507 c. 171 d. you cant concatenate integers e. error will occur
Question: Which of the following is correct with regard to echo and print?
a. echo is a construct and print is a function b. echo is a function and print is a construct c. Both are functions d. Both are constructs
Question: You need to count the number of parameters given in the URL by a POST operation. The correct way is:
a. count($POST_VARS); b. count($POST_VARS_PARAM); c. count($_POST); d. count($HTTP_POST_PARAM);
Question: Which of the following crypto n PHP returns longest hash value?
a. md5() b. sha1() c. crc32() d. All return same length hash
Question: The value of a local variable of a function has to be retained over multiple calls to that function. How should that variable be declared?
a. local b. global c. static d. None of the above
Question: Which of the following is correct with regard to echo and print?
a. echo is a construct and print is a function b. echo is a function and print is a construct c. Both are functions d. Both are constructs correct
return $Rent; } Expenses(50), echo $Rent; a. 300 b. 250 correct c. 200 d. Program will not compile
echo $value. <br>; } } } DisplayArray($array); d. function DisplayArray($array) { foreach ($array as $value) { if (is_array($value)) { DisplayArray($value); } else { echo $value <br>; } } } DisplayArray($array); Right answer: d.
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: Which of the following is not a valid PHP connection status? Ans: open
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: Choose the correct statement: Ans: include() includes and evaluates a specific file require_once() includes and evaluates a specific file only if it has not been included before
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: If the session_cache_expire() is not set, then by default the session cache will expire after: Ans: 3 hrs
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: What will be the output of the following script? $count=50; function Argument() { $count++; echo $count; } Argument(); ?> Ans: It will print 1
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: What is true regarding this code? Ans: setcookie will return true
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: Which of the following is not a correct way of printing text in php5? Ans: echo "Plain text";
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: Which of the following is not the correct way of starting a session? Ans: session_initiate()
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: Which of the following functions do you need to implement HTTP Basic Authentication? Ans: None of the above
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: Which of the following Command Line Interface constant is not defined in the CLI SAPI? Ans: STDPRT
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: Which of the following statements is correct with regard to final and abstract? Ans: a. An abstract class cannot have final methods
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: State whether True or False Paamayim Nekudotayim operator allows access only to the static members of a class? Ans: True
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: Which of the following statements is true with regard to comparisons in PHP5? Ans: With (===) operator, object variables are identical if and only if they refer to the same instance of the same class.
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: Which of the following built-in function assist in checking if actually the function exists or not? Ans: function_exists
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: What will be the output of the following code? $a = 0.0; for ($i = 0; $i < a ="=""> Ans: 1
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: What will be the output of the following code? $i=4; $j=30; $k=0; $k=$j++/$i++; echo $i . " " . $j . " " . $k . " "; Ans: 5 31 7.5
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: Which of the following is a not a correct way of commenting in php? Ans: /#PHP Comment
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: Following is a php code block: $m=9; $n=99; $z=8; $z=$n++/$m++ + --$z; echo $z; what will be the output? Ans: 18
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: Which of the following is the correct way of specifying default value? Ans: function GetDiscount($Type = "Special") { . . . }
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: With reference to the following php script: print 'Text Line1' print 'Text Line2' ?> What will be the output on running the script? Ans: Error message will be printed
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: What will be the ouput of the following code? for ($i = 0; $i < i ="=""> 0134 Ques: Late PHP versions support remote file accessing for the functions: Ans: include_once() require_once() both of them
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: You have designed a user login form as follows:
User Name: Password: How can you access the username entered by the user in the 'Validate.php' webpage? a. $var= $_POST['username']; b. $var= $_REQUEST['username']; c. import_request_variables('p', 'p_'); $var= $p_username; Ans: Both of them
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: Which of the following does not represent logical AND operator in PHP? Ans: &
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: Which of the following is not true for a persistent connection? Ans: These can't be converted to non-persistent connections
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: Which of the following are invalid data types in PHP? Ans: char
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: The Manager and Office classes are as follows: class Manager{ function printName() { echo "Manager"; } } class Office{ function getManager() { return new Manager(); } } $ofc = new Office(); ??? ?> Which of the following should replace '???' to obtain the value of printName() function? Ans: $ofc->getManager()->printName();
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: The classes are defined as follows:abstract class BaseCls{ protected abstract function getName(); } class ChildCls extends BaseCls{ } Which of the following implementations of getName() is invalid in ChildCls? Ans: public function getName(){}
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: Which of the following variable declarations within a class is invalid in PHP5? Ans: var $term =3;
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: What will be the output of following code? $arr = "a"; $arr[0]="b"; echo $arr; echo $arr[0]; Ans: bb
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: For the following code: the output will be: Ans: 171
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: What is the result of the following expression? Ans: 5+2 * 4+6
Ques: What will be the output of following code? $var = 1 + "-1.3e3"; echo $var; Ans: -1299
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: What will be the output of following code? $var1="a"; $$var1="b"; echo "$var1 $a"; Ans: a b
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: What is the output of the following code? $a = 500; $b = 200; echo $a % 2 * $b; ?> Ans: 0
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: What will be the ouput of the following code? if (-1) print "true"; else print "false"; ?> Ans: true
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: What will be the output of the following code? echo 126; Ans: 126
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ques: Consider the following sample code: $x = 0xFFFE; $y = 2; $z = $x && $y; What will be the value of $z? Ans: 1
Question 1 The setrawcookie() method of setting cookie is different from php standard method of cookie setting as : a. It does not allow expiry time to be set b. It can be used only once c. It does not url- ENCODE the value on its own d. It does not allow domain setting Question 2 IF visibility is not defined for a method /member then it is treated as public static.
a. b.
True False
Question 3 Which of the following is not a valid php connection status? a. Aborted b. Normal c. Open d. Timeout Question 4 Which of the following statements is not true with regard to abstract classes in php5?
a. b. c. d.
Abstract classes are introduced in php 5 A class with a single abstract method must be declared abstract Abstract class can contain abstract methods Abstract method must have method definition and can have optional empty braces following it
Question 5 What will be the result of following operation? Print 4<<5; a. b. c. d. 3 128 120 6
Question 6 Which of the following type cast in not correct? $fig=23; $varbl=(real)$fig; $varb2=(double)$fig; $varb3=(decimal)$fig; $varb4=(bool)$fig; ?>
a. b. c. d.
Question 7 What is the result of the following expression? 5+2*4+6 a. 70 b. 19 c. 34 d. 21 Question 8 The classes are defined as follows Abstract class BaseCls( Protected abstract function getName(); } Class childCls extends BaseCls{ } Which of the following implementations of getName() in invalid in childCls? a. b. c. d. Protected function getName(){} Function getName(){} Private function getName(){} Public function getName(){}
Question 9 Multiple select/load is possible with: a. checkbox b. select c. file d. all of the above Question 10 State whether true or false Paamayim nekudotayim operator allows access only to the static members of a class? a. True b. False Question 11 What is the output of the following code? $a=500; $b=200; echo $a % 2 * $b; ?>
a. b. c. d. e.
Question 12 You need to heck the size of a file in php function . $size=X(filename); which function will suitable replace X?
a. b. c. d.
these are not closed even after the execution of the script these are mainly used to increase the efficiency of the system These cant be converted to non-persistent connections These are preferable not used in the scripts involving transactions
$s=fwrite(a string here); $s=fwrite($fp,a string here); $s=fwrite(a string here ,$fp); none of the above
Question 16 Which of the following in not a correct way of printing text in php 5 a. echo plain text ?> b. c. d. <# echo plain text #> Question 17 Which will be the output of the following code? $a=0.0; For($i=0;$i<10;$i++) $a+=0.1; print $a\n; if ($a==1.0) print equals; else print not equals; ?>
Question 18 Which of the following attribute is needed for file upload via form?
a. b. c. d.
Question 19 Late php versions support remote file accessing for the functions:
a. b. c. d.
Question 20 Given below is a small php script: class person { function getSal() { } } class emp extends person { fucniton getSal() { ??? } }
?> the getSal() of emp has to behave exacltyle as getSal() of person . Which of the following lines of code would you use to replace the ????
a. b. c. d.
1) a. b. c. d.
Which of the following is correct with regard to echo and print? echo is a construct and print is a function cho is a function and print is a construct Both are functions Both are constructs
2) Which of the following variable declarations within a class is invalid in PHP5? a. private $type = 'moderate'; b. internal $term =3; c. public $amnt = '500'; d. protected $name = 'Quantas Private Limited'; 3) You need to count the number of parameters given in the URL by a POST operation. The correct way is: a. count($POST_VARS); b. count($POST_VARS_PARAM); c. count($_POST); d. count($HTTP_POST_PARAM); 4) In your PHP application you need to open a file. You want the application to issue a warning and continue execution, in case the file is not found. The ideal function to be used is: a. include() b. require() c. nowarn() d. getFile(false) 5) Which of the following is not a valid PHP parser tag? a. Script b. ?p c. % d. ?php 6) What will be the output of the following code? var_dump (3*4); ?>
a) b) c) d) e) 7) a. b. c. d. e.
int(3*4) int(12) 3*4 12 None of the above Which of the following variable names are invalid? $var_1 $var1 $var-1 $var/1 $v1
8) Which of the following variables are supported by 'str_replace()' function? a. Integer b. String c. Boolean d. Array 9) The following php variables are declared: $company = 'ABS Ltd'; $$company = ', Sydney'; Which of the following is not a correct way of printing 'ABS Ltd, Sydney'? a. echo "$company $$company"; b. echo "$company ${$company}"; c. echo "$company ${'ABS Ltd'}"; d. echo "$company {$$company}"; 10) a. b. c. d. 11) a. b. c. d. Which of the following functions output text? echo() print() println() display() Which of the following is not true regarding XForms? PHP provides support for XForm It can be used on PDF documents The data is sent in XML format The action and method parameters are defined in the body
12) What will be the output of the following code? echo 30 * 5 . 7 ?> a. 150 . 7 b. 1507 c. 150.7 d. you can't concatenate integers e. error will occur 13) Which of the following is not supported in PHP5? a. Type Hinting b. Reflection
c. Magic Methods d. Multiple Inheritance e. Object Cloning 14) You need to keep an eye on the existing number of objects of a given class without introducing a non-class member variable. Which of the following makes this happen? a. Add a member variable that gets incremented in the default constructor and decremented in the destructor b. Add a local variable that gets incremented in each constructor and decremented in the destructor c. Add a static member variable that gets incremented in each constructor and decremented in the destructor d. This cannot be accomplished since the creation of objects is being done dynamically via "new." 15) a. b. c. d. Which of the following attribute is needed for file upload via form? enctype="multipart/form-data" enctype="singlepart/data" enctype="file" enctype="form-data/file"
16) What do you infer from the following code? $str = 'Dear Customer,\nThanks for your query. We will reply very soon.?\n Regards.\n Customer Service Agent'; print $str; ?> a. Only first \n character will be recognised and new line will be inserted. b. Last \n will not be recognised and only first two parts will come in new lines. c. All the \n will work and text will be printed on respective new lines. d. All will be printed on one line irrespective of the \n. 17) You are using sessions and session_register() to register objects. These objects are serialized automatically at the end of each PHP page and are de-serialized automatically on each of the following pages. Is this true or false? a. True b. False 18) Does PHP provide the goto keyword in latest version? a. Yes b. No 19) What will be the output of the following code? $var = 10; function fn() { $var = 20; return $var; } fn(); echo $var; a. 10 b. 20 c. Undefined Variable d. Syntax Error
20) a. b. c. d.
What is true regarding $a + $b where both of them are arrays? Duplicated keys are NOT overwritten $b is appended to $a The + operator is overloaded This produces a syntax error
21) Which of the following statements is incorrect with regard to interfaces? a. A class can implement multiple interfaces b. An abstract class cannot implement multiple interfaces c. An interface can extend multiple interfaces d. Methods with same name, arguments, and sequence can exist in the different interfaces implemented by a class 22) a. b. c. d. Which of the following statements is not true with regard to abstract classes in php5? Abstract classes are introduced in PHP5 A class with a single abstract method must be declared abstract Abstract class can contain non abstract methods Abstract method must have method definition and can have optional empty braces following it
23) You have defined three variables $to, $subject, and $body to send an email. Which of the following methods would you use for sending an email? a. mail($to,$subject,$body) b. sendmail($to,$subject,$body) c. mail(to,subject,body) d. sendmail(to,subject,body) 24) You wrote following script to check for the right category: $cate=5; ... ... if ($cate==5) { ?> Correct category! } else { ?> Incorrect category! } ?> What will be the output of the program if value of 'cate' remains 5? a. Correct category! b. Incorrect category! c. Error due to use of invalid operator in line 6:"if ($cate==5)" d. Error due to incorrect syntax at line 8, 10, 12 and 14 25) What will be the result of the following expression: 6+4 * 9-3 a. 60 b. 87 c. 39 d. 30
26) a. b. c. d.
Which of the following multithreaded servers allow PHP as a plug-in? Netscape FastTrack Microsoft's Internet Information Server O'Reilly's WebSite Pro All of the above
27) We have two variable definitions: 1. 023 2. x23 a. 1 is octal b. 2 is hexadecimal c. 2 is octal d. 1 is hexadecimal 28) a. b. c. d. 29) a. b. c. d. e. f. Which of the following variables is not related to file uploads? max_file_size max_execution_time post_max_size max_input_time Which of the following characters are taken care of by htmlspecialchars? < > single quote double quote & All of the above
30) Consider the following class: 1 class Insurance 2{ 3 function clsName() 4{ 5 echo get_class($this); 6} 7} 8 $cl = new Insurance(); 9 $cl->clsName(); 10 Insurance::clsName(); Which of the following Lines should be commented to print the class name without errors? a. Line 8 and 9 b. Line 10 c. Line 9 and 10 d. All the three lines 8,9, and 10 should be left as it is. 31) a. b. c. d. Which of the following is a PHP resource? Domxml document Odbc link File All of the above
32) What will be the result of following operation? print 4<< 5; a. 3 b. 128 c. 120 d. 6
33) a. b. c. d.
Which of the following printing construct/function accepts multiple paramet Echo Print Printf All of the above
34) You have two strings, which you want to concatenate. $str1 = 'Have a '; $str2 = 'Nice Day' a. $str1.Concat($str2); b. $str1.$str2; c. "$str1$str2"; d. None of the above 35) What will be the output of the following code? $a = 10; if($a > 5 OR < 15) echo "true"; else echo "false" a. True b. False c. No output d. Parse Error 36) a. b. c. d. e. f. Which of the following are not considered as boolean False? FALSE 0 "0" "FALSE" 1 NULL
37) What is the output of the following code? function vec_add (&$a, $b) { $a['x'] += $b['x']; $a['y'] += $b['y']; $a['z'] += $b['z']; } $a = array (x => 3, y => 2, z => 5); $b = array (x => 9, y => 3, z => -7); vec_add (&$a, $b);
print_r ($a); ?> a. Array( [x] => 9 [y] => 3 [z] => -7) b. Array( [x] => 3 [y] => 2 [z] => 5) c. Array( [x] => 12 [y] => 5 [z] => -2) d. Error e. None of the above 38) a. b. c. d. Which of the the following are PHP file upload related functions? upload_file() is_uploaded_file() move_uploaded_file() None of the above
39) Does PHP 5 support exceptions? a. Yes b. No 40) a. b. c. d. e. 41) a. b. c. d. Which of the following is not a file related function in PHP? Fclose Fopen Fwrite Fgets Fappend Which of the following is a correct declaration? static $varb = array(1,'val',3); static $varb = 1+(2*90); static $varb = sqrt(81); static $varb = new Object;
42) Consider the following two statements: I while (expr) statement II while (expr): statement ... endwhile; Which of the following are true in context of the given statements? a. I is correct and II is wrong b. I is wrong and II is correct c. Both I & II are wrong d. Both I & II are correct 43) You need to keep an eye on the existing number of objects of a given class without introducing a non-class member variable. Which of the following makes this happen? a. Add a member variable that gets incremented in the default constructor and decremented in the destructor b. Add a local variable that gets incremented in each constructor and decremented in the destructor c. Add a static member variable that gets incremented in each constructor and decremented in the destructor d. This cannot be accomplished since the creation of objects is being done dynamically via "new." 44) Which of the following crypto in PHP returns longest hash value? a. md5() b. sha1()
c. crc32() d. All return same length hash 45) a. b. c. d. e. f. 46) a. b. c. d. Which of the following is a Ternary Operator? & = :? ?: += && Which of the following pair have non-associative equal precedence? +, ==, != <<, >> &=, |=
47) Which of the following environment variables is used to fetch the IP address of the user in your PHP application? a. $IP_ADDR b. $REMOTE_ADDR_USER c. $REMOTE_ADDR d. $IP_ADDR_USER 48) What is the output of the following PHP code snippet? $var = "testing module"; $statement = 'This is a $var'; echo ($statement); ?> a. This is a testing module b. This is a $var c. The code will not work, and will give syntax error 49) a. b. c. d. Which of the following is an iterator classes included in Standard PHP Library (SPL) in PHP5? OuterIterator InifiniteIterator RecursiveIterator SeekableIterator
50) What is the output of the following PHP code snippet? $val = 10; $val2 = 20; function helloworld($a) { $val2 = $a * 30; } helloworld($val); echo $val2; ?> a. 20 b. 300 c. 10
d. 600 51) In your PHP application you need to open a file. You want the application to issue a warning and continue execution, in case the file is not found. The ideal function to be used is: a. include() b. require() c. Both A and B d. None of the above 52) a. b. c. d. What is true regarding this code? setcookie will return false setcookie will return true setcookie will return null Any of the above can happen
53) Which of the following is not the correct way of starting a session? a. session.auto_start b. session_register() c. session_initiate() d. session_start() 54) a. b. c. d. 55) a. b. c. d. Which of the following functions do you need to implement HTTP Basic Authentication? authenticate () header () basic_auth () None of the above Which of the following Command Line Interface constant is not defined in the CLI SAPI? STDIN STDOUT STDPRT STDERR
56) Which composite data types are supported by php? a. Array b. Enumeration c. List d. Object e. Integer 57) The default value of register_globals in PHP is: a. Off b. On 58) Which of the following is not a valid PHP connection status? a. aborted b. normal c. open d. timeout 59) Choose the correct statement: a. include() includes and evaluates a specific file
b. require() includes and evaluates a specific file c. include_once() includes and evaluates a specific file only if it has not been included before d. require_once() includes and evaluates a specific file only if it has not been included before e. All of the above 60) If the session_cache_expire() is not set, then by default the session cache will expire after: a. 1 hr b. 2 hrs c. 3 hrs d. 4 hrs 61) What will be the output of the following script?$count=50; function Argument() { $count++; echo $count; } Argument(); ?> a. It will print 50 b. It will print 51 c. It will print 52 d. It will print 1 62) State whether True or False Paamayim Nekudotayim operator allows access only to the static members of a class? a. True b. False 63) Which of the following built-in function assist in checking if actually the function exists or not? a. exists b. function_exists c. fexists d. isFunction 64) What will be the output of the following code?$i=4; $j=30; $k=0; $k=$j++/$i++; echo $i . " " . $j . " " . $k . " "; a. 5 31 6 b. 5 31 6.2 c. 5 31 7 d. 4 31 7.5 e. 5 31 7.5 65) Which of the following is a not a correct way of commenting in php? a. //PHP Comment b. /*PHP Comment*/ c. #PHP Comment d. /#PHP Comment
66) Following is a php code block: $m=9; $n=99; $z=8; $z=$n++/$m++ + --$z; echo $z; what will be the output? a. 16 b. 18 c. 19 d. 20 e. 17 67) Which of the following is the correct way of specifying default value? a. function GetDiscount($Type = "Special") { . . . } b. function GetDiscount(Type := "Special") { . . . } c. function GetDiscount($Type := "Special") { . . . } d. function GetDiscount($Type : "Special") { . . . } 68) With reference to the following php script: print 'Text Line1' print 'Text Line2' ?> What will be the output on running the script? a. Text Line1Text Line2 b. Text Line1 Text Line2 c. 'Text Line1' d. 'Text Line2' e. Error message will be printed 69) Late PHP versions support remote file accessing for the functions: a. include() b. include_once() c. require_once() d. Both a and b e. Both b and c 70) Which of the following does not represent logical AND operator in PHP? a. & b. && c. And d. AND 71) Which of the following is not true for a persistent connection? a. These are not closed even after the execution of the script b. These are mainly used to increase the efficiency of the system c. These can't be converted to non-persistent connections d. These are preferably not used in the scripts involving transactions 72) Which of the following are invalid data types in PHP? a. string
b. integer c. float d. char e. array f. object 73) Which of the following variable declarations within a class is invalid in PHP5? a. private $type = 'moderate'; b. var $term =3; c. public $amnt = '500'; d. protected $name = 'Quantas Private Limited'; 74) What will be the output of following code? $arr = "a"; $arr[0]="b"; echo $arr; echo $arr[0]; a. ab b. $arr is undefined c. bb d. Parse error 75) What is the result of the following expression? 5+2 * 4+6 a. 70 b. 19 c. 34 d. 21 76) What will be the output of following code?$var = 1 + "-1.3e3"; echo $var; a. -1299 b. 1 c. 1-1.3e3 d. Error:cannot add integer and string 77) Consider the following sample code: $x = 0xFFFE; $y = 2; $z = $x && $y; What will be the value of $z? a. 0 b. 1 c. 2 d. 3 e. 4 78) What will be the output of the following code? echo 12 . 6; a. 12 . 6 b. 126 c. 12.6 d. Error: You cannot add integers through the concatenation operator(.)
1. Question: What is true regarding this code? Answer: setcookie will return true 2. Question: Which of the following is not a correct way of printing text in php5? Answer: echo Plain text; 3. Question: Which of the following is not the correct way of starting a session? Answer: session_initiate() 4. Question: Which of the following functions do you need to implement HTTP Basic Authentication? Answer: None of the above 5. Question: Which of the following Command Line Interface constant is not defined in the CLI SAPI? Answer: STDPRT 6. Question: Which of the following statements is correct with regard to final and abstract? Answer: a. An abstract class cannot have final methods 7. Question: Which composite data types are supported by php? Answer: Array 8. Question: The default value of register_globals in PHP is: Answer: Off 9. Question: Which of the following is not a valid PHP connection status? Answer: open 10. Question: Choose the correct statement: Answer: include() includes and evaluates a specific file require_once() includes and evaluates a specific file only if it has not been included before 11. Question: If the session_cache_expire() is not set, then by default the session cache will expire after: Answer: 3 hrs 12. Question: What will be the output of the following script? $count=50; Paamayim Nekudotayim operator allows access only to the static members of a class? Paamayim Nekudotayim operator allows access only to the static members of a class? Answer: function_exists $i=4; User Name: Password: class Manager{ Answer: 5+2 * 4+6 $var = 1 + -1.3e3; function Argument() { $count++; echo $count; } Argument(); ?> Answer: It will print 1 13. Question: State whether True or False Answer: True 14. Question: Which of the following statements is true with regard to comparisons in PHP5? Answer: With (===) operator, object variables are identical if and only if they refer to the same instance of the same class.
15. Question: What will be the output of the following code? $a = 0.0; for ($i = 0; $i < a ="=""> Answer: 1 16. Question: What will be the output of the following code? $j=30; $k=0; $k=$j++/$i++; echo $i . . $j . . $k . ; Answer: 5 31 7.5 17. Question: Which of the following is a not a correct way of commenting in php? Answer: /#PHP Comment 18. Question: Following is a php code block: $m=9; $n=99; $z=8; $z=$n++/$m++ + $z; echo $z; what will be the output? Answer: 18 19. Question: Which of the following is the correct way of specifying default value? Answer: function GetDiscount($Type = Special) { . . . } 20. Question: With reference to the following php script: print Text Line1 print Text Line2 ?> What will be the output on running the script? Answer: Error message will be printed 21. Question: What will be the ouput of the following code? for ($i = 0; $i < i ="=""> 0134 Question: Late PHP versions support remote file accessing for the functions: Answer: include_once() require_once() both of them 22. Question: You have designed a user login form as follows: How can you access the username entered by the user in the Validate.php webpage? a. $var= $_POST['username']; b. $var= $_REQUEST['username']; c. import_request_variables(p, p_); $var= $p_username; Answer: Both of them 23. Question: Which of the following does not represent logical AND operator in PHP? Answer: & 24. Question: Which of the following is not true for a persistent connection? Answer: These cant be converted to non-persistent connections 25. Question: Which of the following are invalid data types in PHP? Answer: char
26. Question: The Manager and Office classes are as follows: function printName() { echo Manager; } } class Office{ function getManager() { return new Manager(); } } $ofc = new Office(); ??? ?> Which of the following should replace ??? to obtain the value of printName() function? Answer: $ofc->getManager()->printName(); 27. Question: The classes are defined as follows:abstract class BaseCls{ protected abstract function getName(); } class ChildCls extends BaseCls{ } Which of the following implementations of getName() is invalid in ChildCls? Answer: public function getName(){} 28. Question: Which of the following variable declarations within a class is invalid in PHP5? Answer: var $term =3; 29. Question: What will be the output of following code? $arr = a; $arr[0]=b; echo $arr; echo $arr[0]; Answer: bb 30. Question: For the following code: the output will be: Answer: 171 31. Question: What is the result of the following expression? Question: What will be the output of following code? echo $var; Answer: -1299 32. Question: What will be the output of following code? $var1=a; $$var1=b; echo $var1 $a; Answer: a b 33. Question:What is the output of the following code? $a = 500; $b = 200; echo $a % 2 * $b;
?> Answer: 0 34. Question: What will be the ouput of the following code? if (-1) print true; else print false; ?> Answer: true 35. Question: What will be the output of the following code? echo 12 . 6; Answer: 126 36. Question: Consider the following sample code: $x = 0xFFFE; $y = 2; $z = $x && $y; What will be the value of $z? Answer: 1
Question: Which of the following is not a correct way of printing text in php5? Ans: echo "Plain text"; Question: Which of the following is not the correct way of starting a session? Ans: session_initiate() Question: Which of the following functions do you need to implement HTTP Basic Authentication? Ans: None of the above Question: Which of the following Command Line Interface constant is not defined in the CLI SAPI? Ans: STDPRT Question: Which of the following statements is correct with regard to final and abstract? Ans: a. An abstract class cannot have final methods Question: Which composite data types are supported by php? Ans: Array Question: The default value of register_globals in PHP is: Ans: Off
Question: Which of the following is not a valid PHP connection status? Ans: open Question: Choose the correct statement: include() includes and evaluates a specific file Ans: require_once() includes and evaluates a specific file only if it has not been included before Question: If the session_cache_expire() is not set, then by default the session cache will expire after: Ans: 3 hrs Question: What will be the output of the following script? $count=50; function Argument() { $count++; echo $count; } Argument(); ?> Ans: It will print 1 Question: State whether True or False Paamayim Nekudotayim operator allows access only to the static members of a class? Ans: True Question: Which of the following statements is true with regard to comparisons in PHP5? Ans: With (===) operator, object variables are identical if and only if they refer to the same instance of the same class. Question: Which of the following built-in function assist in checking if actually the function exists or not? Ans: function_exists Question: What will be the output of the following code? $a = 0.0; for ($i = 0; $i < a ="="">
Ans: 1 Question: What will be the output of the following code? $i=4; $j=30; $k=0; $k=$j++/$i++; echo $i . " " . $j . " " . $k . " "; Ans: 5 31 7.5 Question: Which of the following is a not a correct way of commenting in php? Ans: /#PHP Comment Question: Following is a php code block: $m=9; $n=99; $z=8; $z=$n++/$m++ + --$z; Ans: echo $z; what will be the output? Ans: 18 Question: Which of the following is the correct way of specifying default value? function GetDiscount($Type = "Special") { . . . } Question: With reference to the following php script: print 'Text Line1' print 'Text Line2' Ans:?> What will be the output on running the script? Ans: Error message will be printed Question: What will be the ouput of the following code? for ($i = 0; $i < i ="=""> Ans: 0134 Question: Late PHP versions support remote file accessing for the functions:
Question: You have designed a user login form as follows: User Name: Password: How can you access the username entered by the user in the 'Validate.php' webpage? a. $var= $_POST['username']; b. $var= $_REQUEST['username']; c. import_request_variables('p', 'p_'); $var= $p_username; Ans: Both of them Question: Which of the following does not represent logical AND operator in PHP? Ans: & Question: Which of the following is not true for a persistent connection? Ans: These can't be converted to non-persistent connections Question: Which of the following are invalid data types in PHP? Ans: char Question: The Manager and Office classes are as follows: class Manager{ function printName() { echo "Manager"; } } class Office{ function getManager() { return new Manager(); } } $ofc = new Office(); ??? Ans:?> Which of the following should replace '???' to obtain the value of printName() function? Ans: $ofc->getManager()->printName();
Question: The classes are defined as follows:abstract class BaseCls{ protected abstract function getName(); } class ChildCls extends BaseCls{ } Which of the following implementations of getName() is invalid in ChildCls? Ans: public function getName(){} Question: Which of the following variable declarations within a class is invalid in PHP5? var $term =3; Question: What will be the output of following code? $arr = "a"; $arr[0]="b"; echo $arr; echo $arr[0]; Ans: bb Question: For the following code: the output will be: Ans: 171 Question: What is the result of the following expression? 5+2 * 4+6 Ans: 19 Question: What will be the output of following code? $var = 1 + "-1.3e3"; echo $var; Ans: -1299 Question: What will be the output of following code? $var1="a"; $$var1="b"; echo "$var1 $a"; Ans: a b Question:What is the output of the following code?
$a = 500; $b = 200; echo $a % 2 * $b; ?> Ans: 0 Question: What will be the ouput of the following code? if (-1) print "true"; else print "false"; ?> Ans: true Question: What will be the output of the following code? echo 12 . 6; Ans: 126 Question: Consider the following sample code: $x = 0xFFFE; $y = 2; $z = $x && $y; What will be the value of $z? Ans: 1 What is true regarding this code? setcookie will return true Question: Which of the following is not a correct way of printing text in php5? echo "Plain text"; Question: Which of the following is not the correct way of starting a session? session_initiate() Question: Which of the following functions do you need to implement HTTP Basic Authentication? None of the above Question: Which of the following Command Line Interface constant is not defined in the CLI SAPI?
STDPRT Question: Which of the following statements is correct with regard to final and abstract? a. An abstract class cannot have final methods Question: Which composite data types are supported by php? Array Question: The default value of register_globals in PHP is: Off Question: Which of the following is not a valid PHP connection status? open Question: Choose the correct statement: include() includes and evaluates a specific file require_once() includes and evaluates a specific file only if it has not been included before Question: If the session_cache_expire() is not set, then by default the session cache will expire after: 3 hrs Question: What will be the output of the following script? $count=50; function Argument() { $count++; echo $count; } Argument(); ?> It will print 1 Question: State whether True or False Paamayim Nekudotayim operator allows access only to the static members of a class? True Question: Which of the following statements is true with regard to comparisons in PHP5?
With (===) operator, object variables are identical if and only if they refer to the same instance of the same class. Question: Which of the following built-in function assist in checking if actually the function exists or not? function_exists Question: What will be the output of the following code? $a = 0.0; for ($i = 0; $i < a ="=""> 1 Question: What will be the output of the following code? $i=4; $j=30; $k=0; $k=$j++/$i++; echo $i . " " . $j . " " . $k . " "; 5 31 7.5 Question: Which of the following is a not a correct way of commenting in php? /#PHP Comment Question: Following is a php code block: $m=9; $n=99; $z=8; $z=$n++/$m++ + --$z; echo $z; what will be the output? 18 Question: Which of the following is the correct way of specifying default value? function GetDiscount($Type = "Special") { . . . } Question: With reference to the following php script: print 'Text Line1' print 'Text Line2' ?> What will be the output on running the script? Error message will be printed
Question: What will be the ouput of the following code? for ($i = 0; $i < i ="=""> 0134 Question: Late PHP versions support remote file accessing for the functions: include_once() require_once() both of them Question: You have designed a user login form as follows: User Name: Password: How can you access the username entered by the user in the 'Validate.php' webpage? a. $var= $_POST['username']; b. $var= $_REQUEST['username']; c. import_request_variables('p', 'p_'); $var= $p_username; Both of them Question: Which of the following does not represent logical AND operator in PHP? & Question: Which of the following is not true for a persistent connection? These can't be converted to non-persistent connections Question: Which of the following are invalid data types in PHP? char Question: The Manager and Office classes are as follows: class Manager{ function printName() { echo "Manager"; } } class Office{ function getManager() { return new Manager(); } } $ofc = new Office();
??? ?> Which of the following should replace '???' to obtain the value of printName() function? $ofc->getManager()->printName(); Question: The classes are defined as follows:abstract class BaseCls{ protected abstract function getName(); } class ChildCls extends BaseCls{ } Which of the following implementations of getName() is invalid in ChildCls? public function getName(){} Question: Which of the following variable declarations within a class is invalid in PHP5? var $term =3; Question: What will be the output of following code? $arr = "a"; $arr[0]="b"; echo $arr; echo $arr[0]; bb Question: For the following code: the output will be: 171 Question: What is the result of the following expression? 5+2 * 4+6 Question: What will be the output of following code? $var = 1 + "-1.3e3"; echo $var; -1299 Question: What will be the output of following code? $var1="a"; $$var1="b"; echo "$var1 $a"; ab
Question:What is the output of the following code? $a = 500; $b = 200; echo $a % 2 * $b; ?> 0 Question: What will be the ouput of the following code? if (-1) print "true"; else print "false"; ?> true Question: What will be the output of the following code? echo 12 . 6; 126 Question: Consider the following sample code: $x = 0xFFFE; $y = 2; $z = $x && $y; What will be the value of $z? 1 Question.11. which of the following are used for code reuse? Solution: B,D Question.13. which of the following is the corect way of specifying default value? Solution: Question.14. Which of the following are ''magic constant'? a. __LINE__ b. __FILE__ c __PRETTY_FUNCTION__ d __CLASS__ e. __METHOD__ Solution:
Question.15. you have defined three variables $to, $subject, and $body to send an email. Which of the following methods would you use for sending an email? a. mail($to, $subject,$body) b. sendmail($to, $subject,$body) c. mail(to, subject,body) d. sendmail(to, subject,body) Solution: Question.16. Which one of the following is turnary operator? Solution: D Question.17. What is the result of the following Exprssion? 5+2*4+6 Solution:B Question.18. The default value of register global in PHP is: Solution:A Question.19. What would b the outpur of the following code? $string = 'good day'; $string = ucword($string); echo $string; ?> Solution:C Question.20. If you want to pass a value to a function by reference, the correct way is: Solution:D Question1: What will be the result of following operation? print 4<< 5; c. 120 Question2: You wrote following script to check for the right category: 1 2 $cate=5; 3 ... 4 ... 5 6 if ($cate==5)
7 { 8 ?> 9 Correct category! 10 11 } else { 12 ?> 13 Incorrect category! 14 15 } 16 ?> What will be the output of the program if value of 'cate' remains 5? a. Correct category! Question3: You need to count the number of parameters given in the URL by a POST operation. The correct way is: c. count($_POST);
Question4: If expire parameter of setCookie function is not specified then: b. Cookie will expire with closure of the browser Question5: Which of the following variable declarations within a class is invalid in PHP5? d. protected $name = 'Quantas Private Limited'; Question6: Which of the following statements is not true with regard to abstract classes in php5? d. Abstract method must have method definition and can have optional empty braces following it Question7: Which of the following pair have non-associative equal precedence? d. &=, |= Question8: You have two strings, which you want to concatenate. $str1 = 'Have a '; $str2 = 'Nice Day'; The fastest way would be: d. None of the above Question9: For the following code: function Expenses() { function Salary() {
} function Loan() { function Balance() { } } } ?> Which of the following sequence will run successfully? b. Salary();Expenses();Loan();Balance(); Question10: Which of the following is not supported in PHP5? d. Multiple Inheritance Question11: How would you start a session? c. session_start(); Question12: What do you infer from the following code? $str = 'Dear Customer,\nThanks for your query. We will reply very soon.?\n Regards.\n Customer Service Agent'; print $str; ?> c. All the \n will work and text will be printed on respective new lines. Question13: What will be the result of the following expression: 6+4 * 9-3 b. 87 Question14: What is true regarding $a + $b where both of them are arrays? b. $b is appended to $a Question15: Which of the following characters are taken care of by htmlspecialchars? b. > Question16: The value of a local variable of a function has to be retained over multiple calls to that function. How should that variable be declared? c. static Question17:
Which of the following multithreaded servers allow PHP as a plug-in? d. All of the above Question18: Multiple select/load is possible with: d. All of the above Question19: Which of the following variable names are invalid? b. $var1 Question20: Which of the following are useful for method overloading? c. __get,__set,__load Question21: What will be the output of the following code? function fn(&$var) { $var = $var - ($var/10 * 5); return $var; } echo fn(100); \ e. None of the above Question22: Which of the following type cast is not correct? 1 2 $fig = 23; 3 $varbl = (real) $fig; 4 $varb2 = (double) $fig; 5 $varb3 = (decimal) $fig; 6 $varb4 = (bool) $fig; 7 ?> b. double Question23: What will be the output of following code? $a = 10; echo "Value of a = $a"; b. Value of a = $a Question24: What will be the output of the following code? $var = 10; function fn() { $var = 20;
return $var; } fn(); echo $var; d. Syntax Error Question25: Which of the following attribute is needed for file upload via form? b. enctype="singlepart/data" Question26: Which of the following is not a file related function in PHP? d. fgets Question27: Which of the following is correct with regard to echo and print ? b. echo is a function and print is a construct Question28: Which of the following is a correct declaration? d. static $varb = new Object; Question29: Consider the following two statements: I while (expr) statement II while (expr): statement ... endwhile; Which of the following are true in context of the given statements? b. I is wrong and II is correct Question30: You are using sessions and session_register() to register objects. These objects are serialized automatically at the end of each PHP page and are de-serialized automatically on each of the following pages. Is this true or false? a. True Question31: Which of the following text manipulation functions is supported by PHP? e. All of the above Question32: Does PHP 5 support exceptions? a. Yes Question33: Which of the following is not a predefined constant? d. __FILE__
Question34: Variable/functions in PHP don't work directly with: b. isset() Question35: Which of the following is used to maintain the value of a variable over different pages? c. session_register() Question36: Which of the following statements is incorrect with regard to interfaces? d. Methods with same name, arguments, and sequence can exist in the different interfaces implemented by a class Question37: What is the output of the following code? function vec_add (&$a, $b) { $a['x'] += $b['x']; $a['y'] += $b['y']; $a['z'] += $b['z']; } $a = array (x => 3, y => 2, z => 5); $b = array (x => 9, y => 3, z => -7); vec_add (&$a, $b); print_r ($a); ?> the answers is: Question38: Which of the following statement is not correct for PHP? b. A php file may contain text, html tags or scripts Question39: Does PHP provide the goto keyword in latest version? b. No Question40: What will be the output of the following code? $Rent = 250; function Expenses($Other) { $Rent = 250 + $Other; return $Rent; } Expenses(50);
echo $Rent; c. 200 What is true regarding this code? setcookie will return true Question: Which of the following is not a correct way of printing text in php5? echo "Plain text"; Question: Which of the following is not the correct way of starting a session? session_initiate() post ed by khalequzzaman Question: Which of the following functions do you need to implement HTTP Basic Authentication? None of the above Question: Which of the following Command Line Interface constant is not defined in the CLI SAPI? STDPRT Question: Which of the following statements is correct with regard to final and abstract? a. An abstract class cannot have final methods Question: Which composite data types are supported by php? Array Question: The default value of register_globals in PHP is: Off Question: Which of the following is not a valid PHP connection status? open Question: Choose the correct statement: include() includes and evaluates a specific file require_once() includes and evaluates a specific file only if it has not been included before posted by khalequzzaman Question: If the session_cache_expire() is not set, then by default the session cache will expire
after: 3 hrs Question: What will be the output of the following script? $count=50; function Argument() { $count++; echo $count; } Argument(); ?> It will print 1 Question: State whether True or False Paamayim Nekudotayim operator allows access only to the static members of a class? True Question: Which of the following statements is true with regard to comparisons in PHP5? With (===) operator, object variables are identical if and only if they refer to the same instance of the same class. Question: Which of the following built-in function assist in checking if actually the function exists or not? function_exist Question: What will be the output of the following code? $a = 0.0; for ($i = 0; $i < a ="=""> 1 Question: What will be the output of the following code? $i=4; $j=30; $k=0; $k=$j++/$i++; echo $i . " " . $j . " " . $k . " "; 5 31 7.5 Question: Which of the following is a not a correct way of commenting in php? /#PHP Comment
Question: Following is a php code block: $m=9; $n=99; $z=8; $z=$n++/$m++ + --$z; echo $z; what will be the output? 18 Question: Which of the following is the correct way of specifying default value? function GetDiscount($Type = "Special") { . . . } Question: With reference to the following php script: print 'Text Line1' print 'Text Line2' ?> What will be the output on running the script? Error message will be printed posted by khalequzzaman Question: What will be the ouput of the following code? for ($i = 0; $i < i ="=""> 0134 Question: Late PHP versions support remote file accessing for the functions: include_once() require_once() both of them Question: You have designed a user login form as follows: User Name: Password: How can you access the username entered by the user in the 'Validate.php' webpage? a. $var= $_POST['username']; b. $var= $_REQUEST['username']; c. import_request_variables('p', 'p_'); $var= $p_username; Both of them Question: Which of the following does not represent logical AND operator in PHP? &
Question: Which of the following is not true for a persistent connection? These can't be converted to non-persistent connections Question: Which of the following are invalid data types in PHP? char Question: The Manager and Office classes are as follows: class Manager{ function printName() { echo "Manager"; } } class Office{ function getManager() { return new Manager(); } } $ofc = new Office(); ??? ?> Which of the following should replace '???' to obtain the value of printName() function? $ofc->getManager()->printName(); Question: The classes are defined as follows:abstract class BaseCls{ protected abstract function getName(); } class ChildCls extends BaseCls{ } Which of the following implementations of getName() is invalid in ChildCls? public function getName(){} Question: Which of the following variable declarations within a class is invalid in PHP5? var $term =3; Question: What will be the output of following code? $arr = "a"; $arr[0]="b"; echo $arr; echo $arr[0]; bb
Question: For the following code: the output will be: 171 Question: What is the result of the following expression? 5+2 * 4+ 19 Question: What will be the output of following code? $var = 1 + "-1.3e3"; echo $var; -1299 Question: What will be the output of following code? $var1="a"; $$var1="b"; echo "$var1 $a"; ab Question:What is the output of the following code? $a = 500; $b = 200; echo $a % 2 * $b; ?> 0 Question: What will be the ouput of the following code? if (-1) print "true"; else print "false"; ?> true Question: What will be the output of the following code? echo 12 . 6; 126 Question:
Consider the following sample code: $x = 0xFFFE; $y = 2; $z = $x && $y; What will be the value of $z? Question 1 The setrawcookie() method of setting cookie is different from php standard method of cookie setting as : Ans: C Question 2 IF visibility is not defined for a method /member then it is treated as public static. Ans: B Question 3 Which of the following is not a valid php connection status? Ans: C Question 4 Which of the following statements is not true with regard to abstract classes in php5? Ans : C Question 5 What will be the result of following operation? Print 4<<5; Ans: B Question 6 Which of the following type cast in not correct? $fig=23; $varbl=(real)$fig; $varb2=(double)$fig; $varb3=(decimal)$fig; $varb4=(bool)$fig; ?> Ans: C Question 7 What is the result of the following expression? 5+2*4+6 Ans: B Question 8 The classes are defined as follows Abstract class BaseCls( Protected abstract function getName();
} Class childCls extends BaseCls{ } Which of the following implementations of getName() in invalid in childCls? Ans: D Question 9 Multiple select/load is possible with: Ans : A Question 10 State whether true or false Paamayim nekudotayim operator allows access only to the static members of a class? Ans: A Question 11 What is the output of the following code? $a=500; $b=200; echo $a % 2 * $b; ?> Ans: D Question 12 You need to heck the size of a file in php function . $size=X(filename); which function will suitable replace X? Ans: A Question 14 Which of the following is not true for a persistent connection? Ans: D Question 15 Which one is correct? Ans B Question 16 Which of the following in not a correct way of printing text in php 5 Ans: C Question 17 Which will be the output of the following code? $a=0.0; For($i=0;$i<10;$i++) $a+=0.1; print $a\n;
if ($a==1.0) print equals; else print not equals; ?> Ans: C Question 18 Which of the following attribute is needed for file upload via form? Ans: A Question 19 Late php versions support remote file accessing for the functions: Ans : D Question 20 Given below is a small php script: class person { function getSal() { } } class emp extends person { fucniton getSal() { ??? } } ?> the getSal() of emp has to behave exacltyle as getSal() of person . Which of the following lines of code would you use to replace the ???? Ans: A oDesk PHP 5 test answers What is true regarding this code? setcookie will return true Question: Which of the following is not a correct way of printing text in php5? echo "Plain text"; Question: Which of the following is not the correct way of starting a session? session_initiate()
Question: Which of the following functions do you need to implement HTTP Basic Authentication? None of the above Question: Which of the following Command Line Interface constant is not defined in the CLI SAPI? STDPRT Question: Which of the following statements is correct with regard to final and abstract? a. An abstract class cannot have final methods Question: Which composite data types are supported by php? Array Question: The default value of register_globals in PHP is: Off Question: Which of the following is not a valid PHP connection status? open Question: Choose the correct statement: include() includes and evaluates a specific file require_once() includes and evaluates a specific file only if it has not been included before posted by khalequzzaman Question: If the session_cache_expire() is not set, then by default the session cache will expire after: 3 hrs Question: What will be the output of the following script? $count=50; function Argument() { $count++; echo $count; } Argument(); ?>
It will print 1 Question: State whether True or False Paamayim Nekudotayim operator allows access only to the static members of a class? True Question: Which of the following statements is true with regard to comparisons in PHP5? With (===) operator, object variables are identical if and only if they refer to the same instance of the same class. Question: Which of the following built-in function assist in checking if actually the function exists or not? function_exists Question: What will be the output of the following code? $a = 0.0; for ($i = 0; $i < a ="=""> 1 Question: What will be the output of the following code? $i=4; $j=30; $k=0; $k=$j++/$i++; echo $i . " " . $j . " " . $k . " "; 5 31 7.5 Question: Which of the following is a not a correct way of commenting in php? /#PHP Comment Question: Following is a php code block: $m=9; $n=99; $z=8; $z=$n++/$m++ + --$z; echo $z; what will be the output? 18 Question:
Which of the following is the correct way of specifying default value? function GetDiscount($Type = "Special") { . . . } Question: With reference to the following php script: print 'Text Line1' print 'Text Line2' ?> What will be the output on running the script? Error message will be printed Question: What will be the ouput of the following code? for ($i = 0; $i < i ="=""> 0134 Question: Late PHP versions support remote file accessing for the functions: include_once() require_once() both of them Question: You have designed a user login form as follows: User Name: Password: How can you access the username entered by the user in the 'Validate.php' webpage? a. $var= $_POST['username']; b. $var= $_REQUEST['username']; c. import_request_variables('p', 'p_'); $var= $p_username; Both of them Question: Which of the following does not represent logical AND operator in PHP? & Question: Which of the following is not true for a persistent connection? These can't be converted to non-persistent connections Question: Which of the following are invalid data types in PHP? char Question: The Manager and Office classes are as follows:
class Manager{ function printName() { echo "Manager"; } } class Office{ function getManager() { return new Manager(); } } $ofc = new Office(); ??? ?> Which of the following should replace '???' to obtain the value of printName() function? $ofc->getManager()->printName(); Question: The classes are defined as follows:abstract class BaseCls{ protected abstract function getName(); } class ChildCls extends BaseCls{ } Which of the following implementations of getName() is invalid in ChildCls? public function getName(){} Question: Which of the following variable declarations within a class is invalid in PHP5? var $term =3; Question: What will be the output of following code? $arr = "a"; $arr[0]="b"; echo $arr; echo $arr[0]; bb Question: For the following code: the output will be: 171 Question:
What is the result of the following expression? 5+2 * 4+6 19 Question: What will be the output of following code? $var = 1 + "-1.3e3"; echo $var; -1299 Question: What will be the output of following code? $var1="a"; $$var1="b"; echo "$var1 $a"; ab Question: What is the output of the following code? $a = 500; $b = 200; echo $a % 2 * $b; ?> 0 Question: What will be the ouput of the following code? if (-1) print "true"; else print "false"; ?> true
Question: What will be the output of the following code? echo 12 . 6; 126 Question: Consider the following sample code: $x = 0xFFFE; $y = 2;
$z = $x && $y; What will be the value of $z? 1 Red is the ANSWERS
What is true regarding this code? setcookie will return true Question: Which of the following is not a correct way of printing text in php5? echo "Plain text"; Question: Which of the following is not the correct way of starting a session? session_initiate() Question: Which of the following functions do you need to implement HTTP Basic Authentication? None of the above Question: Which of the following Command Line Interface constant is not defined in the CLI SAPI? STDPRT Question: Which of the following statements is correct with regard to final and abstract? a. An abstract class cannot have final methods Question: Which composite data types are supported by php? Array Question: The default value of register_globals in PHP is: Off Question: Which of the following is not a valid PHP connection status? open Question: Choose the correct statement: include() includes and evaluates a specific file require_once() includes and evaluates a specific file only if it has not been included before
Question: If the session_cache_expire() is not set, then by default the session cache will expire after: 3 hrs Question: What will be the output of the following script? $count=50; function Argument() { $count++; echo $count; } Argument(); ?> It will print 1 Question: State whether True or False Paamayim Nekudotayim operator allows access only to the static members of a class? True Question: Which of the following statements is true with regard to comparisons in PHP5? With (===) operator, object variables are identical if and only if they refer to the same instance of the same class. Question: Which of the following built-in function assist in checking if actually the function exists or not? function_exists Question: What will be the output of the following code? $a = 0.0; for ($i = 0; $i < a ="=""> 1 Question: What will be the output of the following code? $i=4; $j=30; $k=0; $k=$j++/$i++; echo $i . " " . $j . " " . $k . " "; 5 31 7.5 Question: Which of the following is a not a correct way of commenting in php?
/#PHP Comment Question: Following is a php code block: $m=9; $n=99; $z=8; $z=$n++/$m++ + --$z; echo $z; what will be the output? 18 Question: Which of the following is the correct way of specifying default value? function GetDiscount($Type = "Special") { . . . } Question: With reference to the following php script: print 'Text Line1' print 'Text Line2' ?> What will be the output on running the script? Error message will be printed Question: What will be the ouput of the following code? for ($i = 0; $i < i ="=""> 0134 Question: Late PHP versions support remote file accessing for the functions: include_once() require_once() both of them Question: You have designed a user login form as follows: User Name: Password: How can you access the username entered by the user in the 'Validate.php' webpage? a. $var= $_POST['username']; b. $var= $_REQUEST['username']; c. import_request_variables('p', 'p_'); $var= $p_username; Both of them Question: Which of the following does not represent logical AND operator in PHP?
& Question: Which of the following is not true for a persistent connection? These can't be converted to non-persistent connections Question: Which of the following are invalid data types in PHP? char Question: The Manager and Office classes are as follows: class Manager{ function printName() { echo "Manager"; } } class Office{ function getManager() { return new Manager(); } } $ofc = new Office(); ??? ?> Which of the following should replace '???' to obtain the value of printName() function? $ofc->getManager()->printName(); Question: The classes are defined as follows:abstract class BaseCls{ protected abstract function getName(); } class ChildCls extends BaseCls{ } Which of the following implementations of getName() is invalid in ChildCls? public function getName(){} Question: Which of the following variable declarations within a class is invalid in PHP5? var $term =3; Question: What will be the output of following code? $arr = "a"; $arr[0]="b"; echo $arr;
echo $arr[0]; bb Question: For the following code: the output will be: 171 Question: What is the result of the following expression? 5+2 * 4+6 19 Question: What will be the output of following code? $var = 1 + "-1.3e3"; echo $var; -1299 Question: What will be the output of following code? $var1="a"; $$var1="b"; echo "$var1 $a"; ab Question:What is the output of the following code? $a = 500; $b = 200; echo $a % 2 $b; Question: What will be the ouput of the following code? if (-1) print "true"; else print "false"; ?> true Question: What will be the output of the following code? echo 12 . 6; 126 Question: Consider the following sample code:
$x = 0xFFFE; $y = 2; $z = $x && $y; What will be the value of $z? 1 Question: What is true regarding this code? Ans: setcookie will return true Question: Which of the following is not a correct way of printing text in php5? Ans: echo "Plain text"; Question: Which of the following is not the correct way of starting a session? Ans: session_initiate() Question: Which of the following functions do you need to implement HTTP Basic Authentication? Ans: None of the above Question: Which of the following Command Line Interface constant is not defined in the CLI SAPI? Ans: STDPRT Question: Which of the following statements is correct with regard to final and abstract? Ans: a. An abstract class cannot have final methods Question: Which composite data types are supported by php? Ans: Array Question: The default value of register_globals in PHP is: Ans: Off Question: Which of the following is not a valid PHP connection status? Ans: open Question: Choose the correct statement: Ans: include() includes and evaluates a specific file require_once() includes and evaluates a specific file only if it has not been included before
Question: If the session_cache_expire() is not set, then by default the session cache will expire after: Ans: 3 hrs Question: What will be the output of the following script? $count=50; function Argument() { $count++; echo $count; } Argument(); ?> Ans: It will print 1 Question: State whether True or False Paamayim Nekudotayim operator allows access only to the static members of a class? Ans: True Question: Which of the following statements is true with regard to comparisons in PHP5? Ans: With (===) operator, object variables are identical if and only if they refer to the same instance of the same class. Question: Which of the following built-in function assist in checking if actually the function exists or not? Ans: function_exists Question: What will be the output of the following code? $a = 0.0; for ($i = 0; $i < a ="=""> Ans: 1 Question: What will be the output of the following code? $i=4; $j=30; $k=0; $k=$j++/$i++; echo $i . " " . $j . " " . $k . " "; Ans: 5 31 7.5 Question:
Which of the following is a not a correct way of commenting in php? Ans: /#PHP Comment Question: Following is a php code block: $m=9; $n=99; $z=8; $z=$n++/$m++ + --$z; echo $z; what will be the output? Ans: 18 Question: Which of the following is the correct way of specifying default value? Ans: function GetDiscount($Type = "Special") { . . . } Question: With reference to the following php script: print 'Text Line1' print 'Text Line2' ?> What will be the output on running the script? Ans: Error message will be printed
Question: What will be the ouput of the following code? for ($i = 0; $i < i ="=""> 0134 Question: Late PHP versions support remote file accessing for the functions: Ans: include_once() require_once() both of them Question: You have designed a user login form as follows: User Name: Password: How can you access the username entered by the user in the 'Validate.php' webpage? a. $var= $_POST['username']; b. $var= $_REQUEST['username']; c. import_request_variables('p', 'p_'); $var= $p_username;
Ans: Both of them Question: Which of the following does not represent logical AND operator in PHP? Ans: & Question: Which of the following is not true for a persistent connection? Ans: These can't be converted to non-persistent connections Question: Which of the following are invalid data types in PHP? Ans: char
Question: The Manager and Office classes are as follows: class Manager{ function printName() { echo "Manager"; } } class Office{ function getManager() { return new Manager(); } } $ofc = new Office(); ??? ?> Which of the following should replace '???' to obtain the value of printName() function? Ans: $ofc->getManager()->printName(); Question: The classes are defined as follows:abstract class BaseCls{ protected abstract function getName(); } class ChildCls extends BaseCls{ } Which of the following implementations of getName() is invalid in ChildCls? Ans: public function getName(){} Question: Which of the following variable declarations within a class is invalid in PHP5? Ans: var $term =3; Question: What will be the output of following code? $arr = "a"; $arr[0]="b";
echo $arr; echo $arr[0]; Ans: bb Question: For the following code: the output will be: Ans: 171 Question: What is the result of the following expression? Ans: 5+2 * 4+6 Question: What will be the output of following code? $var = 1 + "-1.3e3"; echo $var; Ans: -1299 Question: What will be the output of following code? $var1="a"; $var1="b"; echo "$var1 $a"; Ans: a b Question:What is the output of the following code? $a = 500; $b = 200; echo $a % 2 * $b; ?> Ans: 0 Question: What will be the ouput of the following code? if (-1) print "true"; else print "false"; ?> Ans: true Question: What will be the output of the following code? echo 12 . 6; Ans: 126 Question: Consider the following sample code: $x = 0xFFFE; $y = 2; $z = $x && $y; What will be the value of $z?
Ans: 1 Question 1 The setrawcookie() method of setting cookie is different from php standard method of cookie setting as : Ans: C Question 2 IF visibility is not defined for a method /member then it is treated as public static. Ans: B Question 3 Which of the following is not a valid php connection status? Ans: C Question 4 Which of the following statements is not true with regard to abstract classes in php5? Ans : C Question 5 What will be the result of following operation? Print 4<<5; Ans: B Question 6 Which of the following type cast in not correct? $fig=23; $varbl=(real)$fig; $varb2=(double)$fig; $varb3=(decimal)$fig; $varb4=(bool)$fig; ?> Ans: C Question 7 What is the result of the following expression? 5+2*4+6 Ans: B Question 8 The classes are defined as follows Abstract class BaseCls( Protected abstract function getName(); } Class childCls extends BaseCls{ } Which of the following implementations of getName() in invalid in childCls?
Ans: D Question 9 Multiple select/load is possible with: Ans : A Question 10 State whether true or false Paamayim nekudotayim operator allows access only to the static members of a class? Ans: A Question 11 What is the output of the following code? $a=500; $b=200; echo $a % 2 * $b; ?> Ans: D Question 12 You need to heck the size of a file in php function . $size=X(filename); which function will suitable replace X? Ans: A Question 14 Which of the following is not true for a persistent connection? Ans: D Question 15 Which one is correct? Ans B Question 16 Which of the following in not a correct way of printing text in php 5 Ans: C Question 17 Which will be the output of the following code? $a=0.0; For($i=0;$i<10;$i++) $a+=0.1; print $a\n; if ($a==1.0) print equals; else print not equals;
?> Ans: C Question 18 Which of the following attribute is needed for file upload via form? Ans: A Question 19 Late php versions support remote file accessing for the functions: Ans : D Question 20 Given below is a small php script: class person { function getSal() { } } class emp extends person { fucniton getSal() { ??? } } ?> the getSal() of emp has to behave exacltyle as getSal() of person . Which of the following lines of code would you use to replace the ???? What is true regarding this code? setcookie will return true Question: Which of the following is not a correct way of printing text in php5? echo "Plain text"; Question: Which of the following is not the correct way of starting a session? session_initiate() Question: Which of the following functions do you need to implement HTTP Basic Authentication? None of the above Question: Which of the following Command Line Interface constant is not defined in the CLI SAPI? STDPRT
Question: Which of the following statements is correct with regard to final and abstract? Array Question: The default value of register_globals in PHP is: Off Question: Which of the following is not a valid PHP connection status? open Question: Choose the correct statement: include() includes and evaluates a specific file require_once() includes and evaluates a specific file only if it has not been included before Question: If the session_cache_expire() is not set, then by default the session cache will expire after: 3 hrs Question: What will be the output of the following script? $count=50; function Argument() { $count++; echo $count; } Argument(); ?> It will print 1 Question: State whether True or False Paamayim Nekudotayim operator allows access only to the static members of a class? True Question: Which of the following statements is true with regard to comparisons in PHP5? With (===) operator, object variables are identical if and only if they refer to the same instance of the same class. Question: Which of the following built-in function assist in checking if actually the function exists
or not? function_exists Question: What will be the output of the following code? $a = 0.0; for ($i = 0; $i < a ="=""> 1 Question: What will be the output of the following code? $i=4; $j=30; $k=0; $k=$j++/$i++; echo $i . " " . $j . " " . $k . " "; 5 31 7.5 Question: Which of the following is a not a correct way of commenting in php? /#PHP Comment Question: Following is a php code block: $m=9; $n=99; $z=8; $z=$n++/$m++ + --$z; echo $z; what will be the output? 18 Question: Which of the following is the correct way of specifying default value? function GetDiscount($Type = "Special") { . . . } Question: With reference to the following php script: print 'Text Line1' print 'Text Line2' ?> What will be the output on running the script? Error message will be printed Question: What will be the ouput of the following code? for ($i = 0; $i < i ="=""> 0134
Question: Late PHP versions support remote file accessing for the functions: include_once() require_once() both of them Question: You have designed a user login form as follows: User Name: Password: How can you access the username entered by the user in the 'Validate.php' webpage? a. $var= $_POST['username']; b. $var= $_REQUEST['username']; c. import_request_variables('p', 'p_'); $var= $p_username; Both of them Question: Which of the following does not represent logical AND operator in PHP? & Question: Which of the following is not true for a persistent connection? These can't be converted to non-persistent connections Question: Which of the following are invalid data types in PHP? char Question: The Manager and Office classes are as follows: class Manager{ function printName() { echo "Manager"; } } class Office{ function getManager() { return new Manager(); } } $ofc = new Office(); ??? ?> Which of the following should replace '???' to obtain the value of printName() function? $ofc->getManager()->printName();
Question: The classes are defined as follows:abstract class BaseCls{ protected abstract function getName(); } class ChildCls extends BaseCls{ } Which of the following implementations of getName() is invalid in ChildCls? public function getName(){} Question: Which of the following variable declarations within a class is invalid in PHP5? var $term =3; Question: What will be the output of following code? $arr = "a"; $arr[0]="b"; echo $arr; echo $arr[0]; bb Question: For the following code: the output will be: 171 Question: What is the result of the following expression? 5+2 * 4+6 19 Question: What will be the output of following code? $var = 1 + "-1.3e3"; echo $var; -1299 Question: What will be the output of following code? $var1="a"; $$var1="b"; echo "$var1 $a"; ab Question:What is the output of the following code? $a = 500;
$b = 200; echo $a % 2 * $b; ?> 0 Question: What will be the ouput of the following code? if (-1) print "true"; else print "false"; ?> true Question: What will be the output of the following code? echo 12 . 6; 126