Skip to content

Instantly share code, notes, and snippets.

@preaction
Created December 4, 2010 01:16
Show Gist options
  • Select an option

  • Save preaction/727806 to your computer and use it in GitHub Desktop.

Select an option

Save preaction/727806 to your computer and use it in GitHub Desktop.
Rate your proficiency on 1-10 then answer some of the questions
Perl
1-3
- Tell me what a regular expression is?
- A pattern to match against a string
- What is CPAN?
- Comprehensive Perl Archive Network
- Place for perl code, modules and scripts
- What symbol is used for creating a hash?
- my %hash = ( name => value );
- The % is the important bit
4-6
- How do you de-reference a hash reference?
Either $hashref->{name} (the -> and the { } are the important bits)
or %{ $hashref } (the %{ } is the important bit)
- What is the key to defining a constructor in a new class?
"bless"
return bless $self, $class;
- What does bless do?
Binds a package to a reference
Allows you to call subroutines from the package on the reference
"Creates an object" is acceptable
- What CPAN module would you use to get a web page from the internet.
LWP, LWP::UserAgent, LWP::Simple are acceptable
WWW::Mechanize is even better
7-9
- What is the symbol table?
- package variables, sub routines, file handles, etc - place you install methods
- It's a hash of information about the variables and subroutines available currently,
keyed by the package the var/sub is in
- How do pass a file handle as reference to a sub routine?
- They should use the three-arg open: open my $fh, ">", "filename"
- In this case, the $fh is the filehandle reference
- If they don't know about three-arg open, they will use \*FILEHANDLE
Either way is acceptable
- What does tie do?
- binds a variable to a package (like bless)
- accessing the variable calls functions from the package
- This is kind of a trick question: tie() should not be used except in very special
circumstances
Not knowing this is completely okay, maybe even desired
JavaScript
1-3
- How do you create an array
var myArray = new Array() <- old and deprecated
var array = []; <- new and better
- How do you pop up a dialog box
alert() will pop up a message with an OK button
confirm() will pop up a message with a yes and a no button, returning true if yes is clicked
"Add a div to the page" will work fine as well.
Followup: How to make that div above everything and centered (a CSS question)
- How would you use JavaScript to redirect someone to another webpage
window.location.href
4-6
- What is the DOM?
Document Object Model
The object tree of all the HTML elements
Allows you to update, add, and delete HTML elements in the page
- How do you get a reference to an element in the DOM
document.getElementById is best
document.getElementsByName is good
for forms: document.forms[ "form name" ]
never ever: document.all
never ever: document["id"]
- What event would you use to validate an entire form's input at once?
onsubmit or the submit event
- What is AJAX?
Asynchronous Javascript And Xml
Xml is not a requirement
Allows http/website requests with the website already loaded (in the background)
7-9
- Name as many events as you can that are available on the <select> form element?
change, click, mouseover, mouseout, mousedown, mouseup
- How do you create an object in JavaScript
var obj = new Object();
var obj = {}
They may interpret that to mean "How do you create a class with methods", which is
var Class = function(){ /* initialize */ }
var obj = new Class();
so, create a function with a name, then use "new Name".
- What is an object's prototype and how do you use it?
The prototype is how methods are added to existing classes. Given the Class above:
Class.prototype.method = function (args) { /* do something */ };
You can also add variables and other stuff to the prototype, then use the prototype for inheritence:
var Subclass = function () {…}
Subclass.prototype = Class.prototype;
CSS
1-3
- Can you define a selector?
A selector chooses which elements a CSS rule applies to:
#id { /* <- the selector is #id */ }
.class { /* <- the selector is .class */ }
- Which CSS property would you use to underline text.
text-decoration: underline
- How do you create an inline style on a tag?
<tag style=" CSS properties "> (the style attribute)
- What are the different ways to add CSS rules to a page?
<link href="style.css" rel="stylesheet" /> (link and rel being the important bits)
<style> tag in the <head> block
style="" attribute in any HTML tag
4-6
- What is the difference between an Id and a Class
An ID uses # in the selector and can only be used on one element
A Class uses . in the selector and can be used multiple times in the document
Multiple classes may be used on the same item in a document
- What are the 4 anchor psuedo classes
:link, :active, :hover, :visited
Just knowing what a pseudo-class is would be great
7-9
- What is the default display context for a div tag?
display: block
If they need clarification: What is the default value for the "display" property?
or "Div is a block-level element"
- What are two ways to make a list display horizontally instead of vertically?
float: left on the LI
display: inline on the LI
Followup: What is the difference?
display: inline does not allow setting width
float won't push on its container by default
- How do you add IE specific code to a page.
Conditional comments:
<![if IE]>
Ghost-root hack (not recommended)
* html ...
- What does the * do?
Selects all elements
Linux
1-3
- How do I get superuser privileges?
su
sudo -i
sudo su -
sudo
- What directory would you find system configuration files?
/etc
- Where would you find log files?
/var/log
- Tell me to tell how much free space there is on a drive / disk
df
du
- Tell me how you get a list of all the things running on a box
ps x
optionally with "a" and/or "u" options
4-6
- How do I add things to run immediately when I log in?
Add to ~/.profile or ~/.bash_profile or ~/.bash_login
Followup bonus: What is the difference between bash_profile and bash_login?
bash_login is only run on interactive shells (user shells, shells for users)
- What is the current default GNU shell?
GNU uses "Bash", the Bourne-Again SHell
FreeBSD uses tcsh, an enhanced C-Shell
OpenBSD uses pdksh or "ksh", a public-domain Korne Shell
If they know what a shell is and that BASH is a shell, they're doing fine
- How do I find information on a command?
"man <command>"
"info <command>"
manpage
"Read the manual" : Followup with "What command do I use to read the manual?"
7-9
- How do you format a disk
mkfs will make a filesystem (destroying the old one)
fdisk is a UI to the same
parted is a UI to partitioning and formatting a disk
- Tell me how you add an IP address to a network interface
ifconfig will do it
ip add <address> is the newest way to do it
- What do load averages mean?
amount of load the system is under is acceptable
"Average number of processes trying to run" is better
- What does "screen" do?
"Terminal Multiplexer"
"Allows a command to keep running if you get disconnected" is acceptable, but misses the other use: running multiple terminals in a single connection (multiplexing)
- What permissions do I need to list a directory's contents?
You need "read" to see the directory, but you need "execute" to list the contents
Another pretty tricky question
Apache
1-3
- What is the difference between Directory and Location blocks?
<Directory> defines a location on the filesystem and must be absolute
<Location> defines a URL from the website and may not even have a file associated with it
- What is an htaccess file and what is it used for?
A trick question:
Everyone will say "username and password to prevent unauthorized access"
but the answer is "limited configuration of the apache server outside httpd.conf"
- What is a reverse proxy?
Almost the same thing as a regular proxy
Takes a connection from outside, and routes it to the correct place inside
( the reverse of a regular proxy, which takes a connection from inside, and routes it to the correct place outside )
- What user does Apache runs as?
By default on certain systems it may be: www, nobody, apache
Better answer: The user specified in the "User" directive of the config file
4-6
- What is mod rewrite
Change one URL into another transparently using regular expressions
"Pretty URLs" is acceptable
- How do you enable htaccess files?
"AllowOverride"
Only ask this if they know what an htaccess file really is
- Which directives specify where logs are kept?
CustomLog and ErrorLog
- What mod_rewrite directive would you use to match against the query string?
RewriteCond %{QUERY_STRING}
7-9
- What are likely causes of a 403 Forbidden error?
No read permissions on the file
No read and execute permissions on every directory above the file all the way up to /
"Deny" directive in the config file
- What are the two required directives for Virtual Hosts?
ServerName and DocumentRoot
- What do you need to do to enable CGI?
LoadModule cgi_module "modules/cgi.so" <- "a LoadModule line"
Options +ExecCGI
AddHandler cgi-script .cgi <- either "an AddHandler line" OR
ScriptAlias /cgi-bin/ "a ScriptAlias line"
SQL
1-3
- What is a join?
Joins two tables into one
Allows you to get both tables' information and filtering on both tables' columns
- What is the TRIM function for?
trim whitespace off the left and right side of a value
could trim anything with arguments
- What is group by used for?
Group a bunch of rows together based on the value of one or more columns
4-6
- What's the difference between an inner and outer join?
Inner join means a row must exist in both tables to be included
Outer join means a row in one table doesn't need a matching row in another to be included
- What is an index?
A column or group of columns that are prepared to be filtered often, for performance reasons.
"Faster searching" is acceptable
7-9
- When would you use a HAVING clause?
When you have a GROUP BY
When you are using an aggregate expression like MAX, FIRST, AVERAGE, or other
- What is the difference between a primary and foreign key?
A primary key is a unique index in the current table
A foreign key points to the primary key of another table.
HTML
1-3
- Which tag would you use to underline text?
Trick question. The current best practice is to apply underline with CSS
<u> is acceptable if their other skills are good
4-6
- What is the difference between HTML and XHTML?
XHTML is based on XML and requires XML strictness
always close tags, like <tag /> or <tag></tag>
- What are meta tags used for?
Metadata about a document
search engine keywords
HTTP headers
- What is the full XHTML structure of a table?
<table>
<caption> … </caption>
<thead>
<tr>
<th> … </th>
</tr>
</thead>
<tfoot>
<tr>
<td> … </td>
</tr>
</tfoot>
<tbody>
<tr>
<td> … </td>
</tr>
</tbody>
</table>
Knowing thead, tbody, and tfoot is fine
7-9
- How would you tell a page to display content in the utf-8 charset?
Send the appropriate HTTP headers
Content-Type: text/html; charset=UTF-8
Use a meta tag with the right content-type
<meta http-equiv="content-type" value="text/html; charset=UTF-8" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment