Sie sind auf Seite 1von 17

01/06/2012

Zend PHP 5 Certification Practice Test 1 Life of Miz

Life of Miz
train of thoughts

Zend PHP 5 Certification Practice Test 1


I do not think Im perfect however if you spot a mistake do let me know. These are mock exam questions for Zend PHP5 certification. Ive posted it here so that others can practice and learn for the exam. more will be posted soon Q1. The following could be better represented as as what? <pp ?h i(a= 0 { f$ = ) }lef$ = 2){ esi(a = 0 }lef(a= 3){ esi $ = 0 } ? > Answer a) A switch statement without break statement b) A foreach statement c) A while statement d) A switch statement e) Multiple if statements My Ans: (d) Q2. The _________ keyword is used to indicate an incomplete class or method, which must be further extended and/or implemented in order to be used Answer:
getmizanur.wordpress.com/2010/07/13/zend-php-5-certification-practice-test-1/ 1/17

01/06/2012

Zend PHP 5 Certification Practice Test 1 Life of Miz

a) final b) protected c) incomplete d) abstract e) implements My Ans: (d) Q3. The _________ method in PDOStatement class is used to return the next result set in multi-query statement. My Ans: (nextRowSet) Q4. What is the output of this code <pp ?h $ra =ary001= '' . = '' ary ra(.0 > b, 1 > c) pitr$ra) rn_(ary ? > Answer: a) An empty array b) 0.001 => b, .1 => c c) 0 => c d) 0.001 => b, 0.1 => c e) A syntax error My Ans: ( C ) Q5. Name three new extensions in PHP5 Answer (Choose 3) a) tidy b) soap c) java d) curl e) mysqli My Ans: (a, c, d) Q6. What is the output of the following script

getmizanur.wordpress.com/2010/07/13/zend-php-5-certification-practice-test-1/

2/17

01/06/2012

Zend PHP 5 Certification Practice Test 1 Life of Miz

<pp ?h $ =1 a ; $ =25 b .; $ =0F; c xF $ =$ +$; d b c $ =$ +$; e d b $ =(d+$)%$; f $ e a pit(f+$) rn $ e ? > Answer a) 643.75 b) 432 c) 643 d) 257 e) 432.75 My Ans. (d) Q7. One can determine if it is possible to send HTTP headers from within PHP script using which of the following function? Answer a) apache_header_enabled() b) is_header_enabled() c) is_header_sent() d) headers_sent() e) headers_enabled() My Ans. (d) Q8. Type-hinting and the instanceof keyword can be used to check what types of things about variables? Answer (Choose 3) a) If a particular child class extends from it b) If they are instance of a particular interface c) If they are an abstract class d) If they have a particular parent class e) If they are instance of a particular class My Ans. (b, d, e) Q9. When embedding PHP into XML documents what must you ensure is true in order for
getmizanur.wordpress.com/2010/07/13/zend-php-5-certification-practice-test-1/ 3/17

01/06/2012

Zend PHP 5 Certification Practice Test 1 Life of Miz

things to function properly? Answer a) Disabling of the short_tags PHP.ini directive b) Enabling the asp_tags PHP.ini directive c) That you have XPath support enabled in PHP5 d) That your XML documents are well formed e) None of the above, PHP can be embedded in XML in all cases My Ans. (d) Q10. The following is a common XML structure used in service oriented architectures what does it represent? <xlvso=10 ? ?m ein. > <ehdal mtoCl> <ehnaemMto<mtoNm> mtoNm>yehd/ehdae <aas prm> <aa> prm <au>srn>I<srn>/au> vle<tigH!/tig<vle <prm /aa> <prm> /aas <mtoCl> /ehdal Answer a) None of the above b) A fragment of a complete SOAP request c) XML-RPC d) REST c) SOAP My Ans. ( c ) Q11. The MVC pattern in web development involves which of the following components? Answer (Choose 4) a) view b) controller c) validation d) model e) front controller My Ans. (a, b, d, e) Q12. What is the output of the following?

getmizanur.wordpress.com/2010/07/13/zend-php-5-certification-practice-test-1/

4/17

01/06/2012

Zend PHP 5 Certification Practice Test 1 Life of Miz

<pp ?h fnto a$ubr ucin (nme) { rtr ((nme)*$ubr; eun b$ubr nme) } fnto b&ubr ucin (nme) { +$ubr +nme; } eh a5; co () ? > Answer a) 0 b) 36 c) 6 d) 30 e) 5 My Ans. (a) Q13. PHP5 supports which of the following XML parsing method? Answer (Choose 4) a) SAX b) FastDOM c) DOM d) Xpath e) XML to object mapping My Ans. (a, c, d, e) Q14. Given the following array

