App Dev (PHP-LAB) Flashcards

1
Q

$t = 100;
function one(){
echo “value”;
}
one();
what is the function name inside of the code?

A

value

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

Id the keyword used to declare a function

A

function

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

Sorts by a function

A

usort($array)

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

Array can be used as ordinary array same as in

Group of answer choices

Java

Ruby

C and C++

Python

A

Python

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

$a[]=”mango”;
$a[]=”apple”;
$a[]=”banana”;

Check the code if valid or invalid?

A

INVALID

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

You can create a function inside of a function (T/F)

A

TRUE

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

$mo = array(“jan”,”feb”,”mar”);
echo “<pre>”;
print_r ($mo);
echo “</pre>”;

Check the code if valid or invalid?

A

INVALID

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

Syntax for foreach

A

foreach($arr as $value){}

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

param – is the formal parameters of the function. Parameter must follow the rule of naming dentifier. (T/F)

A

TRUE

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

You can insert CCS code inside of a function (T/F)

A

FALSE

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

PHP array does not need to declare how many elements that the array variable have. (T/F)

A

TRUE

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

specify an array expression within a set of parenthesis following the foreach keyword. (T/F)

A

TRUE

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

functions that are built-in into PHP to perform some standard operations

A

Predefined functions

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

function a($a,$b){
return $a+$b;
}
echo a(6,5);
what is the value of $a?

A

11

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

$f = array(
‘102’ => “red”,
‘101’ => “blue”,
‘100’ => “yellow”);
ksort($f);
print_r($f);

What is the output of the code?

A

Array ( [100] => yellow [101] => blue [102] => red )

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

$f = array(
‘102’ => “red”,
‘101’ => “blue”,
‘100’ => “yellow”);
krsort($f);
print_r($f);
What is the output of the code?

A

Array ( [102] => red [101] => blue [100] => yellow )

17
Q

var_dump function is same as print_r function except it adds additional information about the data of each element. (T/F)

A

TRUE

18
Q

ksort() and krsort() used to sort elements by values. (T/F)

A

FALSE

19
Q

What do you call a function inside of a function

A

NESTED FUNCTION

20
Q

Functions are limited to 1 per code only (T/F)

13(now 15)/20 ^^

A

FALSE

21
Q

We use static keyword to declare a variable inside a function that will act as accumulator variable this will let the program remember the last value of the variable that was used. (T/F)

A

TRUE

22
Q

Sorts by value; keeps the same key

A

asort($array)

23
Q

$g = 200;
function a(){echo “5”;}
function b(){echo “4”;}
b();
what is the output of the code?

A

ERROR

24
Q

Function can be put anywhere of the code (T/F)

A

TRUE

25
Q

You can create your own function inside of a php code (T/F)

A

TRUE

26
Q

foreach(____ as $value)

A

$arr

27
Q

functions that are provided by the user of the program.

A

USER DEFINED FUNCTION

28
Q

sort() and rsort() does not maintain its index reference for each values. (T/F)

A

TRUE

29
Q

Array can be used as ordinary array same as in C and C++ arrays. (T/F)

A

TRUE

30
Q

What is the keyword use to gain access a variable that is outside of the function?

A

GLOBAL

31
Q

Global Variables is declared inside a function and is only available within the function in which it is declared. (T/F)

A

FALSE

32
Q

$fruit = array(“orange”,”apple”,”grape”,”banana”);
What is the value of index 3?

A

BANANA

33
Q

$fruit = array(“orange”,”apple”,”grape”,”banana”);
What is the value of index 1?

A

APPLE

34
Q
A