Consider the declaration: ABC123 course(); Identify the class (type) name referenced in this statement and not the variable or function name.

Difficulty: Easy

Correct Answer: ABC123

Explanation:


Introduction / Context:
Understanding basic declaration syntax helps avoid confusion between types (classes) and identifiers (variables/functions). In many C++/Java-like notations used in textbooks, a statement may either declare a variable of a class or, depending on the context, a function returning that class.



Given Data / Assumptions:

  • The token order is “ABC123 course();”.
  • “ABC123” precedes the identifier “course”.
  • Parentheses suggest a function-like syntax in C++ (a function returning ABC123) or a constructor-style call in pseudocode; in either case, the class/type token remains “ABC123”.


Concept / Approach:

In declarations, the first token typically denotes the type. Thus, “ABC123” is the class (type) name, while “course” is an identifier (variable or function name depending on language rules). The parentheses “()” are part of a function signature, not the class name.



Step-by-Step Solution:

Identify the leftmost token → “ABC123”.Map leftmost token to type/class in common declaration syntax.Confirm that “course” (or “course()”) is the identifier/signature, not the type.


Verification / Alternative check:

Compare to examples like Student enroll(); or Student s;—in both, “Student” is the class/type name.



Why Other Options Are Wrong:

“course” is an identifier, not a type.

“course()” is a function signature, not a class name.

“All of the above” cannot be correct because only one token is the class/type.



Common Pitfalls:

Confusing constructor-style calls with type names; treating parentheses as part of a name.



Final Answer:

ABC123

More Questions from Object-Oriented Database

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion