0

web technology Online Quiz - 36

Description: web technology Online Quiz - 36
Number of Questions: 20
Created by:
Tags: web technology
Attempted 0/20 Correct 0 Score 0

Which of the following statement produce different output

  1. print "This is php example";


Correct Option: C

Which of the following delimiter is ASP style?

  1. NONE

  2. ?>


Correct Option: B

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!


Correct Option: C

Which of following commenting is supported by Php

  1. Single line c++ syntax - //

  2. Shell syntax - #

  3. Both of above

  4. None of above


Correct Option: C

AI Explanation

To answer this question, you need to have knowledge about the syntax and commenting options available in PHP.

Option A) Single line C++ syntax - //

This option is correct. PHP supports single-line comments using the double forward slash (//) syntax, similar to the C++ language.

Option B) Shell syntax - #

This option is also correct. PHP supports single-line comments using the hash symbol (#) syntax, which is commonly used in shell scripting.

Option C) Both of above

This option is correct. PHP supports both single-line C++ syntax (//) and shell syntax (#) for commenting.

Option D) None of above

This option is incorrect. PHP does support both single-line C++ syntax (//) and shell syntax (#) for commenting.

Therefore, the correct answer is C) Both of above. This option is correct because PHP supports both single-line C++ syntax (//) and shell syntax (#) for commenting.

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

  1. Php print ("

    I love the summer time

    ";?>

  2. Php $ season="summer time"; print"

    I love the $ season

    "; ?>

  3. I love the summer time ; ecdho $ message; ?>

  4. All of above


Correct Option: D

Which of following function return 1 when output is successful?

  1. echo ( )

  2. print ( )

  3. both

  4. None


Correct Option: B

AI Explanation

To answer this question, we need to understand the differences between the echo() and print() functions in PHP.

Option A) echo() - This option is incorrect because the echo() function does not return a value. It simply outputs the provided string or variable to the screen.

Option B) print() - This option is correct because the print() function returns a value of 1 if the output is successful. It also outputs the provided string or variable to the screen.

Option C) Both - This option is incorrect because although both echo() and print() can be used to output values to the screen, only the print() function returns a value of 1 when the output is successful.

Option D) None - This option is incorrect because the print() function returns a value of 1 when the output is successful.

Therefore, the correct answer is B) print().

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


Correct Option: C

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

  1. % a

  2. % b

  3. % c

  4. % d


Correct Option: A

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

  1. echo ( )

  2. print ( )

  3. print f ( )

  4. s print f ( )


Correct Option: D

AI Explanation

To answer this question, you need to understand the different ways to output or display data in programming.

Let's go through each option to understand why it is correct or incorrect:

Option A) echo() - This option is incorrect because the echo() function does not assign the output to a variable. It simply outputs the data to the screen.

Option B) print() - This option is incorrect because the print() function also does not assign the output to a variable. It only prints the data to the screen.

Option C) printf() - This option is incorrect because printf() is a function in C programming language, not in PHP. It is used to format and print data to the screen, but it does not assign the output to a variable in PHP.

Option D) sprintf() - This option is correct because the sprintf() function in PHP can assign the formatted output to a string variable. It allows you to format data and store it in a string variable for further use.

The correct answer is Option D) sprintf(). This option is correct because it assigns the output to a string variable.

Note: It is important to mention that the correct answer may vary depending on the programming language you are using. In this case, the correct answer is for PHP.

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

  1. Array

  2. String

  3. Float

  4. Boolean


Correct Option: A

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

  1. Array

  2. String

  3. Float

  4. Boolean


Correct Option: A

If a boolean variable $ alive= 5;

  1. $ alive is false

  2. $ alive is true

  3. $ alive is overflow

  4. the statement is snot valid


Correct Option: B

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


Correct Option: D

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


Correct Option: C

Trace the odd data type

  1. floats

  2. integer

  3. doubles

  4. Real number


Correct Option: B

Which of the folowing are valid float values?

  1. 4.5678

  2. 4.0

  3. 7e4

  4. All of above


Correct Option: D

In php string data are

  1. delimited by single quote

  2. delimited by double quote

  3. delimited by <<< identifier

  4. All of above


Correct Option: D

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


Correct Option: C

AI Explanation

To answer this question, you need to understand the concept of string interpolation and the different delimiting methods for strings.

String interpolation is a method of constructing a new string by including expressions or variables within a string literal. This allows for dynamic string creation based on the values of the expressions or variables.

Let's go through each option to understand why it is correct or incorrect:

Option A) Delimited by single quote - This option is incorrect. Strings delimited by single quotes in many programming languages do not support string interpolation. Instead, they are treated as string literals and do not evaluate expressions or variables within them.

Option B) Delimited by double quote - This option is incorrect. Although strings delimited by double quotes can support string interpolation in some programming languages, it is not universally true. Some programming languages use double quotes for string literals without string interpolation.

Option C) Delimited by <<< identifier - This option is correct. This is the delimiting method known as "here documents" or "heredoc" syntax. It is often used in programming languages like PHP to define strings that support string interpolation. The <<< identifier is used to start the heredoc, and the string is terminated by the same identifier on a line by itself.

Option D) All of the above - This option is incorrect. Only option C, delimited by <<< identifier, is known as string interpolation. The other options do not universally support string interpolation.

The correct answer is C) delimited by <<< identifier. This option is correct because it represents a specific delimiting method that supports string interpolation.

Which datatypes are treaded as arrays

  1. Integer

  2. Float

  3. String

  4. Booleans


Correct Option: C

Which of following are compound data type?

  1. Array

  2. Objects

  3. Both

  4. None


Correct Option: C
- Hide questions