Computer Science : Recognizing Class Hierarchy

Study concepts, example questions & explanations for Computer Science

varsity tutors app store varsity tutors android store

Example Questions

Example Question #1 : Recognizing Class Hierarchy

Consider the history of the following popular programming languages:

PHP

Java

Objective-C

Python

Which of the following is the closest ancestor shared by ALL of these languages?

Possible Answers:

C

Ada

Ruby

Smalltalk

Lisp

Correct answer:

C

Explanation:

All of these languages are C-based languages.

  • Ruby was invented in 1995, the same year as PHP, so it could not have influenced earlier languages like Objective-C and Python.
  • Lisp did influence at least one language, Python, but it did not influence any others.
  • Ada directly influenced Java, and because it influenced C, it can be argued that it is an ancestor of these other languages; however, because of this, Ada is not the CLOSEST ancestor.
  • Smalltalk influenced Objective-C, but no other languages on this list.

A clue was the answer "Objective-C," which is a strict superset of C that adds Object Orientation.

Learning Tools by Varsity Tutors