PHP Data Types and Output Functions

Tests knowledge of PHP data types, string handling, output functions, commenting, and code delimiters.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of the following statement produce different output

  1. <?echo "This is php example"; ?>
  2. <P="This is php example"; ?>
  3. <?PHP echo "This is php example"; php?>
  4. <script language="php"> print "This is php example";</script>
Question 2 Multiple Choice (Single Answer)

Which of the following delimiter is ASP style?

  1. NONE
  2. <% %>
  3. <? ?>
  4. <script language="php"> </script>
Question 3 Multiple Choice (Single Answer)

Php supports all four different ways of delimiting. In this context identify the false statement

  1. You can use any of the delimiting style
  2. You can use different delimiting styles in same page
  3. You can use any delimiting style but must use a single style consistently for a page
  4. Variables declared in previous blocks are remenbered on later blocks too!
Question 4 Multiple Choice (Single Answer)

Which of following commenting is supported by Php

  1. Single line c++ syntax - //
  2. Shell syntax - #
  3. Both of above
  4. None of above
Question 5 Multiple Choice (Single Answer)

To produce the output6 I love the summer time, Which of the ofllowing statement should be used?

  1. <? Php print ("<P> I love the summer time</p>";?>
  2. <? Php $ season="summer time"; print"<p> I love the $ season</p>"; ?>
  3. <?Php $ message="<p> I love the summer time </p>; ecdho $ message; ?>
  4. All of above
Question 6 Multiple Choice (Single Answer)

Which of following function return 1 when output is successful?

  1. echo ( )
  2. print ( )
  3. both
  4. None
Question 7 Multiple Choice (Single Answer)

Which of followng statement is more suitable if you want to output a blend of static text and dynamic information stored within one or several variables?

  1. echo ( )
  2. print ( )
  3. Print f ( )
  4. None of above
Question 8 Multiple Choice (Single Answer)

Which of the following type specifier is invalid in print f ( ) functions

  1. % a
  2. % b
  3. % c
  4. % d
Question 9 Multiple Choice (Single Answer)

Which of the following function can assign the output to a string variable

  1. echo ( )
  2. print ( )
  3. print f ( )
  4. s print f ( )
Question 10 Multiple Choice (Single Answer)

Which of the following data type is not seal or datetype supported by PHP

  1. Array
  2. String
  3. Float
  4. Boolean
Question 11 Multiple Choice (Single Answer)

Which of the following data type is compound datatype supported by PHP

  1. Array
  2. String
  3. Float
  4. Boolean
Question 12 Multiple Choice (Single Answer)

If a boolean variable $ alive= 5;

  1. $ alive is false
  2. $ alive is true
  3. $ alive is overflow
  4. the statement is snot valid
Question 13 Multiple Choice (Single Answer)

For integer data type PHP 6 introduced

  1. 8 bit integer value
  2. 16 bit integer value
  3. 32 bit integer value
  4. 64 bit integer value
Question 14 Multiple Choice (Single Answer)

For integer data type PHP 5 and earlier supported

  1. 8 bit integer value
  2. 16 bit integer value
  3. 32 bit integer value
  4. 64 bit integer value
Question 15 Multiple Choice (Single Answer)

Trace the odd data type

  1. floats
  2. integer
  3. doubles
  4. Real number
Question 16 Multiple Choice (Single Answer)

Which of the folowing are valid float values?

  1. 4.5678
  2. 4.0
  3. 7e4
  4. All of above
Question 17 Multiple Choice (Single Answer)

In php string data are

  1. delimited by single quote
  2. delimited by double quote
  3. delimited by <<< identifier
  4. All of above
Question 18 Multiple Choice (Single Answer)

Which of the following delimiting method is known as string Interpolation

  1. delimited by single quote
  2. delimited by double quote
  3. delimited by <<< identifier
  4. All of above
Question 19 Multiple Choice (Single Answer)

Which datatypes are treaded as arrays

  1. Integer
  2. Float
  3. String
  4. Booleans
Question 20 Multiple Choice (Single Answer)

Which of following are compound data type?

  1. Array
  2. Objects
  3. Both
  4. None