Java 1 Final
What will the following code display? double[ ] myList = new double[5]; myList[0] = 1.9; myList[1] = 5; myList[2] = 4.2; myList[3] = 7.4; myList[4] = 235.98; System.out.println( myList[0] );
1.9
What will the following code display? public class switchMonth { public static void main( String[] args ) { int month = 8; switch (month) { case 1: System.out.println("January"); break; case 2: System.out.println("February"); break; case 3: System.out.println("March"); break; case 4: System.out.println("April"); break; case 5: System.out.println("May"); break; case 6: System.out.println("June"); break; case 7: System.out.println("July"); break; case 8: System.out.println("August"); break; case 9: System.out.println("September"); break; case 10: System.out.println("October"); break; case 11: System.out.println("November"); break; case 12: System.out.println("December"); break; default: System.out.println("Invalid month.");break; } } // End of main } // End of switchMonth
August
What is a good systematic method for developing a computer program?
Code then run it. Modify the code if necessary then run the program again, continuing until expected results are displayed.
What is an Integrated Development Environment (IDE), such as NetBeans or Eclipse?
It is software for using Java, from coding to compiling to running a program.
Given the following code, how will the output be displayed? JOptionPane.showMessageDialog( null, "Hello World!\nThis is Java!" );
It will be displayed in a dialog box on two separate lines.
Given the following code, how will the output be displayed? System.out.print( "Hello World!\nThis is Java!" );
It will be displayed on two separate lines.
RAM is memory that temporarily stores data and instructions, also called primary or main memory. RAM stands for which of the following?
Random Access Memory
Which of the following is not one of the three general types of computer languages?
Spoken languages.
What data type should be used to represent the following: "Bob"?
String
A Java program will not compile if you have an error caused by a violation of Java's syntax rules. What is this error called?
Syntax
What is the correct syntax for displaying the message, Hello World?
System.out.println( "Hello World" );
Which of the following data items are arranged from the smallest to the largest in the data hierarchy.
bits, characters, fields, records, files.
What data type should be used to represent the following value as numeric? 23.65
double
What will the following code display? public class relationalOperators { public static void main(String args[ ]) { int i = 11; int j = 20; if ( i > j ) { System.out.println( " i is greater than j" ); } if ( i <= j ) { System.out.println( " i is less than or equal to j " ); } } End of main } // End of relationalOperators
i is less than or equal to j
What will the following code display? for ( int i = 0; i < 1; i++ ) { System.out.print( "i is now " + i ); }
i is now 0