Java Programming CIS183
Which type of expression (i.e., result) is allowed between the parentheses of a switch statement (all that are valid)? any integer type any floating point type boolean Object
any integer type
Select from the following all of the syntactically correct Java primitive types that represent integers: byte short integer long float double character boolean
byte short long.
What is the value of the following expression if used in a Java program: 3 * 3 % 2 + 1 A) 2 B) 3 C) 4 D) 5.5
A) 2
In order to TEST a Java program you NEED to have ___. A) A Java "JRE" B) A Java "JDK" C) A Programmers Editor or IDE D) Any plain-text editor.
A) Java "JRE"
Which of the following is/are always required syntax for the switch structure (all that apply)? switch () parentheses boolean expression floating-point expression
switch () parentheses
What is the value of the following expression if used in a Java program: 3 * 3 / 2 + 1 A) 3 B) 4 C) 5 D) 5.5
C) 5
In order to COMPILE a Java program you NEED to have ___. A) A Java "JRE" B) Java "JDK" C) A Programmers Editor or IDE D) Any plain-text editor.
B) Java "JDK"
In order to WRITE a Java program (often referred to as "coding") you NEED to have (that is, "must" have) ___. A) A Java "JRE" B) AA Java "JDK" C)A Programmers Editor or IDE D)Any plain-text editor.
D)Any plain-text editor.
Which of the following must be performed in order for any loop structure to function properly (check all that apply): Begin with keyword "while". Inltialize the loop-control variable Change the loop-control variable on each iteration of the loop Test the loop-control variable on each iteration of the loop Update the loop-control variable after loop terminates
Inltialize the loop-control variable Change the loop-control variable on each iteration of the loop Test the loop-control variable on each iteration of the loop
Because of the JVM, a Java program that is compiled on one platform can be run on any other platform. True False
True
Earlier languages like C and C++ had to be re-written for each platform they would support. True False
True
Which of the following is/are always required syntax for the if structure (all that apply)? if () parentheses else {} braces
if () parentheses
Which properties describe the following loop (all that apply): for (i=0; i<10; i++) { System.out.printf("%d ", i); } System.out.println(); pre-test loop post-test loop counter-controlled loop sentinel-controlled loop indeterminate loop
pre-test loop counter-controlled loop
