PHP Reviewer Flashcards

1
Q

Q 1 - Which of the following is correct about PHP?

A - PHP can access cookies variables and set cookies.

B - Using PHP, you can restrict users to access some pages of your website.

C - It can encrypt data.

D - All of the above.

A

D - All of the above.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Q 2 - Which of the following type of variables have only two possible values either true or false?

A - Integers

B - Doubles

C - Booleans

D - Strings

A

C - Booleans

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Q 3 - Which of the following magic constant of PHP returns function name?

A - LINE

B - FILE

C - __FUNCTION__

D - CLASS

A

C - FUNCTION

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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

A - search()

B - locate()

C - strpos()

D - None of the above.

A

C - strpos()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Q 5 - Which of the following variable is used for the PHP script name?

A - $_PHP_SELF

B - $SELF

C - $PHP

D - None of the above.

A

A - $_PHP_SELF

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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

A - true

B - false

A

B - false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Q 7 - Which of the following is used to create a session?

A - session_start() function

B - $_SESSION[]

C - isset() function

D - session_destroy() function

A

A - session_start() function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Q 8 - Which of the following is used to destroy the session?

A - session_start() function

B - $_SESSION[]

C - isset() function

D - session_destroy() function

A

D - session_destroy() function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Q 9 - Which of the following method of Exception class returns the code of exception when error occured?

A - getMessage()

B - getCode()

C - getFile()

D - getLine()

A

B - getCode()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Q 10 - Which of the following method acts as a destructor function in a PHP class?

A - class_name()

B - __destruct

C - destructor

D - None of the above.

A

B - __destruct

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

a server side scripting language that is embedded in HTML. It is used to manage dynamic content, databases, session tracking, even build entire e-commerce sites.

A

PHP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does PHP stand for

A

PHP: Hypertext Preprocessor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the common usage of PHP?

A
  • PHP performs system functions, i.e. from files on a system it can create, open, read, write, and close them.
  • PHP can handle forms, i.e. gather data from files, save data to a file, thru email you can send data, return data to the user.
  • You add, delete, modify elements within your database thru PHP.
  • Access cookies variables and set cookies.
  • Using PHP, you can restrict users to access some pages of your website.
  • It can encrypt data.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

In how many ways you can embed PHP code in an HTML page?

A

All PHP code must be included inside one of the three special markup tags ate are recognised by the PHP Parser.

<?php PHP code goes here ?>
<? PHP code goes here ?>

 PHP code goes here 

Most common tag is the <?php…?>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
  • final and most immediate way to affect PHP’s functionality
  • read each time PHP is initialized
A

php.ini

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The PHP parsing engine needs a way to differentiate PHP code from other elements in the page. The mechanism for doing so is known as?

A

‘escaping to PHP.’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

means that it almost never matters how many whitespace characters you have in a row.one whitespace character is the same as many such characters.

A

PHP is whitespace insensitive

18
Q

Characteristics of PHP variables

A

All variables in PHP are denoted with a leading dollar sign ($).

The value of a variable is the value of its most recent assignment.

Variables are assigned with the = operator, with the variable on the left-hand side and the expression to be evaluated on the right.

Variables can, but do not need, to be declared before assignment.

Variables in PHP do not have intrinsic types - a variable does not know in advance whether it will be used to store a number or a string of characters.

Variables used before they are assigned have default values.

PHP does a good job of automatically converting types from one to another when necessary.

PHP variables are Perl-like.

19
Q

What are rules for naming a PHP variable?

A
  • Rules for naming a variable are following
  • Variable names must begin with a letter or underscore character.
  • A variable name can consist of numbers, letters, underscores but you cannot use characters like + , - , % , ( , ) . & , etc
20
Q

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

A - $_GET

B - $GET

C - $GETREQUEST

D - None of the above.

A

A - $_GET

21
Q

Q - Which of the following method acts as a constructor function in a PHP class?

A - class_name()

B - __construct

C - constructor

D - None of the above.

A

B - __construct

22
Q

Q - Which of the following function sorts an array in reverse order?

A - rsort()

B - sort()

C - shuffle()

D - reset()

A

A - rsort()

23
Q

Q - Which of the following magic constant of PHP returns class name?

A - LINE

B - FILE

C - FUNCTION

D - CLASS

A

D - CLASS

24
Q

Q - Which of the following method of Exception class returns formated string of trace?

A - getMessage()

B - getCode()

C - getTrace()

D - getTraceAsString()

A

D - getTraceAsString()

25
Q

Q - Which of the following is used to check that a cookie is set or not?

A - getcookie() function

B - $_COOKIE variable

C - isset() function

D - None of the above.

A

C - isset() function

26
Q

Q - Which of the following array represents an array with a numeric index?

A - Numeric Array

B - Associative Array

C - Multidimentional Array

D - None of the above.

A

A - Numeric Array

27
Q

Q - Which of the following is true about php variables?

A - All variables in PHP are denoted with a leading dollar sign ($).

B - The value of a variable is the value of its most recent assignment.

C - Variables are assigned with the = operator, with the variable on the left-hand side and the expression to be evaluated on the right.

D - All of the above.

A

D - All of the above.

28
Q

Q - Which of the following type of variables are special type that only has one value: NULL?

A - Strings

B - Doubles

C - Booleans

D - NULL

A

D - NULL

29
Q

Q - Which of the following is correct about PHP?

A - PHP performs system functions, i.e. from files on a system it can create, open, read, write, and close them.

B - PHP can handle forms, i.e. gather data from files, save data to a file, thru email you can send data, return data to the user.

C - You add, delete, modify elements within your database thru PHP.

D - All of the above.

A

D - All of the above.

30
Q

Q - Which of the following can be used to get information sent via get/post method in PHP?

A - $_REQUEST

B - $REQUEST

C - $REQUEST_PAGE

D - None of the above.

A

A - $_REQUEST

31
Q

Q - Which of the following function is used to get environment variables in PHP?

A - search()

B - environment()

C - env()

D - getenv()

A

D - getenv()

32
Q

Q - Which of the following method connect a MySql database using PHP?

A - mysql_connect()

B - mysql_query()

C - mysql_close()

D - None of the above

A

A - mysql_connect()

33
Q

Q - Which of the following magic constant of PHP returns current line number of the file?

A - LINE

B - FILE

C - FUNCTION

D - CLASS

A

A - LINE

34
Q

Q - Can you assign the default values to a function parameters?

A - true

B - false

A

A - true

35
Q

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

A - $GLOBALS

B - $_SERVER

C - $_COOKIE

D - $_SESSION

A

C - $_COOKIE

36
Q

Q - Which of the following type of variables are whole numbers, without a decimal point, like 4195?

A - Integers

B - Doubles

C - Booleans

D - Strings

A

A - Integers

37
Q

Q - Which of the following provides the actual name of the uploaded file?

A - $_FILES[‘file’][‘tmp_name’]

B - $_FILES[‘file’][‘name’]

C - $_FILES[‘file’][‘size’]

D - $_FILES[‘file’][‘type’]

A

B - $_FILES[‘file’][‘name’]

38
Q

Q - Which of the following is used to set cookies?

A - setcookie() function

B - $_COOKIE variable

C - $HTTP_COOKIE_VARS variable

D - isset() function

A

A - setcookie() function

39
Q

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

A - LINE

B - FILE

C - FUNCTION

D - CLASS

A

C - FUNCTION

40
Q

Q 1 - Which of the following is correct about PHP?
A - PHP is a recursive acronym for “PHP: Hypertext Preprocessor”.
B - PHP is a server side scripting language that is embedded in HTML.
C - It is used to manage dynamic content, databases, session tracking, even build entire e-commerce
sites.
D - All of the above.

A

D

41
Q

Q 2 - Which of the following is correct about PHP?
A - PHP performs system functions, i.e. from files on a system it can create, open, read, write, and close
them.
B - PHP can handle forms, i.e. gather data from files, save data to a file, thru email you can send data,
return data to the user.
C - You add, delete, modify elements within your database thru PHP.
D - All of the above.

A

D

42
Q
A