Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 05-25-2004, 03:51 PM   #1
Big Ray
Confirmed User
 
Join Date: Dec 2003
Posts: 464
PHP / MySQL Programmer - What are good interview Questions?

So, I am hiring a PHP / MySQL Guru. Top notch. Good Pay. Free Red Bull.

Anyway, I have some decent interview questions.. but am looking for more.

Post your PHP / MySQL Interview questions and answers here!
Big Ray is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 03:53 PM   #2
Calvinguy
Confirmed User
 
Join Date: Oct 2002
Location: European Union
Posts: 1,752
What is localhost?
Calvinguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 03:55 PM   #3
AndrewKanuck
Confirmed User
 
Join Date: Jan 2004
Location: Cleveland & Atlanta
Posts: 6,706
Are you or any of your family sick and/or dying, or will they be sick and/or dying when the deadline approaches?
__________________
AndrewKanuck is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 03:56 PM   #4
JDog
Confirmed User
 
Join Date: Feb 2003
Location: Canby, OR
Posts: 7,453
Quote:
Originally posted by egonetworks
Are you or any of your family sick and/or dying, or will they be sick and/or dying when the deadline approaches?
That's great!

jDOG
__________________
NSCash now powering ReelProfits.com
ALSO FEATURING: NSCash.com :: SoloDollars.com :: ReelProfits.com :: BiminiBucks.com :: VOD
PROGRAMS COMING SOON: Greedy Bucks :: Vengeance Cash
NOW OFFERING OVER 60 SITES
CONTACT :: JAMES SMITH :: CHIEF TECHNOLOGY OFFICER :: ICQ (711385133)
JDog is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 03:58 PM   #5
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
If they have any experience in optomization/streamlining both php code as well as mysql databases to run on higher traffic loads.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 03:58 PM   #6
JDog
Confirmed User
 
Join Date: Feb 2003
Location: Canby, OR
Posts: 7,453
Quote:
Originally posted by Calvinguy
What is localhost?
Dude, that is so fucking easy! Anybody that knows anything about fucking computers know what localhost is!

jDoG
__________________
NSCash now powering ReelProfits.com
ALSO FEATURING: NSCash.com :: SoloDollars.com :: ReelProfits.com :: BiminiBucks.com :: VOD
PROGRAMS COMING SOON: Greedy Bucks :: Vengeance Cash
NOW OFFERING OVER 60 SITES
CONTACT :: JAMES SMITH :: CHIEF TECHNOLOGY OFFICER :: ICQ (711385133)
JDog is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 04:01 PM   #7
sjoerdv
Confirmed User
 
sjoerdv's Avatar
 
Industry Role:
Join Date: Jun 2002
Location: South America
Posts: 350
Do you expect to get pregnant soon????

BTW, I know a good PHP/MySQL and ASP programmer. Experienced in high traffic sites and payment systems. ICQ me at 133480259 if interested..
sjoerdv is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 04:03 PM   #8
phpslave
Confirmed User
 
Join Date: Jan 2003
Location: San Jose
Posts: 548
I always make up shit in interviews and see if they act like they know it, LOL.
__________________

phpslave is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 04:07 PM   #9
Calvinguy
Confirmed User
 
Join Date: Oct 2002
Location: European Union
Posts: 1,752
Quote:
Originally posted by JDog
Dude, that is so fucking easy! Anybody that knows anything about fucking computers know what localhost is!

jDoG

I know... but you got to start somewhere
Calvinguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 04:17 PM   #10
Trafficbrokercom
Confirmed User
 
Join Date: Dec 2002
Posts: 542
php:

they should know how a class is written ..

let them write a sample script.


mysql:

they should be able to define a left outer join ..
Trafficbrokercom is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 04:32 PM   #11
Tempest
Too lazy to set a custom title
 
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
".. how a class is written..."?? Real programmers don't need no stinkin' classes.. or is it don't have any class??

