0

web technology Online Quiz - 110

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

What is a Universe

  1. Semantic Layer

  2. Database

  3. Reporting Layer

  4. Schema type


Correct Option: A

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

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, 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 return a value. It simply outputs the given string or variable to the browser or console.

Option B) print() - This option is correct because the print() function outputs the given string or variable to the browser or console, and returns a value of 1 if the output is successful.

Option C) both - This option is incorrect because only the print() function returns a value of 1 when the output is successful. The echo() function does not return a value.

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

Therefore, the correct answer is B) print(). This option is correct because the print() function returns a value of 1 when the output is successful.

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. Printf()

  4. none


Correct Option: C

Which of the following type specifier is invalid in printf() functions?

  1. %a

  2. %b

  3. %c

  4. %d


Correct Option: A

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

In mail($param2, $param2, $param3, $param4), the $param2 contains:

  1. The message

  2. The subject

  3. The header

  4. The recipient


Correct Option: A

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) The message - This option is correct because in the mail() function, the $param2 parameter represents the message that will be sent in the email.

Option B) The subject - This option is incorrect because the $param2 parameter does not represent the subject of the email. The subject is typically passed as the $param3 parameter in the mail() function.

Option C) The header - This option is incorrect because the $param2 parameter does not represent the header of the email. The header information is typically set separately using additional functions or headers parameter in the mail() function.

Option D) The recipient - This option is incorrect because the $param2 parameter does not represent the recipient of the email. The recipient's email address is typically passed as the $param1 parameter in the mail() function.

The correct answer is Option A) The message. This option is correct because the $param2 parameter in the mail() function represents the message that will be sent in the email.

When uploading a file if the UPLOAD_ERR-OK contains value 0 it means?

  1. Uplaod is not successful, error occurred

  2. The file uploaded with success

  3. Uploaded file size is 0

  4. File upload progress is 0% completed


Correct Option: B

fopen($file_doc,"r+"); opens a file for?

  1. reading

  2. writing

  3. none of above

  4. both of above


Correct Option: D

To work with remote files in PHP you need to enable?

  1. allow_url_fopen

  2. allow_remote_files

  3. both of above

  4. none of above


Correct Option: A

AI Explanation

To work with remote files in PHP, you need to enable the allow_url_fopen directive.

Option A) allow_url_fopen - This option is correct because it allows PHP to open remote files using functions like file_get_contents() and fopen() with URLs as the file path.

Option B) allow_remote_files - This option is incorrect because there is no such directive in PHP.

Option C) Both of the above - This option is incorrect because only the allow_url_fopen directive needs to be enabled to work with remote files in PHP.

Option D) None of the above - This option is incorrect because the allow_url_fopen directive is required to work with remote files in PHP.

The correct answer is A) allow_url_fopen. This option is correct because it allows PHP to open remote files.

Which of the following mode of fopen() function opens a file only for writing. If a file with that name does not exist, attempts to create anew file. If the file exist, place the file pointer at the end of the file after all other data?

  1. A

  2. W

  3. W+

  4. A+


Correct Option: A

The function setcookie( ) is used to:

  1. Declare cookie variables

  2. Store data in cookie variable

  3. Enable or disable cookie support

  4. All of the above


Correct Option: B

When you need to obtain the ASCII value of a character which of the following function you apply in PHP?

  1. chr( );

  2. asc( );

  3. ord( );

  4. val( );


Correct Option: C

AI Explanation

To obtain the ASCII value of a character in PHP, you would use the ord() function.

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

Option A) chr() - This option is incorrect because the chr() function is used to convert an ASCII value to its corresponding character.

Option B) asc() - This option is incorrect because there is no built-in asc() function in PHP. It is not a valid function for obtaining the ASCII value of a character.

Option C) ord() - This option is correct because the ord() function in PHP is used to obtain the ASCII value of a character.

Option D) val() - This option is incorrect because the val() function in PHP is used to obtain the numerical value of a variable, not the ASCII value of a character.

The correct answer is option C) ord(). This option is correct because the ord() function is specifically designed to obtain the ASCII value of a character in PHP.

The following piece of script will output: $email='[email protected]'; $new=strstr($email, '@'); print $new; ?>

  1. admin

  2. admin@psexam

  3. @psexam.com

  4. psexam.com


Correct Option: C
Explanation:

To solve this question, the user needs to know the basic syntax of the PHP programming language and the function of strstr().

strstr() function is used to find the first occurrence of a string inside another string. It returns a part of the haystack string starting from the first occurrence of the needle string to the end of the haystack string.

