Question 1
Errors can be syntax errors or logic errors (the code works, but not as intended).
Which of the following statements contains an error?
String lotteryFrontPair = lotteryNum.substring(0, 1);
String lotteryBackPair = lotteryNum.substring(2);
String userBackPair = userPick.substring(1, 2);
A) I only
B) II only
C) III only
D) I and II only
E) I, II, and III
Question 2
Errors can be syntax errors or logic errors (the code works, but not as intended).
Which of the following statements contains an error?
for(int n = 1; n <= lotNumLength; n++)
for(int n = 0; n <= lotNumLength; n++)
for(int n = 0; n < lotNumLength; n++)
A) I only
B) II only
C) III only
D) I and II only
E) I and III only
Question 3
Errors can be syntax errors or logic errors (the code works, but not as intended).
Which of the following statements contains an error?
else if( userBackPair.equals(lotteryBackPair) )
else if( !userFrontPair.equals(lotteryFrontPair) )
else if( userPick == lotteryNum )
A) I only
B) II only
C) III only
D) I and II only
E) II and III only
Question 4
Errors can be syntax errors or logic errors (the code works, but not as intended).
Which of the following statements contains an error?
int digit = (int) (Math.random() * 9);
lotteryNum += digit;
//System.out.println(lotteryNum);
A) I only
B) II only
C) III only
D) I and III only
E) II and III only
Question 5
Errors can be syntax errors or logic errors (the code works, but not as intended).
Which of the following statements contains an error?
if(userPick.equals(lotteryNum))
if(userFrontPair.equals(lotteryFrontPair))
if(userBackPair.compareTo(lotteryBackPair) < 0)
A) I only
B) II only
C) III only
D) I and II only
E) II and III only