Smalltalk Interview Questions
Jonathan Pletzke
jpletzke@sprynet.com
The Technical Expertise Corporation
532 Hudson Street, 3rd Floor
Hoboken, NJ 07030
(Original Questions)
1. What was the original assignment operator in Smalltalk-80?
2. What does the at: method of a collection class return?
3. What does the at:put: method of a collection class return?
4. What is a "first class object"?
5. Tell me about block variables, arguments, and scope of variables?
6. Explain Smalltalk mathematical notation, including order of operations and the reasons.
7. Why can't you do recursion in Smalltalk?
8. What is the difference between an instance variable, a class variable, and a
class-instance variable?
9. Describe indexed instance variables versus names instance variables.
10. How do you access indexed instance variables?
11. What is a metaclass, and which objects are instances of metaclass?
12. What is an abstract class? Can you name in example in Smalltalk?
13. How does Smalltalk support multitasking?
14. Name some examples of how Smalltalk is oriented toward single users.
How can these problems be approached or overcome?
15. Suppose you were offered the choice of two tasks with the same tight
deadline:
A. Write a Smalltalk to C++ cross-compiler.
B. Write a C++ to Smalltalk cross-compiler.
Which task would you choose, and why?
16. Explain the difference between do:, collect:, reject:, select:,
detect:, and (for bonus points) inject:into:.
17. Name some of Smalltalk's shortcomings.
18. What is the fundamental difference between an Array and an OrderedCollection?
More Questions
19. What are true and false?
20. What is nil?
21. Without using any temporary variables, construct a method that sums
the values of a collection of numbers.
22. Compare and contrast #deepCopy and #shallowCopy.
23. What is the result of evaluating the following method, and why?
| oc copy |
oc := OrderedCollection with: ' bc' copy with: ' bc' copy.
copy := oc copy.
1 to: oc size do: [:index | (oc at: index) at: 1 put: $a ].
^copy first
24. Which class implements the class method #new?
25. How do you customize the contents of what is displayed in an
inspector?
26. What is the purpose of the instance method #hash?
27. What do the following terms mean? Abstract class, Overloading,
Primitives, and State.
28. What is the reply of the following code fragment?
^OrderedCollection new add: #red add: #blue
29. What would be a better way to implement the following:
| customerAction policyAction |
customerAction := [ ... code fragment ... ].
policyAction := [ ... another code fragment ... ].
(self modelObject class = customer)
ifTrue: [ customerAction value ]
ifFalse: [ policyAction value ]
30. What is meant by the term 'lazy initialization'?
31. How can you display (write) information to the Transcript?
32. List and describe the different message formats supported by
Smalltalk and state their order of precedence.
33. What is a VisualAge database access set?
34. What does abt stand for?
35. What is the difference between a Dictionary and an IdentityDictionary?
36. What is a message file (VisualAge)?
37. What does the term 'vote' refer to in the VisualAge drag&drop
framework?
38. What roles do adaptors play in the VisualAge drag&drop framework?
39. What is the purpose of the PlatformFunction class (IBM Smalltalk)?
40. What is the purpose of the Signal class?
41. What is the purpose of the Delay class?
42. How do you change the system pointer (i.e. to an hourglass)(VisualAge)?
43. What is the answer of the following code? ^5 + 3; + 7
44. What does the term localization refer to?
45. Who can purge and salvage classes and applications (ENVY)?
46. Which messages can be sent to cause specific methods and classes to
be included in a package(IBM Smalltalk)?
47. How do you remove the VisualAge splash screen?
48. What is the purpose of the method #finalInitialize (VisualAge)?
49. What is the POM Repository (IBM Smalltalk - Sparky persistence)?
50. What do the terms manage, map, and realize mean in the IBM Smalltalk
view framework?
51. How can you change the system menu in VisualAge?
52. How can you read an environment variable (VisualAge) like 'Path'?
53. Why can't you unload a SortedCollectio using the ObjectDumper (IBM Smalltalk)?
54. What is the purpose of #become:?