In the given script, the variable $email is assigned the string value of '[email protected]'. The strstr() function is called with two arguments: the $email variable and '@'. The function returns the first occurrence of '@' in the $email variable and assigns it to the variable $new. The print statement then outputs the value of $new.

Now, let's go through each option and explain why it is right or wrong:

A. admin: This option is incorrect because the strstr() function returns everything from the first occurrence of '@' to the end of the string. Therefore, the value of $new is '@psexam.com', not 'admin'.

B. admin@psexam: This option is incorrect because the strstr() function includes the needle string in the returned value. Therefore, the value of $new is '@psexam.com', not 'admin@psexam'.

C. @psexam.com: This option is correct. The strstr() function returns the first occurrence of '@' in the $email variable, which is '@psexam.com'. Therefore, the value of $new is '@psexam.com'.

D. psexam.com: This option is incorrect because the strstr() function returns the string starting from the first occurrence of '@'. Therefore, the returned value includes the '@' symbol. The value of $new is '@psexam.com', not 'psexam.com'.

The Answer is: C

When compared to the compiled program, scripts run:

  1. Faster

  2. Slower

  3. The execution speed is similar

  4. All of above


Correct Option: B

The most portable version of PHP tag that is compatible to embed in XML or XHTML too is:

  1. ?>


Correct Option: D
Explanation:

To solve this question, the user needs to know about the different PHP tags and their compatibility with XML or XHTML.

Option A: ?> is a valid PHP tag but it is not recommended to use as it may conflict with XML processing instruction. It is also not recommended to use with XHTML.

Option B: is not a valid PHP tag and will not be parsed as PHP code. It may work on some servers with specific configurations, but it is not portable or recommended.

Option C: is a valid PHP tag, but it is not compatible with XML or XHTML. It is used in ASP-style syntax.

Option D: is the recommended and most portable version of the PHP tag. It is compatible with XML or XHTML and is widely supported on different servers and configurations.

Therefore, the correct answer is:

The Answer is: D.

The output of ofllowing script would be $somerar=15; function ad it () { GLOBAL $somevar; $somerar++ ; echo "somerar is $somerar"; } addit ();

  1. somerar is 15

  2. somerar is 16

  3. somerar is 1

  4. error in code


Correct Option: B
Explanation:

To solve this question, the user needs to understand the concept of global variables and function in PHP. The script defines a global variable named $somevar with a value of 15, and a function named addit() that increments the value of $somevar by one and then outputs its new value. The function explicitly states the variable is global using the global keyword.

When the addit() function is called, it will first increment the value of $somevar by one, resulting in a value of 16. Then, the function will output the string "somerar is 16" using the echo statement.

Therefore, the correct answer is:

The Answer is: B. somerar is 16

Variable scope on which a variable does not loose its value when the function exists and use that value if the function is called again is:

  1. Local

  2. function parameter

  3. static

  4. None of above


Correct Option: C

AI Explanation

To answer this question, you need to understand the concept of variable scope in programming.

Option A) Local - This option is incorrect because local variables are only accessible within the scope of the function or block in which they are defined. Once the function exits, the local variable is destroyed, and its value is lost.

Option B) Function parameter - This option is incorrect because function parameters are also considered local variables. Like other local variables, their value is lost once the function exits.

Option C) Static - This option is correct because static variables have a different scope compared to local variables. When a static variable is declared within a function, it retains its value even after the function exits. The value of a static variable is preserved between function calls, allowing it to be accessed and used if the function is called again.

Option D) None of above - This option is incorrect because the correct answer is option C, static.

The correct answer is C) static. This option is correct because static variables do not lose their value when the function exits and can be accessed if the function is called again.

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 different delimiting methods used for string interpolation.

Option A) Delimited by single quote - This option is incorrect because string interpolation is not typically done using single quotes. Single quotes are commonly used to delimit string literals in programming languages, but they do not support string interpolation.

Option B) Delimited by double quote - This option is incorrect because while double quotes can be used to delimit string literals and support some form of string interpolation in some programming languages, it is not the specific delimiting method known as string interpolation.

Option C) Delimited by <<< identifier - This option is correct because the <<< identifier (also known as heredoc syntax) is a specific delimiting method used for string interpolation in some programming languages. It allows multiline strings with variable interpolation.

Option D) All of the above - This option is incorrect because not all of the above options are correct. Only option C is the correct delimiting method known as string interpolation.

Therefore, the correct answer is C) delimited by <<< identifier. This option is correct because it represents the specific delimiting method known as string interpolation.

Identify the variable scope that is not supported by PHP?

  1. Local variables

  2. Function parameters

  3. Hidden variables

  4. Global variables


Correct Option: C
- Hide questions