Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which one of the following describes the syntax of prolog program ?

I. Rules and facts are terminated by full stop (.)
II. Rules and facts are terminated by semicolon (;)
III. Variables names must start with upper case alphabets.
IV. Variables names must start with lower case alphabets.
Codes :

  • A.I, II
  • B.III, IV
  • C.I, III
  • D.II, IV

Answer: C

Statements I and III describe Prolog syntax.

A Prolog fact or rule ends with a full stop, and variable names begin with an upper case letter or an underscore, while atoms start with lower case.

A semicolon in Prolog means 'or' in the body of a rule and does not end a clause, and variables do not start with lower case letters. Rules such as grandparent(X, Z) :- parent(X, Y), parent(Y, Z). and facts such as parent(a, b). show the convention: a clause ends with a full stop and the variables X, Y and Z start with capital letters, while a, b and parent are atoms.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.