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.

16 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

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. }

  1. 12 false
  2. Compiler error on line 6
  3. Compiler error on line 12
  4. Compiler error on line 11
Question 2 Multiple Choice (Single Answer)

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. }

  1. A
  2. B
  3. Compiler error on line 7
  4. Compiler error on line 13
Question 3 Multiple Choice (Single Answer)

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. }

  1. Caught string
  2. Caught object
  3. Compiler error on line 12
  4. Compiler error on line 2
Question 4 Multiple Choice (Single Answer)

At Dartmouth College in 1964 John Kemeny and Thomas Kurtz invented .... ?

  1. ALGOL
  2. BASIC
  3. FORTRAN
  4. NONE
Question 5 Multiple Choice (Single Answer)

Who invented C++ ?

  1. Anders Hejlsberg
  2. Grace Hopper
  3. Bjarne Stroustrup
  4. Alan Cooper
Question 6 Multiple Choice (Single Answer)

Which of these is not a functional programming language

  1. F#
  2. ERLANG
  3. LISP
  4. FORTRAN
Question 7 Multiple Choice (Single Answer)

Dylan, Erlang, Haskell and ML are examples of ... ?

  1. web languages
  2. declarative languages
  3. functional languages
  4. visual languages
Question 8 Multiple Choice (Single Answer)

A true or false statement put into code that the programmer expects to always be true is an ...

  1. exception
  2. harness
  3. assertion
  4. expression
Question 9 Multiple Choice (Single Answer)

EBNF is ...

  1. Extensible Book Notation Format
  2. a replacement for the SAX XML parser
  3. the leader of the free software foundation
  4. a syntax for defining grammar
Question 10 Multiple Choice (Single Answer)
Dim strQuestion,strCount
strQuestion=" abc " 
strQuestion=Trim(strQuestion) 
strCount=Len(strQuestion)
  1. strCount=7
  2. strCount=9
  3. strCount=3
  4. strCount=0
Question 11 Multiple Choice (Single Answer)

Dim strOne strOne=String(3,"A") Msgbox strOne

  1. aaa
  2. A A A
  3. AAA
  4. A
Question 12 Multiple Choice (Single Answer)

Dim strOne strOne=InStrRev("abc","ABC") Msgbox strOne

  1. 1
  2. 3
  3. 0
  4. 6
Question 13 Multiple Choice (Single Answer)

Dim x x=InStrRev("abc abc","abc") x=????

  1. x=2
  2. x=3
  3. x=5
  4. x=0
Question 14 Multiple Choice (Single Answer)

Dim x x=InStr("abc abc","abc") Msgbox x

  1. 0
  2. 2
  3. 1
  4. 3
Question 15 Multiple Choice (Single Answer)
x="TIB Ltd"  
y=Len(x)
y=???
  1. 7
  2. 6
  3. 3
  4. 0
Question 16 Multiple Choice (Single Answer)

x=Right("abcd.xls",4) x=????

  1. .xls
  2. abcd
  3. excel
  4. true