Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

CSE 240 CORE EXAM 2026 SET QUESTIONS AND SOLUTIONS RATED

Beoordeling
-
Verkocht
-
Pagina's
13
Cijfer
A+
Geüpload op
06-04-2026
Geschreven in
2025/2026

CSE 240 CORE EXAM 2026 SET QUESTIONS AND SOLUTIONS RATED

Instelling
CSE 240
Vak
CSE 240

Voorbeeld van de inhoud

CSE 240 CORE EXAM 2026 SET QUESTIONS AND
SOLUTIONS RATED A+
✔✔What is wrong with this piece of Prolog code?
ancestor(A, D) :- ancestor (A, P), ancestor(P, D). - ✔✔It does not have a stopping
condition.

✔✔Explain how the following rules check if there is a miscolor in a map factbase.
adjacent(X, Y) :- edge(X, Y); edge(Y, X).miscolor(S1, S2, Color1) :- adjacent(S1, S2),
color(S1, Color1),color(S2, Color1). - ✔✔Prolog runtime will iteratively apply the rules to
all the facts to find the matches and mismatches.

✔✔Assume that the rule factorial(N, Fac) will compute Fac = N!. What should be the
output if the following question is asked?
?- factorial(2, 5). - ✔✔no

✔✔If we try to use tail-recursive rules to implement non-tail-recursive rules, it will
normally result in rules that are - ✔✔more complex and more difficult to understand.

✔✔Assume that the rule factorial(N, Fac) will compute Fac = N!. What should be the
output if the following question is asked?
?- factorial(N, 2). - ✔✔instantiation_error

✔✔Given a Prolog pair [H | T], which of the following statements are correct? Select all
correct answers.
- [H | T] is always a list, regardless whether H or T is a list.
- If H is not a list, then [H | T] is not list.
- If T is not a list, then [H | T] is not list.
- If T is a list, then [H | T] is list. - ✔✔- If T is not a list, then [H | T] is not list.
- If T is a list, then [H | T] is list.

✔✔What goal will return a "no" answer?
- member(pig, [cat | [dog | pig]]).
- member(dog, [cat | [dog | pig]]).
- None of them
- All of them
- member(cat, [cat | [dog | pig]]). - ✔✔member(pig, [cat | [dog | pig]]).

✔✔Which of the followings is equivalent to this Prolog list: [cat | [dog, pig]] ? - ✔✔[cat,
dog, pig]

✔✔the following rules will trigger a singleton variable warning. How di you fix the
problem?

, count([], 0) :- !.
count([X | Tail], S) :- count(Tail, S2), S is 1+S2. - ✔✔change X to _

✔✔which sorting algorithm has the best average execution time? - ✔✔quick sort

✔✔which sorting algorithm has the best execution time in the worst case scenario? -
✔✔merge sort

✔✔given the following set of the recursive rules, what clause represents the size-(N-1)
problem?

bar([],[]).
bar([X | L], F) :- bar(L, G), append(G, [X], F). - ✔✔bar(L, G)

✔✔what does the following set of the recursive rule do?

bar([],[]).
bar([X | L], F) :- bar(L, G), append(G, [X], F). - ✔✔reverse a list

✔✔which of the following statement correctly defines the not(X) rule? - ✔✔not(X) :- X, !,
fail.
not(_).

✔✔what is true about the cut (!)? - ✔✔- cut (!) can be placed anywhere in a rule as a
condition, and the effects can be different
- cut(!) removes all existing backtracking points, but new backtracking points can be
added later

✔✔True or false? A cut interferes with a recursive process by removing the recursive
exit points - ✔✔false

✔✔the flow control clause repeat in Prolog performs the following operation: -
✔✔generate a new backtracking point

✔✔we can use a repeat clause to form a loop. what clause we typically use to return to
the repeat point? - ✔✔fail

✔✔what is static memory - ✔✔allocated memory during compilation before the program
executes; global and static variables and objects

✔✔What is stack memory? - ✔✔allocated for all non-static local variables and objects
and member functions i.e. variables within functions; deallocated when out of scope

Geschreven voor

Instelling
CSE 240
Vak
CSE 240

Documentinformatie

Geüpload op
6 april 2026
Aantal pagina's
13
Geschreven in
2025/2026
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$13.49
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
BOARDWALK Havard School
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
247
Lid sinds
1 jaar
Aantal volgers
7
Documenten
28032
Laatst verkocht
7 uur geleden
BOARDWALK ACADEMY

Ace Your Exams With Top Quality study Notes And Paper✅✅ ALL ACADEMIC MATERIALS AVAILABLE WITH US✅✅ LEAVE A REVIEW SO THAT WE CAN LOOK AND IMPROVE OUR MATERIALS.✅✅ WE ARE ALWAYS ONLINE AND AVAILABLE DONT HESITATE TO CONTACT US FOR SYUDY GUIDES!!✅✅ EVERYTHING IS GRADED A+✅✅ COLOUR YOUR GRADES WITH US , WE ARE HERE TO HELP YOU DONT BE RELACTANT TO REACH US

3.5

36 beoordelingen

5
14
4
6
3
8
2
1
1
7

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen