PHP basic test questions (6 ~ 10)

Source: Internet
Author: User
Mesh 22:09:46 reply to Top Modification and Deletion
6. What is the output of the following script? $ A = 10; $ B = 20; $ c = 4; $ d = 8; $ e = 1.0; $ F = $ C + $ D * 2; $ G = $ F % 20; $ H = $ B-$ A + $ C + 2; $ I = $ H <$ C; $ J = $ I * $ E; print $ J;?> A.128b. 42C. 242.0d.256e.342 7. Which values shoshould be assigned to the variables $ A, $ B and $ C in order for the followingscript to display the string Hello, world !? $ String = "Hello, world! "; $ A = ?; $ B = ?; $ C = ?; If ($ A) {if ($ B &&! $ C) {echo "Goodbye cruel world! ";} Else if (! $ B &&! $ C) {echo "nothing here" ;}} else {If (! $ B) {If (! $ &&(! $ B & $ C) {echo "Hello, world! ";} Else {echo" Goodbye World! ";}} Else {echo" Not quite. ";}}?> A. False, true, falseb. True, true, falsec. False, true, trued. False, false, truee. True, true, true 8. What will the following Script output? $ Array = '0123456789abcdefg '; $ S = ''; For ($ I = 1; $ I <50; $ I ++) {$ S. = $ array [rand (0, strlen ($ array)-1)];} echo $ s;?> 16php programming basicsa. A string of 50 random charactersb. A string of 49 copies of the same character, because the random number generator has not been initializedc. A string of 49 random charactersd. nothing, because $ array is not an arraye. A string of 49 'G' characters 9. which language construct can best represent the following series of if conditionals? If ($ A = 'A') {somefunction ();} else if ($ A = 'B') {anotherfunction ();} else if ($ A = 'C') {dosomething () ;}else {donothing () ;}?> A. A switch statement without a default caseb. A recursive function callc. A While statementd. it is the only representation of this logice. A switch statement using a default case 10. what is the best way to iterate through the $ myarray array, assuming you want to modify thevalue of each element as you do? $ Myarray = array ("My string", "another string", "Hi, Mom! ");?> A. Using a for loopb. Using a foreach loopc. Using a while loopd. Using a do... While loope. There is no way to accomplish this goal
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.