QUESTIONS AND ANSWERS
What does the combination of a double and an integer get you? - ANS A decimal
What is the output of the following code segment?
System.out.println( (double) () ); - ANS 2.0
What is the result of the Modulus Division?
System.out.println( 11 % 4 ) - ANS 3
What is the output of the following code segment?
System.out.println(1 + 2 + "abc" + 3 + 4); - ANS 3abc34
What is the code called that is written in English and is used to help you work out the logic in an
algorithm? - ANS Pseudocode
Which is the best name for a variable in camel case that will store a person's first name? -
ANS firstName
What is the best data type for a variable that will store a street name - ANS String
What is the output of the following code segment?
Copyright ©2025 BRIGHTSTARS ALL RIGHTS RESERVED 1
,System.out.println(3 + 4 % 3); - ANS 4
What type of programming error will allow your program to run, but give incorrect output? -
ANS Logic Error
What is the correct syntax for a single line comment? - ANS //
What is the correct syntax for a Multi-line comment in Java? - ANS /* */
What is the result of the Floating Point Division?
System.out.println( 11. ); - ANS 2.75
What type of code are you writing when you are coding in Java? - ANS Source Code
What is the result of the Integer Division?
System.out.println( ) - ANS 2
What is the best name for a variable to store the number of computers in a room? -
ANS numComputers
What is the best data type to store the number of computers in a room? - ANS int
Which would correctly read a value an int value from the keyboard given the following
Scanner?
Scanner keyboard = new Scanner(System.in); - ANS int num = keyboard.nextInt();
Which would correctly read the entire line of text from the keyboard given the following
Scanner?
Copyright ©2025 BRIGHTSTARS ALL RIGHTS RESERVED 2
, Scanner keyboard = new Scanner(System.in); - ANS String line = keyboard.nextLine();
What is the purpose of the following line of code?
Scanner keyboard = new Scanner(System.in); - ANS Creates an object that will allow you to
read in from the keyboard
What is the best data type to store the state of a light bulb (on or off)? - ANS boolean
What would be displayed by the following code segment?
int num = 5;
num += 3;
System.out.println(num); - ANS 8
What is the best data type to represent PI or 3.14159? - ANS double/float
What is the best data type to store a persons' street address? - ANS String
The following code segment is shown both with an IF structure and an IF Else structure. What is
the final output of num in both situations?
(If Series)
int num = 0;
int test = 7;
if(test == 7){num++;}
if(test > 0) {num++;}
(If Else Structure)
Copyright ©2025 BRIGHTSTARS ALL RIGHTS RESERVED 3