0

web technology Online Quiz - 37

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

Which of the following variables is not a predefined variable?

  1. $get

  2. $ask

  3. $request

  4. $post


Correct Option: B

AI Explanation

To answer this question, you need to understand predefined variables in a programming context.

Predefined variables are variables that are already defined and available for use in a programming language or framework. These variables often hold important information or data that can be accessed by the programmer.

Let's go through each option to determine which one is not a predefined variable:

Option A) $get - This option is a predefined variable in certain programming languages or frameworks, such as PHP. It typically represents data obtained from an HTTP GET request.

Option B) $ask - This option is not a predefined variable. It does not correspond to any commonly used predefined variable in programming languages or frameworks.

Option C) $request - This option is a predefined variable in certain programming languages or frameworks, such as PHP. It represents the current HTTP request being processed.

Option D) $post - This option is a predefined variable in certain programming languages or frameworks, such as PHP. It typically represents data obtained from an HTTP POST request.

The correct answer is B) $ask. This option is not a predefined variable and does not correspond to any commonly used predefined variable in programming languages or frameworks.

You can define a constant by using the define() function. Once a constant is defined

  1. You can define a constant by using the define() function. Once a constant is defined

  2. It can never be changed but can be undefined

  3. It can be changed but can not be undefined

  4. It can be changed and can be undefined


Correct Option: A
  1. You can define a constant by using the define() function. Once a constant is defined

  2. It can never be changed but can be undefined

  3. It can be changed but can not be undefined

  4. It can be changed and can be undefined


Correct Option: A

Which of the following function returns the number of characters in a string variable?

  1. count($variable)

  2. len($variable)

  3. strcount($variable)

  4. strlen($variable)


Correct Option: D

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
  1. echo ucwords($word)

  2. echo ucwords(strtolower($word)

  3. echo ucfirst($word)

  4. echo ucfirst(strtolower($word)


Correct Option: B
Explanation:

To solve this question, the user should have knowledge of PHP string functions.

The ucwords() function is used to convert the first letter of each word to uppercase in a given string. The ucfirst() function converts the first letter of a string to uppercase. The strtolower() function converts a string to lowercase.

Option A: echo ucwords($word) will return "HELLO WORLD", where the first letter of each word is capitalized. This option is incorrect, as the question asks for the title case.

Option B: echo ucwords(strtolower($word)) will return "Hello World". This option is correct as it converts the whole string to lowercase using strtolower() and then capitalizes the first letter of each word using ucwords().

Option C: echo ucfirst($word) will return "HELLO WORLD", where only the first letter of the first word is capitalized. This option is incorrect as it doesn't convert the string to title case.

Option D: echo ucfirst(strtolower($word)) will return "Hello world". This option is incorrect as it only capitalizes the first letter of the first word and converts the string to lowercase, but doesn't capitalize the first letter of each word.

Therefore, the correct answer is:

The Answer is: B. echo ucwords(strtolower($word))

The difference between include() and require()

  1. are different how they handle failure

  2. both are same in every aspects

  3. is include() produced a Fatal Error while require results in a Warning

  4. none of above


Correct Option: A
  1. Any variable available at that line in the calling file will be available within the called file from that point

  2. Any variable available at that line in the calling file will not be available within the called file

  3. Variables are local in both called and calling files

  4. None of above


Correct Option: A

Which of the following method sends input to a script via a URL?

  1. Get

  2. Post

  3. Both

  4. None


Correct Option: A

AI Explanation

To answer this question, you need to understand the difference between the "Get" and "Post" methods in web programming.

Option A) Get - This option is correct because the "Get" method sends input to a script via a URL. When using the "Get" method, the input data is appended to the URL as query parameters. This method is commonly used for retrieving data from a server.

Option B) Post - This option is incorrect because the "Post" method does not send input to a script via a URL. Instead, the input data is sent in the body of the HTTP request. This method is commonly used for submitting data to a server, such as when submitting a form.

Option C) Both - This option is incorrect because the "Post" method does not send input via a URL. Therefore, the correct answer is not "Both".

Option D) None - This option is incorrect because the "Get" method does send input to a script via a URL. Therefore, the correct answer is not "None".

The correct answer is A) Get. This option is correct because the "Get" method sends input to a script via a URL by appending the input data to the URL as query parameters.

  1. Get

  2. Post

  3. Both Get and Post

  4. There is no direct way for larger form. You need to store them in a file and retrieve


Correct Option: B

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. W

  2. W+

  3. A

  4. A+


Correct Option: C

The function setcookie( ) is used to

  1. Enable or disable cookie support

  2. Declare cookie variables

  3. Store data in cookie variable

  4. All of above


Correct Option: C
  1. allow_url_fopen

  2. allow_remote_files

  3. both of above

  4. none of above


Correct Option: A

fopen($file_doc,”r+&rdquo opens a file for

  1. reading

  2. writing

  3. none of above

  4. both of above


Correct Option: D

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

  1. The message

  2. The recipient

  3. The header

  4. The subject


Correct Option: D
  1. database host

  2. user ID

  3. password

  4. database name


Correct Option: D

Study following steps and determine the correct order (1) Open a connection to MySql server (2) Execute the SQL query (3) Fetch the data from query (4) Select database (5) Close Connection

  1. 1, 4, 2, 3, 5

  2. 4, 1, 2, 3, 5

  3. 1, 5, 4, 2, 1

  4. 4, 1, 3, 2, 5


Correct Option: A

Which of the following is not a session function?

  1. sssion_decode

  2. session_destroy

  3. session_id

  4. session_pw


Correct Option: D

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

Which of the following delimiter syntax is PHP's default delimiter syntax

  1. php ?>

  2. ?>


Correct Option: A
- Hide questions