Which of the following is false for the programming language PROLOG ?

2015

Which of the following is false for the programming language PROLOG ?

  1. A.

    A PROLOG variable can only be assigned to a value once

  2. B.

    PROLOG is a strongly typed language

  3. C.

    The scope of a variable in PROLOG is a single clause or rule

  4. D.

    The scope of a variable in PROLOG is a single query

Attempted by 359 students.

Show answer & explanation

Correct answer: B

Answer (the false statement): PROLOG is a strongly typed language

Explanation:

  • A PROLOG variable can only be assigned to a value once — True. Variables are single-assignment within a proof branch: they become bound by unification and that binding holds for the current branch; bindings are undone on backtracking.

  • PROLOG is a strongly typed language — False. Prolog does not use a static strong type system. Types (term shapes) are implicit and checked at runtime via unification rather than through compile-time type checking.

  • The scope of a variable in PROLOG is a single clause or rule — True. Variables are local to the clause or rule in which they appear and are not shared across different clauses.

  • The scope of a variable in PROLOG is a single query — True. Variables used in an interactive or program query are local to that query and do not persist across separate queries; this reinforces that bindings are not global.

Summary: The false statement is the claim that Prolog is strongly typed. Prolog uses dynamic, implicit typing with runtime unification, while variables are single-assignment and have scope limited to a clause/rule or to the current query.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Nta Ugc Net Paper 2

Loading lesson…