Programming Language Concepts and History
Test your knowledge of programming language paradigms, history, features, and core concepts including functional programming, OOP, language design, and syntax definition.
Questions
What is the result of the following code? 1. public class Drink { 2. private int millis = 200; 3. boolean carbonated = false; 4. 5. public static void main(String [] args) { 6. System.out.println(new AppyFizz()); 7. } 8. } 9. class AppyFizz extends Drink { 10. public String toString() { 11. return millis + " " + carbonated; 12. } 13. }
- 12 false
- Compiler error on line 6
- Compiler error on line 12
- Compiler error on line 11
What is the result of the following code? 1. public abstract class A { 2. private void doStuff() { 3. System.out.println("A"); 4. } 5. 6. public static void main(String [] args) { 7. A a = new B(); 8. a.doStuff(); 9. } 10. } 11. 12. class B extends A { 13. protected void doStuff() { 14. System.out.println("B"); 15. } 16. }
- A
- B
- Compiler error on line 7
- Compiler error on line 13
What is the result of the following code? 1. public abstract class Catchable { 2. protected abstract void catchAnObject(Object x); 3. 4. public static void main(String [] args) { 5. java.util.Date now = new java.util.Date(); 6. Catchable target = new MyStringCatcher(); 7. target.catchAnObject(now); 8. } 9. } 10. 11. class MyStringCatcher extends Catchable { 12. public void catchAnObject(Object x) { 13. System.out.println("Caught object"); 14. } 15. 16. public void catchAnObject(String s) { 17. System.out.println("Caught string"); 18. } 19. }
- Caught string
- Caught object
- Compiler error on line 12
- Compiler error on line 2
At Dartmouth College in 1964 John Kemeny and Thomas Kurtz invented .... ?
- ALGOL
- BASIC
- FORTRAN
- NONE
Who invented C++ ?
- Anders Hejlsberg
- Grace Hopper
- Bjarne Stroustrup
- Alan Cooper
Which of these is not a functional programming language
- F#
- ERLANG
- LISP
- FORTRAN
Dylan, Erlang, Haskell and ML are examples of ... ?
- web languages
- declarative languages
- functional languages
- visual languages
A true or false statement put into code that the programmer expects to always be true is an ...
- exception
- harness
- assertion
- expression
EBNF is ...
- Extensible Book Notation Format
- a replacement for the SAX XML parser
- the leader of the free software foundation
- a syntax for defining grammar
Dim strQuestion,strCount
strQuestion=" abc "
strQuestion=Trim(strQuestion)
strCount=Len(strQuestion)
- strCount=7
- strCount=9
- strCount=3
- strCount=0
Dim strOne strOne=String(3,"A") Msgbox strOne
- aaa
- A A A
- AAA
- A
Dim strOne strOne=InStrRev("abc","ABC") Msgbox strOne
- 1
- 3
- 0
- 6
Dim x x=InStrRev("abc abc","abc") x=????
- x=2
- x=3
- x=5
- x=0
Dim x x=InStr("abc abc","abc") Msgbox x
- 0
- 2
- 1
- 3
x="TIB Ltd"
y=Len(x)
y=???
- 7
- 6
- 3
- 0
x=Right("abcd.xls",4) x=????
- .xls
- abcd
- excel
- true