This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 7. Analyze the following code and check one of the answers: (3 points) // Enter an integer String numString = JOptionPane.showInputDialog(null, "Enter a number:", "Exam Input", JOptionPane.QUESTION_MESSAGE); int number = Integer.parseInt(numString); if (number <= 0) System.out.println(number); A. System.out.println(number); must be placed inside braces; B. number entered from the input cannot be negative. C. The if statement is wrong, because it does not have the else clause; D. If number is zero, number is displayed; E. If number is positive, number is displayed. 8. Which of the following is the correct expression that evaluates to true if the number x is between 1 and 100 or the number is negative? (2 points) A. (1 > x > 100)  (x < 0) B. ((x < 100) && (x > 1))  (x < 0) C. 1 < x < 100 && x < 0 D. ((x < 100) && (x > 1)) && (x < 0)...
View
Full
Document
This note was uploaded on 02/15/2012 for the course COP 3502 taught by Professor Staff during the Spring '12 term at University of Florida.
 Spring '12
 Staff

Click to edit the document details