Open In App

GATE | GATE-CS-2005 | Question 3

Like Article
Like
Save
Share
Report

A common property of logic programming languages and functional languages is:

(A)

both are procedural languages

(B)

both are based on λ-calculus

(C)

both are declarative

(D)

both use Horn-clauses



Answer: (C)

Explanation:

Explanation: 

The correct answer is (C) both are declarative.

Both logic programming languages and functional languages share the characteristic of being declarative languages. Declarative programming focuses on specifying what needs to be done rather than how to do it. In both logic programming and functional programming, the programmer describes the desired result or the properties of the solution without explicitly defining the steps or the order of execution.

In logic programming languages, such as Prolog, programs are built on a set of logical rules and facts. The programmer defines relationships between entities and the logic engine determines the appropriate answers by performing logical inference.

Functional programming languages, on the other hand, are based on the concept of functions as first-class entities. Programs are constructed by composing functions and applying them to data. Functional languages emphasize immutability and avoid side effects, allowing for a more declarative and concise programming style.

While options (A) and (B) are not true for both logic programming and functional programming languages, option (D) is partially correct. Logic programming languages, such as Prolog, commonly use Horn clauses as a way to express logical rules. However, not all functional languages use Horn clauses. Therefore, the most accurate answer is (C) both are declarative.

Quiz of this Question


Quiz of this Question
Please comment below if you find anything wrong in the above post


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads