Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views5 pages

MidtermReviewer

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 5

Barrio, James Zar E.

WIT5M1

IT APC 3 LAB

Sir. Arsenio Amante

MIDTERM REVIEWER

1. What does the PHP var_dump() function do?

a) It checks the syntax of a PHP script

b) It compiles PHP code

c) It displays structured information about variables, including type and value

d) It executes PHP code

2. In PHP, what symbol is used to define a variable?

a) @

b) #

c) $

d) $

3. Which of the following statements about PHP constants is true?

a) Constants are defined using the define() function

b) Constants can be redefined later in the script

c) Constants require a $ sign before their name

d) Constants are case-insensitive by default

4. What is the output of the following PHP code?

$x = "Hello";

$$x = "World";

echo "$x ${$x}";

a) Hello World

b) World Hello

c) $x ${$x}

d) Error
5. In PHP, how can you define a multidimensional array?

a) Using square brackets

b) Using a nested array

c) Using a for loop

d) Using the implode() function

6. Which of the following is a valid PHP integer representation?

a) 0b10101

b) 123

c) 0xFF

d) All of the above

7. In PHP, what is the significance of the NULL data type?

a) It is used for strings

b) It is used to initialize variables with no value

c) It can store multiple values

d) It is the default data type for arrays

8. What will be the output of the following PHP code?

define("GREETING", "Hello PHP");


echo GREETING;

a) Hello PHP

b) GREETING

c) Undefined constant error

d) None of the above

9. Which of the following is a compound data type in PHP?

a) Integer

b) String

c) Array

d) Float
10. What is the result of the following code?

$foo = "bar";

$$foo = "baz";

echo $foo;

echo $bar;

a) barbaz

b) foobaz

c) Error

d) bazbar

11. What does the PHP var_dump() function display?

a) The length of the file

b) Structured information, such as type and value of variables

c) Errors in a PHP script

d) The result of the script execution

12. Which of the following will output bool(true) in PHP?

a) $x = 0; var_dump($x);

b) $x = "Hello"; var_dump($x);

c) $x = true; var_dump($x);

d) $x = false; var_dump($x);

13. How do you define a dynamic variable in PHP?

a) By using dynamic_var()

b) By prefixing two dollar signs $$ to a variable

c) By adding a semicolon before a variable

d) By using a special function

14. Which of the following is NOT a valid PHP integer format?

a) 123

b) 0x1A

c) 0011
d) 1.23

15. What does the following PHP code output?

$x = array("Hello", false, 99.99, array(10, 20, 30));


var_dump($x);

a) An array of integers

b) Detailed structure of the array including data types

c) Only the length of the array

d) An error

16. How can you define a constant in PHP?

a) Using the const keyword only

b) Using the define() function

c) By using a double dollar sign

d) By setting the variable name in uppercase

17. In PHP, what will the following output?

$a = "good";

$$a = "morning";

echo "$a {$$a}";

a) good $$a

b) good good

c) good morning

d) Error

18. Which of the following is a valid PHP constant name?

a) 3THREE

b) CONSTANT1

c) $CONSTANT

d) -CONSTANT

19. Which data type will the function gettype() return for the following?
$x = 10.25;

echo gettype($x);

a) float

b) integer

c) double

d) array

20. How can you display preformatted text in PHP output?

a) By using <pre> tags

b) By using <format> tags

c) By using the preformat() function

d) By using a backslash before text

You might also like