Object-oriented questions
- Class definitions must end with a semi-colon: true or false?
True
False
- Calling __clone() is not allowed: true or false?
True
False
- Abstract classes cannot be instantiated: true or false?
True
False
- You can use objects as an array in foreach loops: true or false?
True
False
- Private variables can only be accessed from within the class that defined them, or any subclass of it: true or false?
True
False
Function questions
- What function would you use to tell the browser the content type of the data being output?
imagejpeg()
imageoutput()
flush()
header()
imageload()
- What parameters does the func_get_args() function take?
0: It doesn't take any parameters
1: name of function to check
2: name of function to check, boolean "count optional arguments"
- What does the array_shift() function do?
Add an element to an array
Removes an element from an array
Shifts all elements towards the back of the array
Switches array keys and values
Clears the array
- What function would you use to delete a file?
unlink()
delete()
fdelete()
file_delete()
- What is the difference between exec() and pcntl_exec()?
Nothing, they are the same
pcntl_exec() forks a new process
pcntl_exec() can only be called from a child process
None of the above
- If $string is "Hello, world!", how long would the output of sha1($string) be?
It varies
16 characters
20 characters
24 characters
32 characters
40 characters
- If the input of chr() is $a and the output is $b, what function would take input $b and produce output $a?
chr()
rch()
ord()
strrev()
chr(chr())
chrrev()
- If $a is "Hello, world!", is this statement true or false: md5($a) === md5($a)
True
False
- Which function returns true when magic quotes are turned on?
get_magic_quotes()
magic_quotes_get()
magic_quotes()
get_magic_quotes_gpc()
get_quotes()
- The functions get_required_files() and get_included_files() are identical, true or false?
True
False
- If $arr was an array of ten string elements with specific keys, what would array_values(ksort($arr)) do?
Create a new array of just the values, then sort by the keys
Create a new array of just the values, then ignore the sort as there are no keys
Sort the array by key, then return a new array with just the values
Trigger a warning
None of the above
- What is the return value of array_unique()?
Boolean
Integer
Array
It varies
None of the above
Miscellaneous questions
- Output buffering compression is...
High on CPU resources, low on network resources
Low on CPU resources, high on network resources
High on CPU resources, high on network resources
Low on CPU resources, low on network resources
- You can exit a PHP code block (that is, use ?> to go back to HTML mode) while in the middle of a class definition: true or false?
True
False
- Examine this code - on which line is there an error?
<?php
class dog {
public function bark() {
echo "Woof!";
}
};
$foo = new dog;
$foo->bark();
?>
Line 2 (class dog)
Line 3 (public function bark())
Line 4 (echo "Woof!")
Line 6 ( }; )
Line 8 ($foo = new dog)
Line 9 ($foo->bark())
There is no error
- True or false: to ensure maximum portability for your scripts, you should try to use exceptions.
True
False
- What directive would you change in your php.ini file to disable assert()?
assert
assert.active
assert.enable
assert.assert
assert.options
None of the above
- Which of these statements is true?
PHP 4 had object orientation, but not extensions
PHP 4 had extensions, but not object orientation
PHP 4 had object orientation, but not exceptions
PHP 4 had exceptions, but not object orientation
None of the above
Mathematical questions
- "10" == 10: true or false?
True
False
- "10" === 10: true or false?
True
False
- "10" !== 10: true or false?
True
False
- 10 === 010: true or false?
True
False
- 010 >= 10: true or false?
True
False
- What is the value of this sum: 5 * 6 / 2 + 2 * 3
0
3
4
19
21
24
29
51
Database questions
- This SQL statement is valid "SELECT ID, Name FROM some_table ORDER BY Name WHERE ID < 100" - true or false?
True
False
- Joins are fastest when done using which data type:
INT
JOIN
FLOAT
INDEX
CHAR
VARCHAR
CACHE
None of the above
- SQLite is compiled into PHP 5 by default: true or false?
True
False
- All five parameters to mysql_connect() are optional, true or false?
True
False
- What is the best description of a normalised table?
One where optimal data types are used
One where data is not repeated
One where the schema is valid
One that is properly indexed
One that has been defragmented
String questions
- If $string is set to "Hello, world!", what is $string{4}?
H
e
l
o
w
r
d
- What is the case-insensitive version of the strcmp() function?
strcmpi()
stricmp()
strcasecmp()
istrcmp()
- How many parameters can the trim() function take?
0
1
2
3
4+
- The parse_str() function...
Checks a string of PHP code is valid
Checks a string of PHP code is valid, then executes it
Searches a string for non-English characters
Converts the contents of a string into variables
- What will this function return: preg_match("[A-Za-z0-9_]*", "This_is_a_test")
True
False
- What would implode(".", explode(",", $string)) do?
Replace all full stops (periods) with spaces
Replace all full stops with commas
Delete all full stops
None of the above
No comments:
Post a Comment