Professional Documents
Culture Documents
*** Write all answers directly on the test page. Use the back of the page if needed. ***
(1) Explain the difference between int and double.
(2) Explain what the term robust means, and outline why it is important for some software
to be robust, while it is not so important for other software.
(a) Circle the numbers below that will be accepted and returned by this method:
0 15 12.5 30 20 -5
(b) Write a similar method that would input an amount of money, and would
only accept amounts between 10.00 and 100.00, including 10.00 and 100.00
Write your answer on the back of this page.
Mid-Term Test on Java Programming (2 / 3)
int x = 30;
int y = 20;
int m = x / y;
Write your answers here
System.out.println("x" + "y");
System.out.println(x + y);
System.out.println( m );
while ( x > y )
{
System.out.println( y ) ;
y = y + 1;
}
(8) A user must choose a new password. The password is only accepted if it follows these rules:
(a) It must have at least 6 letters.
(b) The maximum length is 10 letters.
(c) The first letter and the last letter must be different from each other.
(d) CAPITAL LETTERS are not permitted.
Here are some examples:
Accept : orange elephant xxxyyy
Reject : oregano exceptional xxxxxxxx Berlin
(9) Decide whether each statement below is TRUE or false - circle your answer.
The command indexOf can be used to check whether a name contains the TRUE false
letter 'x' or not.
EasyApp is the standard system for creating Java GUI applications. TRUE false
The purpose of substring is to search for whether a word is found in a TRUE false
sentence.
DeMorgan's Law says that the opposite of ( x < 50 && x > 10) is TRUE false
( x <50 || x >10).