getmizanur.wordpress.com/2010/07/13/zend-php-5-certification-practice-test-1/

5/17

01/06/2012

Zend PHP 5 Certification Practice Test 1 Life of Miz

<pp ?h $ =ary a ra( 1= e > rd, 're' gen, 'le, bu' 'upe = ary prl' > ra( 'os'= 'o' hue > dg, 'od = 'el, fo' > ma' 'ee = 'oe, hr' > gn' 'el'= ary hlo > ra( 5= 'ody' > gobe, 8= 'oehn' > smtig, 'orc' cret ) ) ) ; ? > Which out of the following print statements will output the string correct? Answer a) print $a['purple'][4][3] b) print $a['purple']['hello'][9] c) print $a[2][4][3] d) print $a[2][4][9] e) print $a[4]['hello'][9] Q14. What variable referecne would go in the spots indicated by ????? in the code segment below?

getmizanur.wordpress.com/2010/07/13/zend-php-5-certification-practice-test-1/

6/17

01/06/2012

Zend PHP 5 Certification Practice Test 1 Life of Miz

<pp ?h $s =h qikbonfxdjme oe telz dg; mg Te uc rw oe upd vr h ay o $tts=tu; sau re $evl=; rta fr$;ist???;$+){ o(i se(??) i+ i(sae { f$tt) $evl. srooe(??) rta = ttlwr???; }le es{ $evl. srope(??) rta = ttupr???; } $tt =!sae sae $tt; } pit$evl rn rta; ? > Answer a) $msg{$i} b) ord($msg); c) chr($msg); d) substr($msg, $i, 2); My Ans. (a) Q16. Where should indirectly executed PHP script (i.e. include files) be stored in the file system? Answer a) Outside of the document root b) In the document root c) Anywhere you want d) In the database My Ans. (a). Users can easily access files such as config and log files if they are in document folder so it is safer to have them outside the document root folder. Q17. What is the best approach to convert this string: $string =a=10&b[]=20&c=30&$d=40+50 Into this array?

getmizanur.wordpress.com/2010/07/13/zend-php-5-certification-practice-test-1/

7/17

01/06/2012

Zend PHP 5 Certification Practice Test 1 Life of Miz

Ary4 { ra() [a]= > srn()0 tig2 1 [b]= ary > ra( []= 0 > srn()0 tig2 2 ) , [c]= > srn()0 tig2 3 [d]= > srn()05 tig5 4 0 } Answer a) Writer a parser completely by hand, its the only way to make sure its 100% accurate b) Use the parse_str() function to translate it into an array() c) Pass the variable to another PHP script via HTTP GET request and return the variable as serialized variable d) Just call unserialize() to translate it into an array(). e) Write a string parser using strtok() and unserialize() to convert it to an array. My Ans. ( c ) Q18. Consider the following PHP string representing SQL statement: $query = UPDATE users SET password = $password WHERE username = $username; Which are the following values for username and password the behaviour of this query when executed? Answer a) None of the above b) $username = foobar\ WHERE username = admin; c) $password = foobar WHERE username = admin -:; d) $username = foobar WHERE username = admin; e) $username = \foobar\ WHERE username = \admin\; My Ans. ( c ) Q19. What does the following function do, when passed two integer values $p and $q?

getmizanur.wordpress.com/2010/07/13/zend-php-5-certification-practice-test-1/

8/17

01/06/2012

Zend PHP 5 Certification Practice Test 1 Life of Miz

<pp ?h fnto mgc$,$) ucin ai(p q { rtr (q= 0 eun $ = ) ?$ p :mgc$,$ %$) ai(q p q; } ? > Answer a) Loops infinity b) Switches the value $p and $q c) Determines if they are both even or odd d) Determines the greatest common divisor between them e) Calculates the modulus between the two My Ans. ( c ) Q20. Which function is best suited to removing mark up tags from a string? Answer a) strip_markup() b) strip_tags() c) str_replace() d) preg_replace() e) preg_strip() My Ans. (b) Q21. When uploading a file using HTTP, which variable can be used to locate the file on PHPs local filesystem? Answer a) None of the above b) $_FILES['fieldname']['tmp_name'] c) $_FILES['fieldname'] d) $_FILES['fieldname'][0]['filename'] e) $_FILES['fieldname']['filename'] My Ans. (b) Q22. Given the two values below, which of the following possibilities will print 10 foos20 bars?

getmizanur.wordpress.com/2010/07/13/zend-php-5-certification-practice-test-1/

9/17

01/06/2012

