1/14
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
For any custom class that dynamically allocates memory, what member functions must be supplied?
a) Copy constructor, constructor, destructor
b) Constructor, destructor, operator==
c) Assignment operator, Copy constructor, destructor
d) Copy constructor, destructor
c) Assignment operator, Copy constructor, destructor
If you do not define a destructor function for your custom class:
a) You will get a warning when you compile your program
b) The C++ compiler defines a default destructor for you
c) All of these
d) Your class may leave memory leaks from strings and vectors used as data members
b) The C++ compiler defines a default destructor for you
What can be said about the following statement?
"The scope of a variable is limited to the clause in which it appears."
a) the statement is theoretically true, but the implementation of prolog does not enforce this concept.
b) the statement is false - prolog variables do not have "scope" in the traditional computer language sense.
c) that is false. Prolog makes use of global variables so the clauses can pass information to each other
d) that statement is true.
d) that statement is true.
Prolog and other logic languages are based on...
a) boolean binary
b) predicate calculus
c) logistical nightmares
d) formal logic
b) predicate calculus
What can be said about the following prolog statement:
grandparent(G, C) :- parent(G,P), parent(P, C).
a) it is a rule
b) it is a fact
c) it is a query
d) it is a goal
a) it is a rule
What can be said about this prolog statement:
parent(steve, landon).
a) it is hard to raise kids these days
b) it is a fact
c) it is a goal
d) it is a rule
b) it is a fact
What term is used to describe how the prolog interpreter works in order to prove a goal?
a) depth-first recursion
b) backward chaining
c) random tagging
d) forward linking
b) backward chaining
The body of a Horn Clause...
a) is a list of terms.
b) is not transmittable
c) is a single term.
d) The correct answer is not shown.
a) is a list of terms.
Is this function tail recursive?
int fibo(int n, int n1=1, int n2=1)
{
if (n == 0) return n2;
if (n == 1) return n1 + n2;
return fibo(n-1, n2, n1+n2);
}
a) True
b) False
a) True
The head of a Horn Clause...
a) The correct answer is not listed.
b) is a list of terms
c) is inverted when called
d) is a single term
d) is a single term
Is this function tail recursive?
int fibo(int n, int n1=1, int n2=1)
{
if (n == 0) return n2;
if (n == 1) return n1 + n2;
int result = fibo(n-1, n2, n1+n2);
return result
}
a) True
b) False
b) False
What is true about Horn Clauses?
a) They have a head and a body
b) It's Santa Clauses brother
c) They are hard to implement
d) They are tail-recursive
a) They have a head and a body
*Does not remember entirely* Every C++ program must have a header file.
a) True
b) False
a) True?
*Does not remember entirely*
This code runs properly:
#include
int main() {
cout << "Hello World!";
return 0;
}
a) True
b) False
a) False?
Needs "using namespace std;" after the "#include ___" part since you're not using std::cout << "Hello World!";
*Does not remember entirely*
This code runs properly:
#include
int main() {
std::cout << "Hello World!";
return 0;
}
a) True
b) False
b) False?
Ran in onlinegdb and gave error message