Achieve Internet Interview Report
- 0of 0 votes
AnswerIn PHP5, what code would the following print to the browser? Why?
- Annonymous.... November 01, 2009
$string = 'Hello';
function hello(&$string = '') {
$string .= ' World!';
print trim($string);
}
hello();
hello($string);
hello($string);
• World!Hello World!Hello Hello World!
• Hello World!Hello World! World!
• World!Hello World!Hello World! World!
• Hello World!Hello World!Hello World! World!
• Nothing. It would throw an error.| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP - 0of 0 votes
AnswerWhat functions can you use to add library code to the currently running script?
- Annonymous.... November 01, 2009| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP - 0of 0 votes
AnswersWhat is the difference between foo() & @foo()?
- Annonymous.... November 01, 2009| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP - 0of 0 votes
AnswersA class is written so that it cannot be extended. Which of the following PHP 5 keywords achieves that goal?
- Annonymous.... November 01, 2009
• Static
• Abstract
• Private
• Terminal
• Final| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP - 0of 0 votes
AnswersWhich of the following guarantees that the first letter of a string is capitalized and all other letters of a string are lower case?
- Annonymous.... November 01, 2009
• ucfirst($str);
• strtolower(ucfirst($str));
• strtoupper($str[0]);
• ucfirst(strtolower($str));
• strtoupper(strtolower($str)[0]);| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP - 0of 0 votes
AnswersGiven the following code:
- Annonymous.... November 01, 2009
class myclass {
private $var = '';
var $var2 = 'test';
public function print_var() {
if (!empty($this->var)) {
print $this->var .'(Var1)';
}
else {
print $this->var2 .'(Var2)';
}
}
public function __set($string, $value) {
$this->$string = $value;
}
}
$myclass = new myclass();
$myclass->var = 'Hey there!';
$myclass->print_var();
What happens when the code above is executed?
• It prints ‘Hey There(Var1)’ to the screen.
• It throws a fatal error because var is inaccessible in this context.
• It prints ‘test’ to the screen because var is never correctly set.
• It throws an error because you haven’t set privacy settings for var2.| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP - 0of 0 votes
AnswersWhat function would you use to redirect the browser to a new page?
- Annonymous.... November 01, 2009
1. redir()
2. header()
3. location()
4. redirect()| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP - 0of 0 votes
AnswersWhat function would you use to pull an associative array of results in mysql? An indexed array?
- Annonymous.... November 01, 2009
• mysql_query
• mysql_fetch_array
• mysql_fetch_row
• mysql_result| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP - 0of 0 votes
AnswerWhat does the following code do? Explain what’s going on there.
- Annonymous.... November 01, 2009
$date='08/26/2003';
print ereg_replace(“([0-9]+)/([0-9]+)/([0-9]+)”,”\\2/\\1/\\3”,$date);| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP - 0of 0 votes
AnswerWhat does the GD library do?
- Annonymous.... November 01, 2009| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP - 0of 0 votes
AnswerWhat function(s) or hook(s) would you use in Drupal to define a url that maps to a function?
- Annonymous.... November 01, 2009
• hook_url
• hook_menu
• hook_form
• hook_uri| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP - 1of 1 vote
AnswersWhich of the following will not add john to the users array?
- Annonymous.... October 29, 2009
1. $users[] = 'john';
2. array_add($users,'john');
3. array_push($users,'john');
4. $users ||= 'john';| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer Arrays - 0of 0 votes
AnswerWhich of the following maintain index associations?
- Annonymous.... November 01, 2009
• ksort
• asort
• sort| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer Sorting - 0of 0 votes
AnswersWhich of the following is true about asort?
- Annonymous.... November 01, 2009
• Sorts highest to lowest by value maintaining key association.
• Sorts lowest to highest by key maintaining key association.
• Sorts highest to lowest by key, re-indexing the array.
• Sorts lowest to highest by value, re-indexing the array.| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer Sorting - 0of 0 votes
AnswersWhat would the following code print to the browser? Why?
- Annonymous.... November 01, 2009
$num = 10;
function multiply(){
$num = $num * 10; }
multiply();
echo $num;| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP - 0of 0 votes
AnswersIf $a = TRUE, $b = 1. What does $a == $b equal? $a === $b?
- Annonymous.... November 01, 2009
• TRUE, FALSE
• TRUE, TRUE
• FALSE, FALSE
• FALSE, TRUE| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP - 0of 0 votes
AnswerGiven the following code:
- Annonymous.... November 01, 2009
class myclass {
private $var = '';
var $var2 = 'test';
public function print_var() {
if (!empty($this->var)) {
print $this->var .'(Var1)';
}
else {
print $this->var2 .'(Var2)';
}
}
public function __set($string, $value) {
$this->$string = $value;
}
}
$myclass = new myclass();
$myclass->var = 'Hey there!';
$myclass->print_var();
What happens if $myclass->var is replaced with $myclass->var2?
• It prints ‘Hey There(Var2)’ to the screen.
• It prints ‘test’ to the screen because var is never correctly set.
• It throws an error because you haven’t set privacy settings for var2.
• It prints (Var1) to the screen because var is a blank string, not empty.| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP - 0of 0 votes
AnswersWhat function can you use to open a file for reading and writing?
- Annonymous.... November 01, 2009
1. fget();
2. file_open();
3. fopen();
4. open_file();| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP - 0of 0 votes
AnswerWhich of the following characters anchors a regular expression pattern to the start of a string?
- Annonymous.... November 01, 2009
• ^ (caret)
• $ (dollar)
• % (percentage)
• ! (exclamation mark)
• * (asterisk)| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP - 0of 0 votes
AnswersHow can you get round the stateless nature of HTTP using PHP?
- Annonymous.... November 01, 2009| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP - 0of 0 votes
AnswersWhat function(s) or hook(s) would you use in Drupal to create a link?
- Annonymous.... November 01, 2009
• link()
• url()
• l()
• create_link()| Report Duplicate | Flag | PURGE
Achieve Internet Software Engineer / Developer PHP