Zend PHP 5 Certification Practice Test 1 Life of Miz

<pp ?h $a1=0fo vr 1 os; $a2=0br vr 2 as; pit??? rn ??; ? > Answer (Choose 2) a) None of the above b) implode(, array($var1, $var2)) c) $var1 . $var2 d) $var1 + $var2 e) All of the above My Ans. (b, c) Q23. During normal filesystem access, the _______ function is used to determine if the pointer has reached the end of the file Answer a) feof() b) flock(); c) fclose(); d) fend(); e) None of the above My Ans. (a) Q24. What is wrong with the following code snippet? Assume default configuration value apply? <pp ?h $p=fokpn'w.h.e' 8) f scoe(wwppnt, 0 frt(f,E /HT/.\\Hs:wwppntrn) wie$p GT TP10rnot w.h.e\\; $aa=fed$p 89) dt ra(f, 12; ? > Answer a) The request is blocking and may cause fread() to hang b) The HTTP request is malformed c) The script should be rewritten using fgets() instead of fread() d) The request is non-blocking and fread() may miss the response e) You cannot use fwrite() with fsockopen()
getmizanur.wordpress.com/2010/07/13/zend-php-5-certification-practice-test-1/ 10/17

01/06/2012

Zend PHP 5 Certification Practice Test 1 Life of Miz

My Ans. (a) Q25. When checking to see if two variable contains the same instance of an object which of the following comparison should be used? Answer a) if($obj1->equals($obj2) && ($obj1 instanceof $obj2)) b) if($obj1->equals($obj2)) c) if($obj1 === $obj2) d) if($obj1 instanceof $obj2) e) if($obj1 == $obj2) My Ans. ( c ) Q26. What is the output of the following code? <pp ?h fnto fntoSlt) ucin ucinpi( { $r =1 pe ; ? > <pp ?h eh $r; co pe } fntoSlt) ucinpi(; ? > Answer a) Error; function cannot be split over multiple segments b) Nothing c) 1 d) 2 My Ans. ( c ) Q27. Identify the best approach to compare to variable in binary-safe fashion Answer a) Both strcomp() and $a === $b b) $a == $b c) $a === $b d) str_compare() e) strstr()
getmizanur.wordpress.com/2010/07/13/zend-php-5-certification-practice-test-1/ 11/17

01/06/2012

Zend PHP 5 Certification Practice Test 1 Life of Miz

My Ans. (a) Q28. What is the output of the following? <pp ?h fnto 1oEc(n ucin dtah$) { i(n>0 f$ ) { 1oEc(-n; dtah-$) eh co .; }le es { rtr $; eun n } } 1oEc() dtah4; ? > Answer a) 0 b) Parse Error; Syntax error c) .. d) . e) My Ans. (b) Q29 Which of the following are not valid ways to embed a variable into a string? Answer (Choose 2) a) $a = Value: $value->getValue() b) $a = Value: {$value} c) $a = Value: $value d) $a = Value: $value e) $a = Value: {$value['val']} My Ans. (a, c) Q30. Consider the following code segment:

getmizanur.wordpress.com/2010/07/13/zend-php-5-certification-practice-test-1/

12/17

01/06/2012

Zend PHP 5 Certification Practice Test 1 Life of Miz

<pp ?h $mdt =<<M xlaa <XL <xlvrin.ecdn=IO85-? ?m eso=10 noigS-891 > <DCYEhm PBI "/WC/T XTL10Tastoa/E" !OTP tl ULC -/3/DD HM . rniinl/N "tp/www.r/Rxtl/T/hm1tastoa.t" ht:/w.3ogT/hm1DDxtl-rniinldd> <tlxls"tp/www.r/99xtl xlln=e"ln=e" hm mn=ht:/w.3og19/hm" m:ag"n ag"n> <ed ha> <il>ita Lbay/il> tteVrul irr<tte <ha> /ed <oy bd> <>oe t < he=ht:/xml.r/>xml.r<a./> pMvd o a rf"tp/eapeog"eapeog/><p <bd> /oy <hm> /tl XL M; $m =xlpre_raeT-; xl m_asrcet(UF8) ???? ??? xlpre$m,$mdt) m_as(xl xlaa fnto xlsathnlr$m,$a,$trbt) ucin m_tr_ade(xl tg atiue { pita:$a<r>n; rn Tg tgb/\ } fnto xledhnlr$m,$a) ucin m_n_ade(xl tg { } ? > What should be placed in place of ??????? above to have the above script display the name of each tag within the XML document? Answer a) xml_set_callback(xml_start_handler) b) xml_set_element_handler($xml, xml_start_handler, xml_end_handler) c) xml_node_set_handler(xml_start_handler, xml_end_handler); d) xml_node_set_handler(xml_start_handler); My Ans. (b) Q31. Consider the following series of classes and interfaces