Ask him/her
- how to surpress errors at runtime.
- write code to randomize a list, eg: like shuffle deck of cards.
- define tables for a "quick" bookstore database.
Tempest is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 04:38 PM   #12
SMG
Confirmed User
 
Join Date: Aug 2003
Posts: 1,798
Quote:
Originally posted by Trafficbrokercom
php:

they should know how a class is written ..

let them write a sample script.


mysql:

they should be able to define a left outer join ..

I've been coding php fulltime for 5 years now, and I only use classes when I want "pretty" code, I dont need them in php unless I wanna make something thats ultra easy to reuse, and I've only made 2 classes out of my last maybe 100 projects...

Also, I've never required to use a left outer join EVER, so I dont know how that should be a req :-P (but I know how, just never use them myself)



I would simply ask for examples of their work, and code snippets, I FUCKING HATE IDIOTS WHO MAKE UGLY CODE :D
__________________
TGP Webmasters: sign up for the top 100 tgp list!
Submit galleries
If you add me to icq (title) make sure to mention GFY or I'll think you're a bot and deny you.
SMG is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 04:43 PM   #13
JSA Matt
So Fucking Banned
 
Join Date: Aug 2003
Location: San Diego, CA
Posts: 5,464
Quote:
Originally posted by SMG
I've been coding php fulltime for 5 years now, and I only use classes when I want "pretty" code, I dont need them in php unless I wanna make something thats ultra easy to reuse, and I've only made 2 classes out of my last maybe 100 projects...

Also, I've never required to use a left outer join EVER, so I dont know how that should be a req :-P (but I know how, just never use them myself)



I would simply ask for examples of their work, and code snippets, I FUCKING HATE IDIOTS WHO MAKE UGLY CODE :D
Agreed 100%. In the last 4 years i've used classes in PHP for maybe 2 projects, and that was just for fun, not required. I would just have them code something simple, you can easily tell by their code if they know what they are doing or not
JSA Matt is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 04:51 PM   #14
Big Ray
Confirmed User
 
Join Date: Dec 2003
Posts: 464
Quote:
Originally posted by JSA Matt
Agreed 100%. In the last 4 years i've used classes in PHP for maybe 2 projects, and that was just for fun, not required. I would just have them code something simple, you can easily tell by their code if they know what they are doing or not
What is a good project to code in PHP that utilizes MySQL? 2 Hours. In house.

BTW - If you think you have the skills and want to apply, send me your resume. [email protected]. Position is in Santa Clara at our office.
__________________

Five of the Top 10 Largest Programs Host with Jupiter. Find out why at http://www.jupiterhosting.com

Last edited by Big Ray; 05-25-2004 at 04:54 PM..
Big Ray is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 04:58 PM   #15
bawdy
Confirmed User
 
Join Date: Feb 2002
Posts: 1,424
give them something like the following and see if they can get it to work:

$form = new Form("form1", hahahahahaha, "manage.php", "validateForm(this)");

$form->addElement(new formElementHiddenField("id", $id));
$form->addElement(new formElementHiddenField("mode", $mode));
$form->addElement(new formElementTextField("Title", "title", $title, 60, 255, "smallfield",true));
$form->addElement(new formElementTextField("Text Version", "textcontent", $textcontent, 60, 255, "smallfield",true));
$form->addElement(new formElementTextArea("HTML Version", "fullstory", $fullstory));
$form->addElement(new formElementSubmitButton());

$form->getForm();


I wouldnt expect them to be successfull but you will get an idea if the can figure stuff out and use classes etc.... thats what all my code looks like ;)
bawdy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:04 PM   #16
s9ann0
Confirmed User
 
Join Date: Sep 2001
Location: Boston
Posts: 4,873
ask them if you can do a goto in php like in perl and without making it a function
cos I wanna do that and I don't think you can icq me the answer 8775429!
s9ann0 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:05 PM   #17
SMG
Confirmed User
 
