Akchodhary.files.wordpress.com



Q1. Choose a syntax for PHP Ternary Operator from the list.A) condition ? expression1 : expression2B) condition : expression1 ? expression2C) condition ? expression1 < expression2D) condition < expression1 ? expression2Q2. Choose PHP Conditional Operator from the list.A) ?:B) :?C) :<D) <:Q3. What is the output of the PHP code.?<?php $a=0; $a = 5<2 ? 4 : 3; print($a);?>A) 4B) 3C) 5D) 2Q4.What is the output of the PHP code.?<?php $a=0; $a = print("4"); print($a);?>A) 04B) compiler errorC) 40D) 41Q5. What is the output of the PHP code.?<?php $a=0; $a = 5>2 ? print("4"): 3; print($a);?>A) compiler errorB) 14C) 41D) 0Q6. What is the output of the PHP code.?<?php $a=0; $a = 5>2 ? : 3; print($a);?>A) 0B) 1C) 8D) compiler errorQ7. What is the output of the PHP code.<?php $a=0; $a = 5>2 ?$b=6 : $b=8; print($a $b);?>A) 6 6B) 0 6C) 0 8D) compiler errorQ8. Choose a code to use C If Else code.A) else if is compulsory to use with if code.B) else is compulsory to use with if code.C) else or else if is optional with if code.D) None of the aboveQ9. What is the output of the PHP code.<?php if(4>5){print("Hurray..\n");}print("yes");?> A) YesB) Hurray..YesC) Hurray..YesD) Compiler errorQ10. What is the output of the PHP code.<?php if(4>5)print("Hurray..\n");print("yes");?>A) YesB) Hurray..YesC) Hurray..YesD) No OutputQ11. What is the output of the PHP code.<?phpif(4>5)print("Hurray..\n");print("yes");elseprint("England");?> A) Hurray..YesB) Hurray..YesC) Compiler errorD) None of the aboveQ12. What is the output of the PHP code.<?phpif(10< 9)print("Hurray..\n");else if(4>2)print("England");?> A) EnglandB) Hurray..C) Compiler error for missing elseD) None of the above Q13. What is the output of the PHP code.<?phpif(10> 9)print("Singapore\n"); else if(4%2 == 0) print("England\n"); print("Poland");?> A) SingaporeB) Singapore PolandC) Singapore England PolandD) England PolandQ14. What is the output of the PHP code.<?phpif(-5) { print("Germany\n"); } if(5) { print("Texas\n"); } printf("ZING");?> A) ZINGB) Texas ZINGC) Germany Texas ZINGD) Compiler error as a number can not be put as condition inside IF.Q15. What is the output of the PHP code.<?phpif("abc") { print("India\n"); } if('c') { print("Honey\n"); } print("ZING");?> A) ZINGB) HoneyZINGC) IndiaZINGD) India Honey ZINGQ16. What is the output of the PHP code.<?phpif(true) { print("India\n"); } if(TRUE) { print("Honey\n"); } print("ZING");?> A) ZINGB) HoneyZINGC) IndiaZINGD) India Honey ZINGQ17. If $a = 12 what will be returned when echo "($a == 12) ? 5 : 1" is executed?A. 12B. 1C. ErrorD. 5Q18. Which of the following PHP statements will output Hello World on the screen?(i) echo (“Hello World”);(ii) print (“Hello World”);(iii) printf (“Hello World”);(iv) sprintf (“Hello World”);A. (i) and (ii)B. (i), (ii) and (iii)C. All of the mentionedD. (i), (ii) and (iv)Q19. What will be the output of the following PHP code?< ?php $total = "25 students";$more = 10;$total = $total + $more;echo "$total" ;?>A. ErrorB. 35 studentsC. 35D. 25 studentsQ20. Which of the following must be installed on your computer so as to run PHP script?i) Adobe Dreamweaverii) PHPiii) Apacheiv) IISA. All of the mentionedB. Only (ii)C. (ii) and (iii)D. (ii), (iii) and (iv)Q21. 9. We can use ___ to comment a single line?i) /?ii) //iii) #iv) /* */A. Only (ii)B. (i), (iii) and (iv)C. (ii), (iii) and (iv)D. Both (ii) and (iv)Q22. Which of the below symbols is a newline character?A. \rB. \nC. /nD. /rQ23. 1. What does PHP stand for?i) Personal Home Pageii) Hypertext Preprocessoriii) Pretext Hypertext Processoriv) Preprocessor Home PageA. Both (i) and (ii)B. Both (ii) and (iv)C. Only (ii)D. Both (i) and (iii)Q24. Who is the father of PHP?A. Rasmus LerdorfB. Willam MakepieceC. Drek KolkeviD. List BarelyQ25. Which of the following is correct about PHP?A. PHP performs system functions, i.e. from files on a system it can create, open, read, write, and close them.B. PHP can handle forms, i.e. gather data from files, save data to a file, thru email you can send data, return data to the user.C. You add, delete, modify elements within your database thru PHP.D. All of the above.Q26. Which of the following type of variables are whole numbers, without a decimal point, like 4195?A. IntegersB. DoublesC. BooleansD. StringsQ27. Which of the following is correct about constants?A. To define a constant you have to use define() function.B. To retrieve the value of a constant, you have to simply specify its name.C. Both of the above.D. None of the above.Q28. Which of the following is true about php variables?A. All variables in PHP are denoted with a leading dollar sign ($).B. The value of a variable is the value of its most recent assignment.C. Variables are assigned with the = operator, with the variable on the left-hand side and the expression to be evaluated on the right.D. All of the above.Q29. Which of the following is true about php variables?A. Variables can, but do not need, to be declared before assignment.B. Variables in PHP do not have intrinsic types - a variable does not know in advance whether it will be used to store a number or a string of characters.C. Variables used before they are assigned have default values.D. All of the above.Q30. Which of the following is correct about variable naming rules?A. Variable names must begin with a letter or underscore character.B. A variable name can consist of numbers, letters, underscores.C. you cannot use characters like + , - , % , ( , ) . & , etc in a variable name.D. All of the above.Q31. Which of the following is correct about determine the "truth" of any value not already of the Boolean type?A. If the value is a number, it is false if exactly equal to zero and true otherwise.B. If the value is a string, it is false if the string is empty (has zero characters) or is the string "0", and is true otherwise.C. Values of type NULL are always false.D. All of the above.Q32. Which of the following is correct about determine the "truth" of any value not already of the Boolean type?A. If the value is an array, it is false if it contains no other values, and it is true otherwise. For an object, containing a value means having a member variable that has been assigned a value.B. Valid resources are true (although some functions that return resources when they are successful will return FALSE when unsuccessful).C. Don't use double as Booleans.D. All of the above.Q33. Which of the following is correct about NULL?A. NULL is a special type that only has one value: NULL.B. The special constant NULL is capitalized by convention, but actually it is case insensitive.C. Both of the above.D. None of the above.Q34. Which of the following is correct about NULL?A. A variable that has been assigned NULL evaluates to FALSE in a Boolean context.B. A variable that has been assigned NULL returns FALSE when tested with IsSet() function.C. Both of the above.D. None of the above.Q35. Which of the following is correct about constants?A. To define a constant you have to use define() function.B. To retrieve the value of a constant, you have to simply specify its name.C. Both of the above.D. None of the above.Q36. Which of the following is correct about constants?A. Unlike with variables, you do not need to have a constant with a $.B. Only scalar data (boolean, integer, float and string) can be contained in constants.C. Both of the above.D. None of the above.Q37. Which of the following is used to add comments in PHP?A. //B. /* … */C. & … &D. Only A & BQ38. How PHP files can be accessed?A. Through Web BrowserB. Through HTML filesC. Through Web ServerD. All of Above Q39. What is the use of strlen( ) function in PHP?A. It returns the type of a stringB. It returns the value of a stringC. It returns the length of a stringD. It returns the subset value of a stringQ40. What is the use of strpos( ) function in PHP?A. Search for a number within a stringB. Search for a Spaces within a stringC. Search for a character/text within a stringD. Search for a Capitalized string/text with in a stringQ41. Which of the following is the Concatenation Operator in PHP?A. + (Plus)B. . (dot) C. & (Ampersand)D. % (Percentage)Q42. What does the hash (#) sign mean in PHP?A. It indicates lines that are commented out.B. It indicates variable declaration.C. It indicates function declaration.D. No uses in PHP.Q43. How to define a variable in PHP?A. $variable_name = valueB. $variable_name = value;C. $variable_name == value;D. $variable_name as value;Q44. The uses of strcmp( ) function in PHP?A. It compare strings including caseB. It compare strings excluding caseC. It compare strings only UppercaseD. It compare strings only lowercaseQ45. PHP Scripts starts with ________A. <php> … </php>B. <?php …. ?>C. ?php … ?phpD. <p> … </p>Q46. Which of the following statements prints in PHP?A. OutB. WriteC. EchoD. DisplayQ47. In PHP, each statement must be end with ______A. . (dot)B. ; (semicolon)C. / (slash)D. : (colon)Q48. In PHP Language variables are case sensitiveA. TrueB. FalseC. Depends on websiteD. Depends on serverQ49. Which of the following is/are the valid identifiersi) !sum ii) Size iii) _variable iv) 4countA) i and ii onlyB) ii and iii onlyC) iii and iv onlyD) i, ii and iii onlyQ50. The ………………… function in PHP defines a constant by assigning a value to a name.A) define( )B) const( )C) constant( )D) define_constant( )Q51. ……………….. are particularly useful when working with values that definitely will not require modification.A) ConstantsB) VariablesC) ExpressionsD) KeywordsQ52. Which of the following is/are the examples of expressions used in PHP.i) $abc=10; ii) $sum=100+$first_sum; iii) $adder++;A) i and ii onlyB) ii and iii onlyC) i and iii onlyD) All i, ii and iii Q53. …………………. in PHP offers a convenient means for outputting large amounts of text.A) HeredocB) NewdocC) LargedocD) OlddocQ54. State whether the following statements about Heredoc syntax are True or False.i) The opening identifier must be preceded with three left angle brackets (<<<)ii) It can be preceded by spaces or any other extraneous character.A) True, FalseB) False, TrueC) False, FalseD) True, True25 d 27 c 30 D 31 D 32D 33 C 34 C 35 C 36 C ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download