Yes! If properly employed, that is, until no swap occurred in the last pass of traverse_once., Yes, but only if case traverse_once is called n times (where n is the length of the input)., No! A bubble sort using it might enter an infinite loop in case duplicates exist in the input., No! It (traverse_once) fails as it never reaches the empty list., , No! It (traverse_once) fails as it never reaches the empty list., No! A bubble sort using it might enter an infinite loop in case duplicates exist in the input., Yes! If properly employed, that is, until no swap occurred in the latest traverse_once., No! It (traverse_once) fails as fact should come as first clause., , The code is correct as it is., To be correct, the order of the recursive calls must be swapped., The code is correct as it is if and only if the initial call sets the last argument to the empty list., To be correct, the pattern [Key|Int] should go to the first recursive call., , The code is correct as it is., To be correct, in the first clause arguments 2 and 3 should share the same variable., To be correct, the order of the recursive calls must be swapped., The code is correct as it is if and only if the initial call sets the last argument to the empty list., , Yes! If properly employed, that is, until no swap occurred in the latest traverse_once., No! It (traverse_once) fails as fact should come as first clause., No! A bubble sort using it might enter an infinite loop in case duplicates exist in the input., No! It (traverse_once) fails as it never reaches the empty list., , The predicate is incorrect. The last clause should contain a disjunction., The predicate is incorrect: clauses 1 and 2 should be in opposite order., The predicate is incorrect as the first clause should be with !,var(T),fail. in the body., The predicate is incorrect as it is never comparing keys., , The predicate is correct., The predicate is incorrect. The first clause must be the last one., The predicate is incorrect. The second clause must be the first one., The predicate is incorrect as it is missing the condition Key1<Key,!, in the 4th clause., , The predicate is incorrect, as the fact should be the second clause (search in inorder)., The predicate is incorrect. The last clause should be the first one., The predicate is incorrect as it is missing the condition Key1<Key,!, in the 3rd clause., The predicate is incorrect as the last clause should be with !,var(T),fail. in the body., , No! A bubble sort using it might enter an infinite loop in case duplicates exist in the input., No! It (traverse_once) fails as it never reaches the empty list., No! It (traverse_once) fails as fact should come as first clause., Yes! If properly employed, that is, until no swap occurred in the latest traverse_once., , The predicate is incorrect, as the fact should be the second clause (search in inorder)., The predicate is incorrect as it is missing the condition Key1<Key,!, in the 3rd clause., The predicate is correct., The predicate is incorrect. It acts as an insert when the Key is not in the tree., , member(H,[H|_]). member(H,[_|T]):-member(H,T)., member(H,[H|_]):-!. member(H,[_|T]):- member(H,T)., member(H,[H|_]). member(H,[_|T]):- !, member(H,T)., member(_,[]). member(H,[H|_]). member(H,[_|T]):- member(H,T)., , The predicate is incorrect because the pattern of adding the Key in the third clause (from the right list (R)) [Key|Int] must occur in the other recursive call (on the left list (L), as [Key|Int])., The predicate is incorrect because the pattern of adding the Key in the third clause (from the right list (R)) [Key|Int] must occur in the head of the rule in the 3rd argument (as [Key|ERes])., The predicate is incorrect because the pattern of adding the Key in the third clause (from the right list (R)) [Key|Int] must occur in the head of the rule in the 2nd argument (as [Key|BRes])., The predicate is incorrect as in the 3rd clause the recursive calls are swapped., , The predicate is incorrect because the pattern of adding the Key in the second clause (on the left list (L)) [Key|E] must occur in the head of the rule., The predicate is incorrect, as is missing a first clause on var(T)., The predicate is incorrect as in the 4th clause the recursive calls are swapped., The predicate is incorrect because the pattern of adding the Key in the third clause (on the right list (R)) [Key|B] must occur in the head of the rule., , Remove the cut (!) in the first clause., Remove the cut (!) in the second clause., Change the order of clauses 1 and 2., Remove the first clause., , The sequence is correct as the input graph is entirely scanned for all possible pairs and appropriate verifications in the input and complement graph are performed., The sequence is incorrect, as it contains the ! after not(is_edge(X,Y))., The sequence is correct as the input graph is entirely scanned for all possible pairs and appropriate verifications in the input graph are performed., The sequence is incorrect, as it is missing a ! after not(is_edge_complement(X,Y))., , The sequence is correct as the input graph is entirely scanned for all possible pairs and appropriate verifications in the input graph are performed., The sequence is correct as the input graph is entirely scanned for all possible pairs and appropriate verifications in the input and complement graph are performed., The sequence is incorrect, as it is missing a verification for the presence of the (X,Y) edge in the initial graph., The sequence is incorrect, as it is missing a ! after not(is_edge_complement(X,Y))., , Y=[4,3,2,1], No answer. Execution enters infinite loop., Y=[], Y=[1,2,3,4], , The predicate is incorrect as in the 4th clause the recursive calls are swapped., The predicate is incorrect as clauses 2 and 3 should occur in the opposite order., The predicate is incorrect because the pattern of adding the leaf key is incorrect., The predicate is incorrect, as is missing a first clause on var(T)., , Nothing, it is already non-deterministic., Change the order of clauses 2 and 3., Remove the cut (!) in the first clause., Remove the cut (!) in the last clause., , Remove the cut (!) in the first clause., Change the order of clauses 2 and 3., Remove the cut (!) in the last clause., Remove the last clause., , The sequence is incorrect, as it is missing a ! after not(is_edge(X,Y))., The sequence is correct as the input graph is entirely scanned for all possible pairs and appropriate verifications in the input graph are performed., The sequence is incorrect, as it contains the ! after not(is_edge_complement(X,Y))., The sequence is correct as the input graph is entirely scanned for all possible pairs and appropriate verifications in the input and complement graph are performed., , Remove the second clause., The predicate is nondeterministic as it is., Change the order of clauses 1 and 3., Remove the cut (!) in the second clause., , The predicate is incorrect, as is missing a first clause on var(T)., The predicate is incorrect as in the 4th clause the recursive calls are swapped., The predicate is incorrect because the pattern of adding the Key in the second clause (on the left list (L)) [Key|E] must occur in the recursive call., The predicate is incorrect because the pattern of adding the Key in the third clause (on the right list (R)) [Key|B] must occur in the recursive call., , a. The sequence is incorrect, as it should contain a ! after not (0 is D mod 2)., b. The sequence is correct, as it checks, for each vertex, that it has an even degree., c. The sequence is correct, but it computes the degree of a node several times (for each edge it appears in)., d. The sequence is incorrect, as it needs a recursive call instead of a fail in the first clause., , a. The sequence is incorrect, as it is missing a ! after not(is_edge_complement(X,Y))., b. The sequence is correct as the input graph is entirely scanned for all possible pairs and appropriate verifications in the input and complement graph are performed., c. The sequence is correct as the input graph is entirely scanned for all possible pairs and appropriate verifications in the input graph are performed., d. The sequence is incorrect, as it contains the ! after not(is_edge(X,Y))., , a. The sequence is incorrect as the second clause in given_weight has a different argument than the first clause., b. The sequence is incorrect because the ! after is_edge(X,_,W) prevents the backtracking mechanism to scan the entire graph., c. The sequence is incorrect because there is no fail to install the backtracking mechanism., d. The sequence is correct as the entire graph is scanned and for each edge the weight is compared with the given weight., , a. The sequence is incorrect because the ! after Neighbor1 \= Neighbor2 prevents the backtracking mechanism to scan all the neighbours of vertex Node., b. The sequence is correct as the entire graph is scanned and for each vertex all edges are compared., c. The sequence is incorrect because it is missing a ! after not(checked(X,_))., d. The sequence is incorrect because it is missing a ! after not(verify(X))., , a. The sequence is incorrect because the recursive call at the end of the first clause should be replaced by fail., b. The sequence is incorrect because the recursive call at the end of the first clause., c. The sequence is correct as it scans the graph until the condition is met., d. The sequence is incorrect because of the ! after Y \= Z., , a. The sequence is incorrect because no recursive call is needed., b. The sequence is incorrect because there should be a fail instead of the recursive call., c. The sequence is incorrect because the ! after is_edge(X,_,W) prevents the backtracking mechanism to scan the entire graph., d. The sequence is incorrect as the second clause in given_weight has a different argument than the first clause., , a. The sequence is correct as it is, as the entire G1 is scanned., b. The sequence is incorrect, as it contains the ! after not(is_edge_2(X,Y))., c. The sequence is incorrect, as it needs a recursive call instead of fail., d. The sequence is correct as both G1 and G2 are entirely scanned once., , a. The sequence is incorrect, as it needs a recursive call instead of fail., b. The sequence is incorrect, as it is missing a ! after not(is_edge_2(X,Y))., c. The sequence is correct as both G1 and G2 are entirely scanned., d. The sequence is incorrect, as it parses the same edge in G1 multiple times. It must have a not(is_edge_diff(X,Y)) before assertz(edge_diff(X,Y))., , a. The sequence is incorrect, as it needs a recursive call instead of fail., b. The sequence is incorrect, as it is missing a ! after not(is_edge_2(X,Y))., c. The sequence is correct as both G1 and G2 are entirely scanned., d. The sequence is incorrect, as it parses the same edge in G1 multiple times. It must have a not(is_edge_diff(X,Y)) before assertz(edge_diff(X,Y))., , a. The sequence is correct as the input graph is entirely scanned for all possible pairs and appropriate verifications in the input and complement graph are performed., b. The sequence is correct as the input graph is entirely scanned for all possible pairs and appropriate verifications in the input graph are performed., c. The sequence is incorrect, as it contains the ! after not(is_edge(X,Y))., d. The sequence is incorrect, as it is missing a ! after not(is_edge_complement(X,Y))., , a. The sequence is correct as the entire graph is scanned., b. The sequence is incorrect as not the entire graph is scanned., c. The sequence is correct as it scans the graph until the condition is met., d. The sequence is incorrect because of the ! after Y \= Z., , a. The sequence is incorrect because the ! after is_edge(X,_,W) prevents the backtracking mechanism to scan the entire graph., b. The sequence is incorrect as the second clause in given_weight has a different argument than the first clause., c. The sequence is incorrect because there is no fail to install the backtracking mechanism., d. The sequence is correct as the entire graph is scanned and for each edge the weight is compared with the given weight., , a. The sequence is incorrect because the ! after is_edge(X,_,W) prevents the backtracking mechanism to scan the entire graph., b. The sequence is correct as the entire graph is scanned and for each edge the weight is compared with the given weight., c. The sequence is incorrect because the recursive call with the same arguments leads to an infinite loop. We should put other arguments in the recursive call., d. The sequence is incorrect because of the recursive call; we should have had a fail instead., , a. The sequence is incorrect, as it should contain a ! after not (0 is D mod 2)., b. The sequence is incorrect, as it needs a recursive call instead of a fail in the first clause., c. The sequence is correct, but it computes the degree of a node several times (for each edge it appears in)., d. The sequence is correct, as it checks, for each vertex, that it has an even degree., , a. The sequence is correct as the entire graph is scanned and for each vertex all edges are compared., b. The sequence is incorrect because it is missing a ! after not(verify(X))., c. The sequence is incorrect because it is missing a ! after not(checked(X,_))., d. The sequence is incorrect because the ! after Neighbor1 \= Neighbor2 prevents the backtracking mechanism to scan all the neighbours of vertex Node., , a. The sequence is correct, as it checks, for each vertex, that its in-degree is equal to its out-degree., b. The sequence is incorrect, as compute_out_degree(X,D) should be negated (i.e., not(compute_out_degree(X,D)),...)., c. The sequence is incorrect, as compute_out_degree(X,D) should be negated and contain a ! after it (i.e., not(compute_out_degree(X,D),!,...)., d. The sequence is correct, but it computes the degrees of a node several times (for each edge it appears in)., , a. The sequence is incorrect because no recursive call is needed., c. The sequence is incorrect because there should be a fail instead of the recursive call., b. The sequence is incorrect because the ! after is_edge(X,_,W) prevents the backtracking mechanism to scan the entire graph., d. The sequence is incorrect as the second clause in given_weight has a different argument than the first clause., , a. The sequence is correct as the entire graph is scanned and for each vertex all edges are compared., b. The sequence is incorrect because it is missing a ! after not(verify(X))., c. The sequence is incorrect because it is missing a ! after not(checked(X,_))., d. The sequence is incorrect because the ! after Neighbor1 \= Neighbor2 prevents the backtracking mechanism to scan all the neighbours of vertex Node., , a. The sequence is incorrect because the ! after Neighbor1 \= Neighbor2 prevents the backtracking mechanism to scan all the neighbours of vertex Node., b. The sequence is correct as the entire graph is scanned and for each vertex all edges are compared., c. The sequence is incorrect because it is missing a ! after not(checked(X,_))., d. The sequence is incorrect because it is missing a ! after not(verify(X))., , a. The sequence is incorrect as the second clause in given_weight has a different argument than the first clause., b. The sequence is incorrect because the ! after is_edge(X,_,W) prevents the backtracking mechanism to scan the entire graph., c. The sequence is incorrect because there is no fail to install the backtracking mechanism., d. The sequence is correct as the entire graph is scanned and for each edge the weight is compared with the given weight., , a. The sequence is incorrect because the ! after is_edge(X,_,W) prevents the backtracking mechanism to scan the entire graph., b. The sequence is incorrect as the second clause in given_weight has a different argument than the first clause., c. The sequence is incorrect because there should be a fail instead of the recursive call., d. The sequence is incorrect because no recursive call is needed., , a. The sequence is incorrect, as it is missing a ! after not(is_edge_complement(X,Y))., b. The sequence is correct as the input graph is entirely scanned for all possible pairs and appropriate verifications in the input and complement graph are performed., c. The sequence is correct as the input graph is entirely scanned for all possible pairs and appropriate verifications in the input graph are performed., d. The sequence is incorrect, as it contains the ! after not(is_edge(X,Y))., , a. The sequence is incorrect, as it should contain a ! after not (0 is D mod 2)., b. The sequence is correct, as it checks, for each vertex, that it has an even degree., c. The sequence is correct, but it computes the degree of a node several times (for each edge it appears in)., d. The sequence is incorrect, as it needs a recursive call instead of a fail in the first clause., , a. The predicate is incorrect as it does not check the height on nil., b. The predicate is incorrect because the height is incorrectly calculated., c. The predicate is incorrect as it should add the Key in the root just in the second clause of build_list., d. The predicate is incorrect as it adds the keys regardless their height., , a. The sequence is incorrect, because the r/4 predicate replaces all occurrences, deterministically ., b. The sequence is correct as replace_duplicates/3 has a non-deterministic behavior., c. The sequence is incorrect, as the [El|R] pattern should be in the head of the first clause of predicate replace_duplicates/3, not the second., d. The sequence is correct as it is, because it replaces all the other occurrences when encountering a duplicate., , a. The sequence is correct as replace_singletons/4 has a non-deterministic behavior., b. The sequence is incorrect, as the [H|R] pattern should be in the head of the second clause of replace_singletons/4, not the first (i.e. should be swapped with [El|R])., c. The sequence is incorrect, because the checks m(H,T) and m(H,Acc) in predicate replace_singletons/4 should be made alternatively, not simultaneously (i.e. with an OR, not an AND between them)., d. The sequence is correct as it is, because it checks the current element both against the remaining elements and the elements which have been traversed already., , a. The sequence is correct as replace_singletons/4 has a non-deterministic behavior., b. The sequence is incorrect, as the [H|R] pattern should be in the head of the second clause of replace_singletons/4, not the first (i.e. should be swapped with [El|R])., c. The sequence is incorrect, because the checks m(H,T) and m(H,Acc) in predicate replace_singletons/4 should be made alternatively, not simultaneously (i.e. with an OR, not an AND between them)., d. The sequence is correct as it is, because it checks the current element both against the remaining elements and the elements which have been traversed already., , a. The predicate is correct as it is as it adds the keys at the specified level and concatenates them orderly., b. The predicate is incorrect as it does not check the level on nil., c. The predicate is incorrect as it ignores the key from the root in the third clause., d. The predicate is incorrect as it ignores the left and right subtrees in the second clause., , a. The predicate is incorrect as it ignores the left and right subtrees in the second clause., b. The predicate is correct as it is as it adds the keys at the specified level and concatenates them orderly., c. The predicate is incorrect as it ignores the key from the root in the third clause., d. The predicate is incorrect as it does not check the level on nil., , a. The sequence is incorrect, as the [El|R] pattern should be in the head of the first clause of predicate replace_duplicates/3, not the second., b. The sequence is incorrect, because the r/4 predicate replaces all occurrences, deterministically ., c. The sequence is correct as replace_duplicates/3 has a non-deterministic behavior., d. The sequence is correct as it is, because it replaces all the other occurrences when encountering a duplicate., , a. The sequence is incorrect, as it returns the input list; in clause 2 of sort_decreasing/2, the output unifies with the input., b. The sequence is correct, ordering decreasingly any input list, regardless the presence of duplicates., c. The sequence is correct, ordering decreasingly an input list, provided it contains no duplicates., d. The sequence is incorrect, as because of the ! after the inequality, the non-determinism cannot apply., , a. The sequence is incorrect, as it returns the input list; in clause 2 of sort_decreasing/2, the output unifies with the input., b. The sequence is correct, ordering decreasingly any input list, regardless the presence of duplicates., c. The sequence is correct, ordering decreasingly an input list, provided it contains no duplicates., d. The sequence is incorrect, as because of the ! after the inequality, the non-determinism cannot apply., , a. The sequence is incorrect, as the d/3 predicate has an incorrect, non-deterministic behavior., b. The sequence is incorrect, as the last clause of count_singletons/2 must be put as the first clause., c. The sequence is correct as it has a deterministic behavior for counting., d. The sequence is correct as it is, because it deletes all occurrences of a duplicate., , a. The sequence is correct as it is, because it deletes all occurrences of a duplicate., b. The sequence is incorrect, as it has a non-deterministic behavior for counting (i.e. a ! has to be placed in the first clause of count_singletons/2, after the call m(H,T))., c. The sequence is incorrect, as the last clause of count_singletons/2 must be put as the first clause., d. The sequence is correct, as it increases the counter on the second clause of count_singletons/2., , a. The sequence is correct as it is, because it deletes all occurrences of a duplicate., b. The sequence is incorrect, as it has a non-deterministic behavior for counting (i.e. a ! has to be placed in the first clause of count_singletons/2, after the call m(H,T))., c. The sequence is incorrect, as the last clause of count_singletons/2 must be put as the first clause., d. The sequence is correct, as it increases the counter on the second clause of count_singletons/2., , a. The predicate is correct as it is as it adds the keys at the specified level and concatenates them orderly., b. The predicate is incorrect as it ignores the left and right subtrees in the second clause., c. The predicate is incorrect as it adds the key from the root in the third clause., d. The predicate is incorrect as it does not check the level on the final variable., , a. The sequence is correct, ordering decreasingly any input list, regardless the presence of duplicates., b. The sequence is correct, ordering decreasingly an input list, provided it contains no duplicates., c. The sequence is incorrect, as because of the ! after the inequality, the non-determinism cannot apply., d. The sequence is incorrect, as it returns the input list; in clause 2 of sort_decreasing/2, the output unifies with the input., , a. The predicate is incorrect as it does not check the level on the final variable., b. The predicate is incorrect as it ignores the left and right subtrees in the second clause., c. The predicate is correct as it is as it adds the keys at the specified level and concatenates them orderly., d. The predicate is incorrect as it ignores the key from the root in the third clause., , a. traverse the given list, to reach the variable at the end, then instantiate that variable accordingly, b. traverse the given list, instantiate an additional result variable accordingly when reaching the end of the list, then copy all the input list elements in the result, as recursion returns, to maintain their order., c. directly instantiate the variable at the end of the given list, accordingly (no traversal needed), d. traverse the given list, and add the elements of the input list, one by one, in an additional result argument, as recursion proceeds, making sure to add the element at the end of the result list (when recursion ends), , a. the predicate is incorrect, as the inequality check should consider other keys, b. the predicate is incorrect, as the inequality check should be reversed, c. the predicate is incorrect as there is no failure clause, d. the predicate is correct, , a. at least 2 elements, b. exactly 2 elements, c. exactly 3 elements, d. at least 3 elements, , , , , , , a. have explicit failure condition(s) in the beginning immediately followed by success condition(s), b. have explicit success condition(s) in the beginning immediately followed by explicit failure condition(s), c. have explicit failure condition(s) and success condition(s), d. have explicit failure condition(s) or success condition(s), , a. traverse the given list, and add the elements of the input list, one by one, in an additional result argument, as recursion proceeds, making sure to add the element at the end of the result list (when recursion ends), b. traverse the given list, to reach the variable at the end, then instantiate that variable accordingly, c. directly instantiate the variable at the end of the given list, accordingly (no traversal needed), d. traverse the given list, instantiate an additional result variable accordingly when reaching the end of the list, then copy all the input list elements in the result, as recursion returns, to maintain their order, , a. its leftmost sibling node after the cut is executed, b. Its parent node after the cut is executed, c. A sibling node to its left before the cut is executed, d. The subtree of its leftmost sibling node after the cut is executed, , a. the predicate is incorrect as there is no failure clause, b. the predicate is correct, c. the predicate is incorrect, as the inequality must be checked before the recursive calls, d. the predicate is incorrect, as the inequality check should consider other keys, , a. at least 2 elements, b. exactly 2 elements, c. exactly 1 element, d. at least 1 element, , a. Its leftmost sibling node after the cut is executed, b. The subtree of its leftmost sibling node after the cut is executed, c. A subtree of its sibling node to its left before the cut is executed, d. Its parent node after the cut is executed, , a. The predicate is incorrect, as the fact should be the second clause (search in inorder)., b. The predicate is incorrect as it is missing the condition Key1<Key, ! , in the 3rd clause., c. The predicate is correct., d. The predicate is incorrect. It acts as an insert when the Key is not in the tree., , a. add another clause with recursive calls on L and R with the added condition MaxL<K<MinR (where MaxL is the max in L and MinR is the min in R), b. add in the recursive clause the condition KL<K<KR (where KL is the root key in L and KR is the root key in R), c. there is no way to make an update to have the condition checked. We need another predicate which calls min_max, d. add in the recursive clause the condition MaxL<K<MinR (where MaxL is the max in L and MinR is the min in R), , a. Its parent node, b. A sibling node to its left, c. The subtree of a sibling node to its left, d. Subtrees of subgoals to its right, , , , , .
0%
Ardelean
Share
Share
Share
by
Mateibirlea1
Edit Content
Print
Embed
More
Assignments
Leaderboard
Show more
Show less
This leaderboard is currently private. Click
Share
to make it public.
This leaderboard has been disabled by the resource owner.
This leaderboard is disabled as your options are different to the resource owner.
Revert Options
Quiz
is an open-ended template. It does not generate scores for a leaderboard.
Log in required
Visual style
Fonts
Subscription required
Options
Switch template
Show all
More formats will appear as you play the activity.
Open results
Copy link
QR code
Delete
Continue editing:
?