Exam II PHP W3

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

All variables in PHP start with which symbol?

$

Which of the following is an associative array of variables passed to the current script via HTTP cookies?

$_COOKIE

Which of the following provides content type of the uploaded file in PHP?

$_FILES['file']['type']

Which of the following is used to get information sent via get method in PHP?

$_GET

How do you get information from a form that is submitted using the "get" method

$_GET[];

Which superglobal variable holds information about headers, paths, and script locations?

$_SERVER

array containing information such as headers, paths, and script locations?

$_SERVER

Which of the following is used to access session variables in PHP?

$_SESSION[]

How do you create an array in PHP?

$cars = array("Volvo", "BMW", "Toyota");

What is the correct way to add 1 to the $count variable?

$count++;

Which one of these variables has an illegal name?

$my-Var

If a source file contains PHP code, what extension should be used

.php

Which is the correct way to write a multiple line PHP comment

/* ... */

What is a correct way to add a comment in PHP?

/*...*/

What is the correct way to end a PHP statement?

;

shorthand form PHP scripting block

<? and end with ?>

standard form PHP scripting block

<?php ... ?>

What is the correct way to include the file "time.inc"

<?php require("time.inc"); ?>

PHP server scripts are surrounded by delimiters

<?php...?>

Which operator is used to check if two values are equal and of same data type?

===

Which of the following variable is used to get user's browser and operating system details in PHP?

HTTP_USER_AGENT

PHP

Hypertext Preprocessor

Which of the following is correct about constants

Only scalar data (boolean, integer, float and string) can be contained in constants.

The PHP syntax is most similar to

Perl and C

If your echo string contains quotations, which tactic or tactics should you use

Strings

searches a string specified by string for a string specified by pattern, returning true if the pattern is found, and false otherwise

The ereg() function

Which of the following is correct about constants

Unlike with variables, you do not need to have a constant with a $

How will you concatenate two strings?

Using . operator

Which of the following magic constant of PHP returns function name?

_FUNCTION_

NOT a magic predefined constant

__DATE__

acts as a destructor function in a PHP class?

__destruct

Which of the following function can be used to get an array in the reverse order?

array_reverse()

Which of the following function returns selected parts of an array?

array_slice()

Which of the following keyword causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating?

continue

Which of the following is used to declare a constant

define

How do you write "Hello World" in PHP

echo "Hello World";

searches throughout a string specified by pattern for a string specified by string. The search is not case sensitive

eregi() function

All large websites take longer to create with PHP

false

For maximum compatibility, you should use the shorthand form to create PHP scripts

false

In PHP, the only way to output text is with echo.

false

Include files must have the file extension ".inc"

false

PHP does not support databases

false

PHP files are returned to the browser as plain PHP

false

PHP is a closed source software

false

When using the POST method, variables are displayed in the URL:

false

Whitespace is not ignored in PHP

false

Which of the following function is used to check if a file exists or not?

file_exist()

What is the correct way to open the file "time.txt" as readable?

fopen("time.txt","r");

What is the correct way to create a function in PHP

function myFunction()

Which of the following method of Exception class returns source filename?

getFile()

Which of the following variable is used to generate random numbers using PHP?

rand()

Which of the following is used to destroy the session?

session_destroy() function.

method can be used to parse an XML document using PHP?

simplexml_load_string() and loadxml()

Which of the following function is used to get length of a string?

strlen()

Which of the following function is used to locate a string within a string?

strpos()

What does a semicolon signify at the end of a instruction or statement

the end of a PHP statement or instruction

method returns current date and time?

time()

Can you assign the default values to a function parameters?

true

If there is any problem in loading a file then the include() function generates a warning but the script will continue execution.

true

In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings:

true

Most of the syntax for PHP is borrowed from Java, Perl, and C

true

PHP allows you to send emails directly from a script

true

PHP can be run on Microsoft Windows IIS(Internet Information Server):

true

PHP can run on different platforms (Ex. Windows, Linux, and Unix)

true

PHP is a server-side scription language

true

PHP scripts are executed on a server

true

Singly quoted strings are treated almost literally, whereas doubly quoted strings replace variables with their values as well as specially interpreting certain character sequences.

true

Syntax is a set of rules that must be followed to write properly structured code

true

The die() and exit() functions do the exact same thing

true

The if statement is used to execute some code only if a specified condition is true

true

The setcookie() function must appear BEFORE the <html> tag.

true


संबंधित स्टडी सेट्स

Test 2: Rhythm, Dynamics, Timbre

View Set

Lecture 4 - Quality System Regulation (QSR)

View Set

LSAT Logical Reasoning (PowerScore)

View Set

ATI priority setting framework review test

View Set