These characters mark the beginning of a multi-line comment.
o //
o /*
o */
o /**
Front
/*
Back
The if statement is an example of a _____.
o Sequence structure
o Decision structure
o Pathway structure
o Class structure
Front
Decision Structure
Back
When Java converts a lower-ranked value to a higher-ranked type, it is called a(n) _____.
o 4-Bit conversion
o Escalating conversion
o Widening conversion
o Narrowing conversion
Front
Widening conversion
Back
How does the character 'A' compare to the character 'B'?
o 'A' is greater than 'B'
o 'A' is less than 'B'
o 'A' is equal to 'B'
o You cannot compare characters
Front
'A' is less than 'B'
Back
If one of an operators operands is a double, and the other operand is an int, Java will automatically convert the value of the double to an int.
o True
o False
Front
False
Back
Comments that begin with // can be processed by javadoc.
o True
o False
Front
False
Back
When determining whether a number is inside a range, its best to use this operator.
o &&
o !
o ||
o ? :
Front
&&
Back
You can use this class to display dialog boxes.
o JOptionPane
o BufferedReader
o InputStreamReader
o DialogBox
Front
JOptionPane
Back
The = operator and the == operator perform the same operation.
o True
o False
Front
False
Back
The Java compiler generates.
o Machine code
o Byte code
o Source code
o HTML
Front
Byte code
Back
A conditionally executed block should be indented one level from the if clause.
o True
o False
Front
True
Back
This is a named storage location in the computers memory.
o Class
o Key word
o Variable
o Operator
Front
Variables
Back
This is an empty statement that does nothing.
o Missing statement
o Virtual statement
o Null statement
o Conditional statement
Front
Null statement
Back
These characters mark the beginning of a single-line comment.
o //
o /*
o */
o /**
Front
//
Back
An else clause always goes with _____.
o The closest previous if clause that doesn't already have its own else clause
o The closest if clause
o The if clause that is randomly selected by the compiler
o None of these
Front
The closest previous if clause that doesn't already have its own else clause
Back
The conditional operator takes this many operands.
o One
o Two
o Three
o Four
Front
Three
Back
When an if statement is nested in the else clause of another statement, the only time the inner if statement is executed is when the Boolean expression of the outer if statement is true.
o True
o False
Front
False
Back
&& , || , and ! are _____.
o Relational operators
o Logical operators
o Conditional operators
o Ternary operators
Front
Logical operators
Back
This is an if statement that appears inside another if statement.
o Nested if statement
o Tiered if statement
o Dislodged if statement
o Structured if statement
Front
Nested if statement
Back
This determines whether two different String objects contain the same string.
o The == operator
o The = operator
o The equals method
o The StringCompare method
Front
The equals method
Back
These characters serve specific purposes, such as marking the beginning or ending of a statement, or separating items in a list.
o Punctuation
o Programmer-defined names
o Key words
o Operators
Front
Punctuation
Back
This section of a switch statement is branched to if none of the case expressions match the switch expression.
o Else
o Default
o Case
o Otherwise
Front
Default
Back
To create a block of statements, you enclose the statement in these.
o Parentheses ( )
o Square brackets [ ]
o Angled brackets < >
o Braces { }
Front
Braces { }
Back
> , < , and == are _____.
o Relational operators
o Logical operators
o Conditional operators
o Ternary operators
Front
Relational operators
Back
This type of operator lets you manually convert a value, even if it means that a narrowing conversion will take place.
o Cast
o Binary
o Uploading
o Dot
Front
Cast
Back
What will the println statement in the following program segment display?
Int x = 5;
System.out.println(x++);
o 5
o 6
o 0
o none of these
Front
5
Back
These characters mark the beginning of a documentation comment.
o //
o /*
o */
o /**
Front
/**
Back
The following data 72 , 'A' , "Hello World" , 2.8712 are all examples of ______.
o Variables
o Literals
o Strings
o None of these
Front
Literals
Back
All lines in a conditionally executed block should be indented one level.
o True
o False
Front
True
Back
Every complete statement ends with a ____.
o Period
o Parenthesis
o Semicolon
o Ending brace
Front
Semicolon
Back
This key word is used to declare a named constant.
o constant
o namedConstant
o final
o concrete
Front
namedConstant
Back
This type of expression has a value of either true or false.
o Binary expression
o Decision expression
o Unconditional expression
o Boolean expression
Front
Boolean expression
Back
Which of the following are NOT valid assignment statements?
o Total = 9;
o 72 = amount;
o profit = 129
o letter = 'W';
Front
72 = amount;
profit = 129
Back
You cannot change the value of a variable whose declaration uses the final key word.
o True
o False
Front
True
Back
A variable must be declared before it can be used.
o True
o False
Front
True
Back
These are words or names that are used to identify storage locations in memory and parts of the program that are created by the programmer.
o Punctuation
o Programmer-defined names
o Key words
o Operators
Front
Programmer-defined names
Back
When an if statement is nested in the if clause of another statement, the only time the inner if statement is executed is when the Boolean expression of the outer if statement is true.
o True
o False
Front
True
Back
These are the rules that must be followed when writing a program.
o Syntax
o Punctuation
o Key words
o Operators
Front
Syntax
Back
You can use this method to display formatted output in a console window.
o Format.out.println
o Console.format
o System.out.printf
o System.out.formatted
Front
System.out.printf
Back
A group of statements, such as the contents of a class or a method, are enclosed in _____.
o Braces { }
o Parentheses ( )
o Brackets [ ]
o Any of these will do
Front
Braces { }
Back
These are words that have a special meaning in the programming language.
o Punctuation
o Programmer-defined names
o Key words
o Operators
Front
Key words
Back
The negation operator is _____.
o Unary
o Binary
o Ternary
o None of these
Front
Unary
Back
A left brace in a Java program is always followed by a right brace later in the program.
o True
o False
Front
True
Back
Which Scanner class method would you use to read a string as input?
o nextString
o nextLine
o readString
o getLine
Front
nextLine
Back
Variable names may begin with a number.
o True
o False
Front
False
Back
This is a Boolean variable that signals when some condition exists in the program.
o Flag
o Signal
o Sentinel
o Siren
Front
Flag
Back
Which of the following are not valid println statements?
o System.out.println + "Hello World";
o System.out.println("Have a nice day");
o Out.System.println(value);
o Println.out(Programming is great fun);
Front
System.out.println + "Hello World";
Out.System.println(value);
Println.out(Programming is great fun);
Back
The scope of a variable is limited to the block in which it is defined.
o True
o False
Front
True
Back
These are symbols or words that perform operations on one or more operands.
o Punctuation
o Programmer-defined names
o Key words
o Operators
Front
Operators
Back
Which Scanner class method would you use to read a double as input?
o nextDouble
o getDouble
o readDouble
o None of these; you cannot read a double with Scanner class
Front
nextDouble
Back
Section 2
(50 cards)
In a nested loop, the inner loop goes through all of its iterations for every iteration of the outer loop.
o True
o False
Front
True
Back
Allows you to create one of two values: True or False (they can't be copied to a variable of any type other than Boolean)
Front
Boolean
Back
It is not necessary to initialize accumulator variables.
o True
o False
Front
False
Back
operator used that let you convert a value, even if it means that a narrowing conversion takes place (less accurate)
Front
Cast
Back
Named storage location in the computer's memory. (The most fundamental way that Java programs store an item of data in memory is with a variable.)
Front
Variables
Back
Generated by the Java Compiler
Front
Byte code
Back
A variable may be defined in the initialization expression of the for loop.
o True
o False
Front
True
Back
% ... returns the remainder of a division operation involving two integers.
Front
Modulus
Back
used to store characters. Can only hold 1 character at a time
Front
char
Back
used in switch statements. Each case value must be unique. (Used as an alternative to if statements)
Magic word - break
multiple options
Front
Case
Back
The for loop is this type of loop.
o Pretest
o Posttest
o Prefix
o Postfix
Front
Pretest
Back
Integer that takes up 2 bytes of memory
Front
Short
Back
a group of related classes
JOptionPane, IS, Scanner
Front
Packages
Back
What will the println statement in the following program segment display?
Int x = 5;
System.out.println(++x);
o 5
o 6
o 0
o none of these
Front
6
Back
This is a special value that signals when there are no more items from a list of times to be processed. This value cannot be mistaken as an item from the list.
o Sentinel
o Flag
o Signal
o Accumulator
Front
Sentinel
Back
A container for an application
Front
Class
Back
The while loop is this type of loop.
o Pretest
o Posttest
o Prefix
o Postfix
Front
Pretest
Back
What is each repetition of a loop known as?
o Cycle
o Revolution
o Orbit
o Iteration
Front
Iteration
Back
This type of loop always executes at least once.
o While
o Do-while
o For
o Any of these
Front
Do-while
Back
A value that is written in the code of a program
Front
Literal
Back
A group of one or more programming statements that collectively has a name
eg: main method (file name!)
Front
Method
Back
When a program is finished using a file, it should do this.
o Erase the file
o Close the file
o Throw an exception
o Reset the read position
Front
Close the file
Back
A set of numbers that are used as code for representing characters
Front
Unicode
Back
One limitation of the for loop is that only one variable may be initialized in the initialization expression.
o True
o False
Front
False
Back
Whole numbers (uses 4 bytes of memory)
Front
Int
Back
Method used for reading strings, bytes, integers, long integers, short integers, floats, and doubles. It waits for the user to press the enter key before it returns a value.
Front
Scanner
Back
consists of 8 bits... Integer that takes up 1 byte of memory
Front
Byte
Back
The do while loop is this type of loop.
o Pretest
o Posttest
o Prefix
o Postfix
Front
Posttest
Back
The data contained in an object. (An object is a software entity that contains data and procedures)
Front
Attributes
Back
The for loop is a posttest loop.
o True
o False
Front
False
Back
Allows you to quickly display a dialog box, which is a small graphical window displaying a message or requesting input.
Front
JOptionPane
Back
This class allows you to use the print and println methods to write data to a file.
o File
o FileReader
o OutputFile
o PrintWriter
Front
PrintWriter
Back
This expression is executed by the loop only once, regardless of the number of iterations.
o Initialization expression
o Test expression
o Update expression
o Pre-increment expression
Front
Initialization expression
Back
Rules that must be followed when writing a program. Syntax dictates how key words and operators may be used, and where punctuation symbols must appear.
Front
Syntax
Back
To calculate the total number of iterations of a nested loop, add the number of iterations of all the loops.
o True
o False
Front
False
Back
Decimal number to the 7th place (uses 4 bytes of memory)
Front
Float
Back
This is a variable that keeps a running total.
o Sentinel
o Sum
o Total
o Accumulator
Front
Accumulator
Back
The do-while loop is a pretest loop
o True
o False
Front
False
Back
To open a file for writing, you use the following class.
o PrintWriter
o FileOpen
o OutputFile
o FileReader
Front
PrintWriter
Back
In the expression number++, the ++ operator is in what mode?
o Prefix
o Protest
o Postfix
o Posttest
Front
Postfix
Back
This class allows you to read a line from a file.
o FileWriter
o Scanner
o InputFile
o FileReader
Front
Scanner
Back
To open a file for reading, you use the following classes.
o File and Writer
o File out Output
o File and Input
o File and Scanner
Front
File and Scanner
Back
Characters serve specific purposes, such as marking the beginning or ending of a statement, or separating items in a list.
Front
Java Punctuation
Back
This type of loop has no way of ending and repeats until the program is interrupted.
o Intermediate
o Interminable
o Infinite
o Timeless
Front
Infinite
Back
A collection of characters
Front
String
Back
The while loop is a pretest loop.
o True
o False
Front
True
Back
Allows you to format the appearance of floating-point numbers rounded to a specific number of decimal places. It is useful for formatting numbers that will be displayed in message dialogs
Front
DecimalFormat
Back
Decimal number to the 15th place (uses 8 bytes of memory)
Front
Double
Back
This is a variable that controls the number of iterations performed by a loop.
o Loop control variable
o Accumulator
o Iteration register variable
o Repetition meter
Front
Loop control variable
Back
Integer that takes up 8 bytes of memory
Front
Long
Back
Section 3
(9 cards)
- Looks like an inverted while-loop... Always performs at least one iteration, even if the Boolean is false to begin with. (User has to answer yes for it to continue repeating) (posttest)
Front
Do-while loop
Back
Control structure that causes a statement or group of statements to repeat... has two important parts... 1) a Boolean expression that is tested for a true or false value, and 2) a statement or block of statements that is repeated as long as the expression is true.
(pretest)
Front
While loop
Back
variable used to accumulate the total of the numbers. (Running total)
Front
Accumulator
Back
ideal for performing a known number of iterations. Pre-test.
Front
For loop
Back
tests each expression after each iteration (Do-while loop)
Front
Post-test loop
Back
A loop that has no way of stopping. It continues to repeat until the program is interrupted.
Front
Infinite loop
Back
constant (cant be changed)
Front
final
Back
tests each expression before each iteration (while loop, for loop)
Front
Pre-test loop
Back
a special value that cannot be mistaken as a member of the list, and signals that there are no more values to be entered. When the user enters the sentinel value, the loop terminates.