A) 0
B) 1
C) 2
D) nothing, factorial(0) causes infinite recursion
E) nothing, factorial(0) produces a run-time error
Correct Answer
verified
Multiple Choice
A) public void logcode(int n) {
If (n > 1) logcode(n - 1) ;
}
B) public void logcode(int n) {
If (n > 2) logcode(n - 2) ;
}
C) public void logcode(int n) {
If (n > 0) logcode(0) ;
}
D) public void logcode(int n) {
If (n > 1) logcode(n / 2) ;
}
E) public void logcode(int n) {
If (n > 1) logcode(n - 1 /2) ;
}
Correct Answer
verified
Multiple Choice
A) the length of String a
B) the length of String a concatenated with char b
C) the number of times char b appears in String a
D) returns 1 if char b appears in String a at least once, and 0 otherwise
E) the char which appears at location i in String a
Correct Answer
verified
Multiple Choice
A) "abcba"
B) "aaabbb"
C) "abcde"
D) "aabba"
E) all of the above Strings will result in the method returning True
Correct Answer
verified
Multiple Choice
A) if (x = = 0) return True;else if (x < 0) return false;else return question3(x - 1) ;
B) if (x = = 0) return false;else if (x < 0) return True;else return question3(x - 1) ;
C) if (x = = 0) return True;else if (x < 0) return false;else return question3(x - 2) ;
D) if (x = = 0) return false;else if (x < 0) return True;else return question3(x - 2) ;
E) return(x = = 0) ;
Correct Answer
verified
Essay
Correct Answer
verified
View Answer
Multiple Choice
A) True
B) false
C) a NullPointerException
D) a run-time error
E) infinite recursion
Correct Answer
verified
Essay
Correct Answer
verified
View Answer
Essay
Correct Answer
verified
View Answer
True/False
Correct Answer
verified
Essay
Correct Answer
verified
View Answer
True/False
Correct Answer
verified
True/False
Correct Answer
verified
Essay
Correct Answer
verified
View Answer
Multiple Choice
A) a triangle
B) a square
C) a point
D) a circle
E) none of the above
Correct Answer
verified
Essay
Correct Answer
verified
View Answer
Essay
Correct Answer
verified
View Answer
Multiple Choice
A) (x = = y)
B) (x != y)
C) (x > y)
D) (x < y)
E) (x = = 0 && y != 0)
Correct Answer
verified
Multiple Choice
A) direct recursion occurs when a method invokes itself; indirect recursion occurs when there is an intervening method
B) indirect recursion occurs when a method invokes itself; direct recursion occurs when there is an intervening method
C) direct recursion only occurs with methods declared to be private; indirect recursion can occur with methods declared to be private, protected, or public
D) indirect recursion only occurs with methods declared to be private; direct recursion can occur with methods declared to be private, protected, or public
E) none of the above
Correct Answer
verified
Essay
Correct Answer
verified
View Answer
Showing 21 - 40 of 68
Related Exams