adplus-dvertising
frame-decoration

Question

Which one of the following prolog programs correctly implement “if G succeeds then execute goal P else execute goal q ?”

a.

if-else (G, P, q) :- !, call(G), call(P). if-else (G, P, q) :- call(q).

b.

if-else (G, P, q) :- call(G), !, call(P). if-else (G, P, q) :- call(q).

c.

if-else (G, P, q) :- call(G), call(P), !. if-else (G, P, q) :- call(q).

d.

All of the above

Answer: (b).if-else (G, P, q) :- call(G), !, call(P). if-else (G, P, q) :- call(q).

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which one of the following prolog programs correctly implement “if G succeeds then execute goal P else execute goal q ?”

Similar Questions

Discover Related MCQs

Q. The strategy used to reduce the number of tree branches and the number of static evaluations applied in case of a game tree is

Q. An example of a tautology is:

Q. The preposition (p→q) ˄ (~q˅p) is equivalent to:

Q. If the proposition 7P⇒Q is true, then the truth value of the proposition 7PV(P⇒Q) is:

Q. Which of the following checks cannot be carried out on the input data to a system ?

Q. A fact in prolog is a special case of a:

Q. Natural objects can be realistically modeled using:

Q. An agent can improve its performance by

Q. Which of the following is true for semi-dynamic environment?

Q. In Artificial Intelligence (AI), an environment is uncertain if it is ..............

Q. In Artificial Intelligence (AI), a simple reflex agent selects actions on the basis of ...................

Q. In heuristic search algorithms in Artificial Intelligence (AI), if a collection of admissible heuristics h1.......hm is available for a problem and none of them dominates any of the others, which should we choose?

Q. Consider following sentences regarding A*, an informed search strategy in Artificial Intelligence (AI).

(a) A* expands all nodes with f(n) < C*.
(b) A* expands no nodes with f(n) /C*.
(c) Pruning is integral to A*.

Here, C* is the cost of the optimal solution path.
Which of the following is correct with respect to the above statements?

Q. Consider a vocabulary with only four propositions A, B, C and D. How many models are there for the following sentence?

B V C

Q. Consider the following statements :

(a) False╞ True
(b) If α╞ (β ∧ γ) then α╞ β and α╞ γ.

Which of the following is correct with respect to the above statements?

Q. Consider the following English sentence:

“Agra and Gwalior are both in India”.

A student has written a logical sentence for the above English sentence in First-Order Logic using predicate In(x, y), which means x is in y, as follows:

In(Agra, India) V In(Gwalior, India)

Which one of the following is correct with respect to the above logical sentence?

Q. Consider the following two sentences:

(a) The planning graph data structure can be used to give a better heuristic for a planning problem.
(b) Dropping negative effects from every action schema in a planning problem results in a relaxed problem.

Which of the following is correct with respect to the above sentences?

Q. Consider the set of all possible five-card poker hands dealt fairly from a standard deck of fifty-two cards. How many atomic events are there in the joint probability distribution?

Q. In Artificial Intelligence (AI), which agent deals with happy and unhappy state?

Q. If b is the branching factor and m is the maximum depth of the search tree, what is the space complexity of greedy search?