Dear Applicant, Thank you for your interest in the Software Developer position on the Google for Work Apps Support Operations team. Please note that we do not expect you to have experience with everything listed. Here are some guidelines for filling out this questionnaire:
How would you rate your hands-on experience in:
Unix/Linux skills: 7
Shell_scripting: 6
How many years professional experience do you have with:
Unix (Linux, Solaris, BSD etc): 10+ years
Windows: 5+ years
How would you rate your hands-on experience in:
HTML hand coding: 7
XML: 7
SAML: 0
Single Sign-on Security systems: 2
AppEngine: 2
Frontend development framework: Bootstrap 5, Semantic 3, Skeleton 5
Relational Database configuration and administration: 6
How would you rate your hands-on experience, and how many years professional experience do you
have with each language (where applicable):
C/C++: 5, months
Java: 5, 1 year
Python: 8, 6 years
JavaScript: 7, 10 years
Shell programming: 3, years
XSLT: 6, 1 year
C#.NET: 5, 1 year
In Python, what is the first argument of a method definition?
(Hint: a method definition is a function defined inside a class)
self is the convention, although you can call it whatever you want. It is populated with the instance of the object being used.
Difference in Python between "x = y" vs. "x = y[:]". How do you tell which was used?
The former: assigns the value of y to x. The latter: assign a shallow copy of y to x. The former: x and y have the same id. The latter: the ids are different.
How are user sessions handled within a web application? What about if the client has disabled cookies?
Usually by setting a cookie with a unique identifier. You can pass the identifier around as a URL parameter.
Explain what is RESTful web service?
It is a service that implements REST! It serves resources in known formats at idempotent URI's over http(s). They're quite useful to web/mobile applications
Describe how oauth 2.0 works?
It's a double blind system where both sides exchange tokens elicited from the resource holder and verify the validity: Eg:
- Mary visits my website (which seeks to access her gmail account).
- My website asks the google auth for a grant token and then returns that to Mary
- Mary is redirected to google auth and presented with an authentication sequence which she completes successfully
- Mary is redirected to my website with an authentication token
- My website presents it to google auth which acknowledges it and grants access
- Either party can tell google auth to revoke access.
When would you use a list vs. tuple vs. dictionary vs. set?
A list by default, but
A tuple when I don't want the value to change, or
A dictionary when I do want to access the values with a key, or
A set when I don't want duplicates and/or don't care what order they're in.
Describe an SQL injection attack and how would you protect against it?
Crafted strings to run arbitrary commands or distort the results is provided where the naive developer was expecting a user value. eg: expecting username "joeblow" and getting "' or 1=1'" Protect against it by using database parameterization features, filtering special characters, escaping user input, and generally treating all user strings with suspicion.
Name one (or more) templating engine you have used? what are the advantages of using them?
django, jinja2, and moustache. You can write the code in a style native to the target and drop values in easily, and reuse the templates with different values.
Which algorithm is faster, one that requires 2^n time or one that requires n^3 time for large inputs?
I'm going to go with n^3, because it's just two multiplcation operations, whereas 2^n could be n-1 operations which, for n > 3, will surely take longer.
How would you share a global constant across modules in python?
I'd put it in one module then import it into the rest.
Write a function match() that takes two arguments:
You should not use any string or regular expression functions, apart from the following:
You can use any programming or scripting language. Your code should compile and run without any modifications.
def match(pattern, text):
"""True if pattern is a substring of text.
:param pattern: the substring wholly contained in the text
:param text: the string which may, or may not, contain pattern
:returns: true/false
"""
return pattern in text
def match2(pattern, text):
"""A more primitive version since 'in' is perhaps considered a string function."""
try:
return text.index(pattern) >= 0
except ValueError:
return False
def skipto(letter, text):
"""Skip to the next occurence of letter in text.
:returns: str: text with the chars which don't match letter trimmed off the front
"""
for char in text:
if letter == char:
return text
else:
text = text[1:]
return ''
def allhere(pattern, text):
"""True if text starts with pattern. A few extra chars are fine."""
i = 0
while True:
try:
if i == len(pattern):
return True
elif pattern[i] == text[i]:
i += 1
continue
else:
return False
except IndexError:
return False
def match3(pattern, text):
"""Hmm, too easy again? Yeah, ok, index returns the position of the char, not the nth char... try again"""
# empty pattern always matches
if not len(pattern):
return True
tail = text
while len(tail):
tail = skipto(pattern[0], tail)
if allhere(pattern, tail):
return True
tail = tail[1:]
return False
assert skipto('a', 'ab') == 'ab'
assert skipto('b', 'ab') == 'b'
assert skipto('c', 'abc') == 'c'
assert skipto('a', 'abc') == 'abc'
assert skipto('', 'ab') == ''
assert skipto('z', 'abc') == ''
assert allhere('', 'abc')
assert allhere('a', 'a')
assert allhere('a', 'abc')
assert allhere('ab', 'abc')
assert allhere('abc', 'abc')
assert not allhere('z', 'abc')
assert not allhere('az', 'abc')
assert not allhere('ac', 'abc')
assert not allhere('bac', 'cbac')
for match in [match, match2, match3]:
print match.__name__, 'start'
assert match('', '') is True
assert match('', 'a') is True
assert match('a', '') is False
assert match('a', 'a') is True
assert match('z', 'a') is False
assert match('a', 'abc') is True
assert match('b', 'abc') is True
assert match('c', 'abc') is True
assert match('z', 'abc') is False
assert match('ab', 'abc') is True
assert match('bc', 'abc') is True
assert match('ac', 'abc') is False
assert match('az', 'abc') is False
assert match('abc', 'b') is False
assert match('abc', 'abc') is True
assert match('abc', 'ababcab') is True
assert match('abc', 'abababbbababcaaabbbccc')
print match.__name__, 'stop'
import datetime
print datetime.datetime.now()