Web Development College Quiz 5
Question 1
PHP can generate PDF files based on database data, which is useful in creating reports.
Select one:
- True
- False
The correct answer is 'True'.
Question 2
True or False: PHP generated PDF files can use custom fonts.
Select one:
- True
- False
The correct answer is 'True'.
Question 3
Given the PHP code:
$row=mysql_fetch_array($r);
What type of variable is $row
?
Select one:
- a. string
- b. array()
- c. integer
- d. boolean
The correct answer is: array()
Question 4
Given that a database table has a field called FirstName, which code displays an element or field from the database record?
Select one:
- a. echo $row['FirstName'];
- b. show $row['name'];
- c. echo $row[name];
- d. echo $row(name);
The correct answer is: echo $row['FirstName'];
Question 5
PHP variables are weekly typed, which means that:
Select one:
- a. you can’t store data in them for a long time
- b. you do not have to define their type before you initialize them
- c. strongly typed languages like Java are better
- d. strongly typed languages do not require variable definitions
The correct answer is: you do not have to define their type before you initialize them
Question 6
What function can you use to get the position of a string or character inside a string?
Select one:
- a. string_position()
- b. length()
- c. len()
- d. strrpos()
The correct answer is: strrpos()
Question 7
When installing online applications on a PHP server, what information is needed?
Select one:
- a. database username
- b. database password
- c. database host name
- d. All of the above
The correct answer is: All of the above
Question 8
What is the valid way to start a PHP function?
Select one:
- a. function test{}
- b. function test[]
- c. def function test{}
- d. function test()
The correct answer is: function test()
Question 9
Which one is NOT a valid PHP comparison operator?
Select one:
- a. !=
- b. <>
- c. !<
- d. ===
The correct answer is: !<
Question 10
What character concatenates strings in PHP?
Select one:
- a. ;
- b. &
- c. *
- d. .
The correct answer is: .
Question 11
Which of the following is a valid way to start a for loop in PHP that would print out the numbers 0 through 4?
Select one:
- a. for($i < 5; $i = 0;)
- b. for($i = 0; $i < 5; $i++)
- c. for($i < 5;)
- d. for( $i < 5; $i = 0; $i++)
The correct answer is: for($i = 0; $i < 5; $i++)
Question 12
What will be the value of $var?
$var = 1 / 2; Select one:
- a. 0
- b. 0.5
- c. 1
- d. 2
The correct answer is: 0.5
Question 13
What will be printed?
1 2 3 4 5 6 |
|
Select one:
- a. false
- b. error
- c. warning
- d. true
The correct answer is: true
Question 14
How can comments be implemented in PHP?
Select one:
- a. // commented code to the end of the line
- b. / commented code can be on multiple lines /
- c. # commented code to the end of the line
- d. All of the above
The correct answer is: All of the above
Question 15
What is the correct way to add 1 to the $count variable?
Select one:
- a. $count =+1
- b. ++count
- c. count+;
- d. None of the above
The correct answer is: None of the above