Join Date: Aug 2003
Posts: 1,798
I'd say make em do something fun ... hell, there are tons of php contests out there, make em do one of them :D
__________________
TGP Webmasters: sign up for the top 100 tgp list!
Submit galleries
If you add me to icq (title) make sure to mention GFY or I'll think you're a bot and deny you.
SMG is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:10 PM   #18
s9ann0
Confirmed User
 
Join Date: Sep 2001
Location: Boston
Posts: 4,873
classes are gay and people that only do stuff in php / mysql or think you need classes for shitty porn web stuff are super gay


mmap your graphics and install APC cache

if your webserver is not using php unload the module

stop being so gay and talking about classes
s9ann0 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:12 PM   #19
fuzebox
making it rain
 
fuzebox's Avatar
 
Industry Role:
Join Date: Oct 2003
Location: seattle
Posts: 22,158
At my last company we made up a little mini exam for all of the prospective developers...

5 separate mini programs printed out, 3 had a bug and 2 were written inefficiently... They had to correct the problem and explain why (writing with a pen).

One guy ended up asking for extra paper, and by the time he was done had written what was basically an essay... We hired him
fuzebox is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:28 PM   #20
woj
<&(©¿©)&>
 
woj's Avatar
 
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
Quote:
Originally posted by fuzebox
[B
5 separate mini programs printed out, 3 had a bug and 2 were written inefficiently... They had to correct the problem and explain why (writing with a pen).
[/B]
That's a good way to tell if someone knows what they are doing..
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager
woj is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:31 PM   #21
JSA Matt
So Fucking Banned
 
Join Date: Aug 2003
Location: San Diego, CA
Posts: 5,464
Quote:
Originally posted by fuzebox
5 separate mini programs printed out, 3 had a bug and 2 were written inefficiently... They had to correct the problem and explain why (writing with a pen).
Very good idea, no testing allowed, just pure code. I like it.
JSA Matt is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:34 PM   #22
SicChild
Confirmed User
 
Join Date: Mar 2003
Posts: 365
How about.... 'do you have references'?
SicChild is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:38 PM   #23
KidCock
So Fucking Banned
 
Join Date: May 2003
Location: San Pedro, Costa Rica
Posts: 788
We have a small mysql/php test I made up here we use...15 question:

10 multiple choice
3 short answer
2 coding examples

I can send you it by email if you like.

No one ever got above 9/15 though but it's not that hard hehe.
KidCock is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:40 PM   #24
Tempest
Too lazy to set a custom title
 
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
Just pulled out some of my old interview questions/tests. Too bad it's all C or assember. Here's a good "old" simple one.

$i=1;
$i=$i++ + ++$i;
echo $i;

what gets displayed?

Seriously, if he/she's going to be designing your databases, then having them do up a "simple" bookstore DB for you would be a very good idea. If they do it with 1 or 2 tables you've got a problem.
Tempest is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:44 PM   #25
Thomas1007
Confirmed User
 
Thomas1007's Avatar
 
Join Date: Aug 2002
Location: BC Canada
Posts: 5,542
Let me grab our programmer and get you a few

need something done
contact me Thomas
__________________
BUY THIS SPOT CONTACT ME FOR DETAILS


Thomas1007 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 05:47 PM   #26
piker
Confirmed User
 
Join Date: Feb 2004
Posts: 597
Quote:
Originally posted by MaskedMan
If they have any experience in optomization/streamlining both php code as well as mysql databases to run on higher traffic loads.
You don't know php/mysql do you?
__________________
IcooCash - DVD Content for your TGP
Cheap FreeBSD Virtual Hosting
ICQ me at 605104 for Custom PHP/MySQL Programming
piker is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 06:21 PM   #27
Volantt
Confirmed User
 
Join Date: Nov 2003
Location: Penguin vs Devil
Posts: 745
Tests and essays are not a good pointer. The coder should be willing to do a small job before being hired, this should give you a good detail of how they code:

1. Take direction
2. Innovate
3. Perform
4. Deliver

It is tuff to hire a coder, designers are easy because artistic ability is either bad, good, or excellent. Coders come in all shapes and sizes.

V

Hit me up on ICQ if you have any questions.
__________________
"Only the dead have seen the end of war." - Plato
"In the abscence of orders, go find something and kill it." - Erwin Rommel
"A man's worth is no greater then the worth of his ambitions." - Marcus Aurelius
Volantt is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 07:42 PM   #28
untitled
Confirmed User
 
Join Date: Sep 2002
Posts: 352
using classes in php isn't necessary but a good programmer should know object oriented programming
untitled is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 07:47 PM   #29
vending_machine
Confirmed User
 
Join Date: Jun 2002
Location: Seattle
Posts: 1,062
Ask them how many pennies it would take to create a stack as tall as the Statue of Liberty.

You don't want the 100% correct answer, or anything near that for that matter, you should pay attention to how they think. If they're good problem solvers it'll be easy for them. That IMO is the biggest plus for a programmer.
vending_machine is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 08:33 PM   #30
Mortimer
Confirmed User
 
Join Date: Oct 2002
Location: Where the hell am I now?
Posts: 153
Quote:
Originally posted by KidCock
We have a small mysql/php test I made up here we use...15 question:

10 multiple choice
3 short answer
2 coding examples

I can send you it by email if you like.

No one ever got above 9/15 though but it's not that hard hehe.
Hi,
i'd like to see what your test is, why don't you post it here for everyone to see? Maybe we could even improve it with everyone's feedback?

There are some good suggestions in this thread, and some not worth even talking about But I think this test is pretty good for testing them out if you already have a programmer that can write it out for you and evaluate the results:

Quote:
5 separate mini programs printed out, 3 had a bug and 2 were written inefficiently... They had to correct the problem and explain why (writing with a pen).
__________________
The wiseman owns little but knows much, while the fool knows little but owns much
Mortimer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-25-2004, 08:47 PM   #31
FiReC
Confirmed User
 
Industry Role:
Join Date: Jan 2002
Location: Land o Nubiles
Posts: 2,350
Quote:
Originally posted by Big Ray
What is a good project to code in PHP that utilizes MySQL? 2 Hours. In house.

barebones tgp script that pulls a listing of galleries from the db and also has a submit form or mass import system to insert data.
FiReC is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-26-2004, 12:33 PM   #32
Mortimer
Confirmed User
 
Join Date: Oct 2002
Location: Where the hell am I now?
Posts: 153
bump
__________________
The wiseman owns little but knows much, while the fool knows little but owns much
Mortimer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-27-2004, 06:43 PM   #33
KidCock
So Fucking Banned
 
Join Date: May 2003
Location: San Pedro, Costa Rica
Posts: 788
Sorry everyone for the delay...

Soon as I can find it I will post it, if I still can't find where I kept my document I know at the office I have a hard-copy printed out I can type up.
KidCock is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-28-2004, 01:25 PM   #34
KidCock
So Fucking Banned
 
Join Date: May 2003
Location: San Pedro, Costa Rica
Posts: 788
Here is the test we are using. It's something we came up with pretty quick, to weed out some candidates.

I'm sure it's not the greates and can be much improved, but it's working well for us.

Mysql Questions
1 - You need a column type which will be able to store time and date in the range 1900-01-01 - 2199-12-31. Which column should you choose for this range?
a. DATETIME
b. TIMESTAMP
c. Either DATETIME or TIMESTAMP
d. Neither DATETIME nor TIMESTAMP will work for this range of dates.

2 ? You have the following table:

mysql> DESCRIBE keywords;
+------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+-------+
| article_id | int(11) | | PRI | 0 | |
| keyword | varchar(20) | | PRI | | |
+------------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

You want to find all articles that contain both the keywords 'MySQL' and '4.0'. How can you do this in one query?

a. By using the BIT_COUNT() function in your SELECT
b. By using the FIND_IN_SET() function in the WHERE part of the SELECT
c. You cannot do this in MySQL
d. You write a query where you join the table with itself

3 - What is MySQL AB?

a. An upcoming version of MySQL that includes new table types
b. The company that develops and promotes the MySQL suite of programs
c. A MySQL client for use on UNIX platforms
d. A form-based front-end for generating reports based on data in a MySQL server

4 - What is purpose of the mysqldump program ?

a. it is used to resolve mysql core dumps and sending bug reports
b. it is used for low-level interaction with MySQL table data
c. it is used to dump table structure and content in text format
d. it is used to flush all tables prior to shutting down the MySQL serve
5 - Suppose you have the following tables :
mysql> DESCRIBE Country;
+----------------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+------------+------+-----+---------+-------+
| Code | char(3) | | PRI | | |
| Name | char(52) | | | | |
| Capital | int(11) | YES | | NULL | |
+----------------+------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

mysql> DESCRIBE City;
+------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+----------+------+-----+---------+----------------+
| Id | int(11) | | PRI | NULL | auto_increment |
| Name | char(35) | | | | |
| Country | char(3) | | | | |
| Population | int(11) | | | 0 | |
+------------+----------+------+-----+---------+----------------+
4 rows in set (0.00 sec)
The tables are related through Capital in Country to Id in City and Code in Country to Country in City
Which rows will the following query return?
SELECT Country.Name, Capital FROM City, Country WHERE Capital = Id;

a. It will return all rows from the Country table, with or without corresponding Capitals in City
b. No rows, it will result in an error
c. It will return all rows from the City table with or without corresponding Capital entries in the Country table
d. It will return the number of rows in Country multiplied by the number of rows in City
e. It will return all rows from the Country table that have corresponding Capitals in the City table

6 ? You encounter a corrupt table in MySQL. How do you resolve the issue?









PHP Questions



7 ? What is the purpose of the PHP function print_r() ?

a. used to automatically display text with line breaks
b. displays information about a variable in a way that's readable by humans.
c. is identical to ?echo?
d. outputs a string of text in html format

8 ? Which of these is an invalid use of the PHP function substr() ?

a. substr(?abcdef?,1);
b. substr(?abcdef?,-1,3);
c. substr(1,?abcdef?);
d. substr(?abcdef?,0);

9 ? Using the PHP function date() , and assuming $time is the current time as a unix timestamp, how would you convert $time into the format ?25-11-2004 23:01? ?

a. date(?D-M-Y h:a?,$time);
b. date(?d-m-Y H:i?,$time);
c. date($time,?D-M-Y h:a?);
d. date($time,? d-m-Y H:i?);

10 ? You have just upgraded your version of PHP and you have noticed that a GET variable you were using in one of your pages is now coming up blank. What could be the cause, assuming your code has not been modified?

a. the new version you are using doesn?t support GET variables
b. the new version you are using will only allow GET variables when using the special variable $_GET[]
c. the configuration option register_globals is now set to OFF
d. all of the above

11 ? When using the PHP function header() to redirect a user to another location, what must you always remember?

a. redirects of this type will not work in Netscape
b. never use exit() after the header function or your redirect will not work properly
c. always use exit() after the header function to prevent executing of code after the redirect
d. you may not redirect to a SSL-enabled page (ie. https://)

12 ? What is the purpose of the php.ini file?

a. contains list of global variables
b. this file doesn?t exist
c. is the default configuration file of PHP
d. this file is no longer supported past PHP3




13 ? What is the value of $x, after the following PHP statement ?

$a=1; $b=3; $c=5;

if ($a = $b) {
$x = 100;
}
elseif ($b > $c) {
$x = 50;
}
elseif ($b < $a) {
$x = 42;
}
elseif ($a > $c) {
$x = 20;
}

a. $x = 100;
b. $x = 50;
c. $x = 42;
d. $x = 20;

14 ? Your PHP script returns you the error ?Warning: mysql_connect(): Host not allowed?. How do you resolve the problem?
















15 ? Write a block of PHP code to output every fifth (5th) line of a text file. To help you, here are some functions you might want to use:


fopen -- Opens file or URL
Description
resource fopen ( string filename, string mode [, int use_include_path [, resource zcontext]])
fopen() binds a named resource, specified by filename, to a stream. If filename is of the form "scheme://...", it is assumed to be a URL and PHP will search for a protocol handler (also known as a wrapper) for that scheme. If no wrappers for that protocol are registered, PHP will emit a notice to help you track potential problems in your script and then continue as though filename specifies a regular file.

fclose -- Closes an open file pointer
Description
bool fclose ( resource handle)
The file pointed to by handle is closed.
Returns TRUE on success or FALSE on failure.
The file pointer must be valid, and must point to a file successfully opened by fopen() or fsockopen().


fgets -- Gets line from file pointer
Description
string fgets ( resource handle [, int length])
Returns a string of up to length - 1 bytes read from the file pointed to by handle. Reading ends when length - 1 bytes have been read, on a newline (which is included in the return value), or on EOF (whichever comes first). If no length is specified, the length defaults to 1k, or 1024 bytes.
If an error occurs, returns FALSE.


feof -- Tests for end-of-file on a file pointer
Description
bool feof ( resource handle)
Returns TRUE if the file pointer is at EOF or an error occurs (including socket timeout); otherwise returns FALSE.
KidCock is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-28-2004, 02:36 PM   #35
Nathan
Confirmed User
 
Industry Role:
Join Date: Jul 2003
Posts: 3,108
Pro and Cons of Object Oriented Programming has been discussed plenty of times. OOP in a non-windows type environment is in my oppinion not at all needed though.

OOP in PHP is actually too slow in my oppinion, and I would NEVER use it.

I usually look at old projects, if the script looks badly written or not well organized I would never higher them because it will be a pain to modify it later.

----
Tempest:
$i=1;
$i=$i++ + ++$i;
echo $i;

neat little trick question I must admit, I am not sure what the answer is of the top of my head in PHP, since I am not sure how it parses this stuff exactly. But $i should be 4.
($i = $i++ + ++$i evaluates to $i = 1 + 3 because $i++ will increase $i to 2, but evalutes to 1 and ++$i will increase it to 3 and evalute to 3, $i is then set to 1 + 3.)

Correct me if I'm wrong Tempest.

----

KidCock.. lemme try your test.. maybe I can be the first getting above 9/15 <g>

1. a)

2. e) (lol) you write a query like this: select article_id, count(*) num from keywords where keyword='MySQL' or keyword='4.0' group by article_id having num=2;
BTW, your table structure of keywords table sucks ;)