getmizanur.wordpress.com/2010/07/13/zend-php-5-certification-practice-test-1/

13/17

01/06/2012

Zend PHP 5 Certification Practice Test 1 Life of Miz

<pp ?h itraeMItrae{ nefc ynefc pbi fnto gtilAduhr) ulc ucin eTtenAto(; } casMCas{ ls yls piae$ato; rvt _uhr piae$tte rvt _il; pbi fnto gtuhr){ ulc ucin eAto( rtr $hs>ato; eun ti-_uhr } pbi fnto gtil( { ulc ucin eTte) rtr $hs>tte eun ti-_il; } } casMCas { ls yls2 piae$isac; rvt _ntne pbi fnto _cntutMCas$){ ulc ucin _osrc(yls a $hs>isac =$; ti-_ntne a } pbi fnto gtilAduhr){ ulc ucin eTtenAto( $evl=ary rta ra( 'il'= $hs>isac-gtil(, tte > ti-_ntne>eTte) 'uhr = $hs>isac-gtuhr) ato' > ti-_ntne>eAto( ) ; rtr $evl eun rta; } } casMCas { ls yls3 pbi fnto dSmtigMItrae$ntne { ulc ucin ooehn(ynefc isac) $au =$ntne>eTtenAto(; vle isac-gtilAduhr) } } ? > MyClass2 is an example of the _______ design pattern My Ans. Registry Pattern
getmizanur.wordpress.com/2010/07/13/zend-php-5-certification-practice-test-1/ 14/17

01/06/2012

Zend PHP 5 Certification Practice Test 1 Life of Miz

Q32. The _______ function is used to modify the amount of time PHP will wait for a stream before timing out during reading or writing My Ans. stream_set_timeout() Q33. The _______ keyword used to block any overriding of a class/method by subclass Answer a) static b) None of the above c) protected d) final e) private My Ans. (d) Q34. In a general sense, which is more important: performance or maintainability of an application Answer a) Performance first, maintainability second b) Maintainability first, performance second c) Maintainability d) Performance My Ans. (b) Q35. When connecting to a database using PDO, what must be done to ensure that database credentials are not compromised if the connection where to fail. Answer a) Wrap the PDO DSN in a try/catch block to catch any connection exception b) Use constants in the PDO DSN c) Place login credentials in the php.ini file d) Disable E_STRICT and E_NOTICE error reporting levels My Ans. (a) Q36. The _______ construct is particularly useful to assign your own variable names to values with in an array. Answer a) array_get_variables b) current c) each d) import_variables e) list
getmizanur.wordpress.com/2010/07/13/zend-php-5-certification-practice-test-1/ 15/17

01/06/2012

Zend PHP 5 Certification Practice Test 1 Life of Miz

My Ans. (e) Q37. What is the output of the following script <pp ?h casCasn { ls lsOe poetd$ =1; rtce a 0 pbi fnto cagVle$){ ulc ucin hneau(b $hs> =$; ti-a b } } casCasw { ls lsTo poetd$ =1; rtce b 0 pbi fnto cagVle$){ ulc ucin hneau(b $hs> =1; ti-b 0 prn:cagVle$hs> +$hs>) aet:hneau(ti-a ti-b; } pbi fnto dslyaus){ ulc ucin ipaVle( pit:{ti-a b {ti-b\ rn a $hs>} : $hs>}n; } } $b =nwCasw(; oj e lsTo) $b-cagVle2) oj>hneau(0; $b-cagVle1) oj>hneau(0; $b-dslyaus) oj>ipaVle(; ? > Answer a) a: 30 b: 30 b) a: 30 b: 20 c) a: 30 b: 10 d) a: 20 b: 20 e) a: 10 b:10 My Ans. ( c ) Q38. Consider the following PHP script fragment:

getmizanur.wordpress.com/2010/07/13/zend-php-5-certification-practice-test-1/

16/17

01/06/2012

Zend PHP 5 Certification Practice Test 1 Life of Miz

<pp ?h $il =$o-cetEeet'il'; tte dm>raelmn(tte) $oe=???? nd ??? $il-apnCid$oe; tte>pedhl(nd) $ed>pedhl(tte; ha-apnCid$il) ? > What should ??????? be replaced with to add a

getmizanur.wordpress.com/2010/07/13/zend-php-5-certification-practice-test-1/

17/17

Das könnte Ihnen auch gefallen