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 :
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.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development