3. b)

4. c)

5. e)

6. I login to the db with the mysql client and run repair table <tablename>;
(your table structure isn't the best again btw)

7. b)

8. c)

9. b)

10. c)

11. c)

12. c)

13. is not easy since I am not sure what was replaced by the damn forbidden words thing on GFY. but $x should be a), unless the $a = $b is not a hidden idea to confuse people and is just a bug in your script.

14. uhm, why is that a PHP question? Add the friggin connecting host to your grant tables in mysql.

15. writing php time, gimme a minute for that. next post.
__________________
"Think about it a little more and you'll agree with me, because you're smart and I'm right."
- Charlie Munger
Nathan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-28-2004, 02:39 PM   #36
Nathan
Confirmed User
 
Industry Role:
Join Date: Jul 2003
Posts: 3,108
15.

you do give them damn weird functions to use, but you said I _MAY_ want to use them, I don't... so here goes: $file_to_open is the filename to print every 5th line from.

Code:
$lines = file($file_to_open);
$i = 4;
while($i < count($lines)) {
echo $lines[$i];
$i += 5;
}

Ok, what do I win?
__________________
"Think about it a little more and you'll agree with me, because you're smart and I'm right."
- Charlie Munger
Nathan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-28-2004, 03:25 PM   #37
Nathan
Confirmed User
 
Industry Role:
Join Date: Jul 2003
Posts: 3,108
*bump* for kidcock
__________________
"Think about it a little more and you'll agree with me, because you're smart and I'm right."
- Charlie Munger
Nathan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-28-2004, 03:34 PM   #38
Arty
Confirmed User
 
Join Date: Nov 2002
Posts: 880
Ask him if he ever discovered a bug in php or mysql and be able to workaround till it get fixed..

Last edited by Arty; 05-28-2004 at 03:36 PM..
Arty is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-28-2004, 04:55 PM   #39
fuzebox
making it rain
 
fuzebox's Avatar
 
Industry Role:
Join Date: Oct 2003
Location: seattle
Posts: 22,158
Quote:
Originally posted by piker
You don't know php/mysql do you?
fuzebox is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-28-2004, 04:56 PM   #40
fuzebox
making it rain
 
fuzebox's Avatar
 
Industry Role:
Join Date: Oct 2003
Location: seattle
Posts: 22,158
And goddamn, that's a tricky test!
fuzebox is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-28-2004, 05:06 PM   #41
AdultNex
Confirmed User
 
Join Date: Feb 2003
Location: Bostonnnn
Posts: 8,985
Quote:
Originally posted by vending_machine
Ask them how many pennies it would take to create a stack as tall as the Statue of Liberty.

You don't want the 100% correct answer, or anything near that for that matter, you should pay attention to how they think. If they're good problem solvers it'll be easy for them. That IMO is the biggest plus for a programmer.
Wtf... A fourth grader could answer that question.
AdultNex is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-28-2004, 05:18 PM   #42
chemicaleyes
UNSTOPPABLE
 
chemicaleyes's Avatar
 
Join Date: Aug 2003
Location: UK :: ICQ# 156068
Posts: 11,569
Quote:
Originally posted by piker
You don't know php/mysql do you?
__________________
No way as way, No limitation as limitation. AmeriNOC formally PhatServers
chemicaleyes is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-28-2004, 05:24 PM   #43
Nathan
Confirmed User
 
Industry Role:
Join Date: Jul 2003
Posts: 3,108
Quote:
Originally posted by piker
You don't know php/mysql do you?
maybe I do not know php/mysql either, but why did you post that in reply to maskedman's post?
__________________
"Think about it a little more and you'll agree with me, because you're smart and I'm right."
- Charlie Munger
Nathan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-28-2004, 05:29 PM   #44
aSStig
Confirmed User
 
Join Date: Apr 2004
Posts: 1,102
do you know, what is a PC ?

do you know, how does it look like ?

do you know how to operate it ?

tell me how, i dont know how does it works ?
__________________
PAYMENT SOLUTIONS
http://www.firstdata.com
aSStig is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-28-2004, 05:34 PM   #45
KidCock
So Fucking Banned
 
Join Date: May 2003
Location: San Pedro, Costa Rica
Posts: 788
Quote:
Originally posted by Nathan
15.

you do give them damn weird functions to use, but you said I _MAY_ want to use them, I don't... so here goes: $file_to_open is the filename to print every 5th line from.

Code:
$lines = file($file_to_open);
$i = 4;
while($i < count($lines)) {
echo $lines[$i];
$i += 5;
}

Ok, what do I win?
15/15!

You'd win a second interview if you were applying heh.

I told you it wasn't so hard ;p but you'd be amazed the number of people who get around 5-6 / 15 only. We use it to decide who should come back for the 2nd interview (of 4 total interviews).

You're only the second person to get the intended trick in the 13th question though. Out of something like 40 people we have interviewed. (the hahah was supposed to be a open bracket for the if/elseifs).
KidCock is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-29-2004, 12:07 AM   #46
Nathan
Confirmed User
 
Industry Role:
Join Date: Jul 2003
Posts: 3,108
YAY!

its a good test for average stuff, definately. A few nice trick questions.

What was your expected answer for 2) though?
__________________
"Think about it a little more and you'll agree with me, because you're smart and I'm right."
- Charlie Munger
Nathan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.