BCIS 3630 – Flashcard

Unlock all answers in this set

Unlock answers
question
These are words that have a special meaning in the programming language. o Punctuation o Programmer-defined names o Key words o Operators
answer
Key words
question
These are symbols or words that perform operations on one or more operands. o Punctuation o Programmer-defined names o Key words o Operators
answer
Operators
question
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
answer
Punctuation
question
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
answer
Programmer-defined names
question
These are the rules that must be followed when writing a program. o Syntax o Punctuation o Key words o Operators
answer
Syntax
question
This is a named storage location in the computers memory. o Class o Key word o Variable o Operator
answer
Variables
question
The Java compiler generates. o Machine code o Byte code o Source code o HTML
answer
Byte code
question
Every complete statement ends with a ____. o Period o Parenthesis o Semicolon o Ending brace
answer
Semicolon
question
The following data 72 , 'A' , "Hello World" , 2.8712 are all examples of ______. o Variables o Literals o Strings o None of these
answer
Literals
question
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
answer
Braces { }
question
Which of the following are NOT valid assignment statements? o Total = 9; o 72 = amount; o profit = 129 o letter = 'W';
answer
72 = amount; profit = 129
question
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);
answer
System.out.println + "Hello World"; Out.System.println(value); Println.out(Programming is great fun);
question
The negation operator is _____. o Unary o Binary o Ternary o None of these
answer
Unary
question
This key word is used to declare a named constant. o constant o namedConstant o final o concrete
answer
namedConstant
question
These characters mark the beginning of a multi-line comment. o // o /* o */ o /**
answer
/*
question
These characters mark the beginning of a single-line comment. o // o /* o */ o /**
answer
//
question
These characters mark the beginning of a documentation comment. o // o /* o */ o /**
answer
/**
question
Which Scanner class method would you use to read a string as input? o nextString o nextLine o readString o getLine
answer
nextLine
question
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
answer
nextDouble
question
You can use this class to display dialog boxes. o JOptionPane o BufferedReader o InputStreamReader o DialogBox
answer
JOptionPane
question
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
answer
Widening conversion
question
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
answer
Cast
question
A left brace in a Java program is always followed by a right brace later in the program. o True o False
answer
True
question
A variable must be declared before it can be used. o True o False
answer
True
question
Variable names may begin with a number. o True o False
answer
False
question
You cannot change the value of a variable whose declaration uses the final key word. o True o False
answer
True
question
Comments that begin with // can be processed by javadoc. o True o False
answer
False
question
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
answer
False
question
The if statement is an example of a _____. o Sequence structure o Decision structure o Pathway structure o Class structure
answer
Decision Structure
question
This type of expression has a value of either true or false. o Binary expression o Decision expression o Unconditional expression o Boolean expression
answer
Boolean expression
question
> , < , and == are _____. o Relational operators o Logical operators o Conditional operators o Ternary operators
answer
Relational operators
question
&& , || , and ! are _____. o Relational operators o Logical operators o Conditional operators o Ternary operators
answer
Logical operators
question
This is an empty statement that does nothing. o Missing statement o Virtual statement o Null statement o Conditional statement
answer
Null statement
question
To create a block of statements, you enclose the statement in these. o Parentheses ( ) o Square brackets [ ] o Angled brackets < > o Braces { }
answer
Braces { }
question
This is a Boolean variable that signals when some condition exists in the program. o Flag o Signal o Sentinel o Siren
answer
Flag
question
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
answer
'A' is less than 'B'
question
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
answer
Nested if statement
question
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
answer
The closest previous if clause that doesn't already have its own else clause
question
When determining whether a number is inside a range, its best to use this operator. o && o ! o || o ? :
answer
&&
question
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
answer
The equals method
question
The conditional operator takes this many operands. o One o Two o Three o Four
answer
Three
question
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
answer
Default
question
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
answer
System.out.printf
question
The = operator and the == operator perform the same operation. o True o False
answer
False
question
A conditionally executed block should be indented one level from the if clause. o True o False
answer
True
question
All lines in a conditionally executed block should be indented one level. o True o False
answer
True
question
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
answer
True
question
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
answer
False
question
The scope of a variable is limited to the block in which it is defined. o True o False
answer
True
question
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
answer
5
question
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
answer
6
question
In the expression number++, the ++ operator is in what mode? o Prefix o Protest o Postfix o Posttest
answer
Postfix
question
What is each repetition of a loop known as? o Cycle o Revolution o Orbit o Iteration
answer
Iteration
question
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
answer
Loop control variable
question
The while loop is this type of loop. o Pretest o Posttest o Prefix o Postfix
answer
Pretest
question
The do while loop is this type of loop. o Pretest o Posttest o Prefix o Postfix
answer
Posttest
question
The for loop is this type of loop. o Pretest o Posttest o Prefix o Postfix
answer
Pretest
question
This type of loop has no way of ending and repeats until the program is interrupted. o Intermediate o Interminable o Infinite o Timeless
answer
Infinite
question
This type of loop always executes at least once. o While o Do-while o For o Any of these
answer
Do-while
question
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
answer
Initialization expression
question
This is a variable that keeps a running total. o Sentinel o Sum o Total o Accumulator
answer
Accumulator
question
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
answer
Sentinel
question
To open a file for writing, you use the following class. o PrintWriter o FileOpen o OutputFile o FileReader
answer
PrintWriter
question
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
answer
File and Scanner
question
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
answer
Close the file
question
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
answer
PrintWriter
question
This class allows you to read a line from a file. o FileWriter o Scanner o InputFile o FileReader
answer
Scanner
question
The while loop is a pretest loop. o True o False
answer
True
question
The do-while loop is a pretest loop o True o False
answer
False
question
The for loop is a posttest loop. o True o False
answer
False
question
It is not necessary to initialize accumulator variables. o True o False
answer
False
question
One limitation of the for loop is that only one variable may be initialized in the initialization expression. o True o False
answer
False
question
A variable may be defined in the initialization expression of the for loop. o True o False
answer
True
question
In a nested loop, the inner loop goes through all of its iterations for every iteration of the outer loop. o True o False
answer
True
question
To calculate the total number of iterations of a nested loop, add the number of iterations of all the loops. o True o False
answer
False
question
Characters serve specific purposes, such as marking the beginning or ending of a statement, or separating items in a list.
answer
Java Punctuation
question
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.
answer
Syntax
question
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.)
answer
Variables
question
Generated by the Java Compiler
answer
Byte code
question
The data contained in an object. (An object is a software entity that contains data and procedures)
answer
Attributes
question
A container for an application
answer
Class
question
A group of one or more programming statements that collectively has a name eg: main method (file name!)
answer
Method
question
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)
answer
Boolean
question
used to store characters. Can only hold 1 character at a time
answer
char
question
A set of numbers that are used as code for representing characters
answer
Unicode
question
consists of 8 bits... Integer that takes up 1 byte of memory
answer
Byte
question
Integer that takes up 2 bytes of memory
answer
Short
question
Integer that takes up 8 bytes of memory
answer
Long
question
Whole numbers (uses 4 bytes of memory)
answer
Int
question
Decimal number to the 15th place (uses 8 bytes of memory)
answer
Double
question
Decimal number to the 7th place (uses 4 bytes of memory)
answer
Float
question
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.
answer
Scanner
question
A collection of characters
answer
String
question
A value that is written in the code of a program
answer
Literal
question
a group of related classes JOptionPane, IS, Scanner
answer
Packages
question
operator used that let you convert a value, even if it means that a narrowing conversion takes place (less accurate)
answer
Cast
question
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
answer
DecimalFormat
question
used in switch statements. Each case value must be unique. (Used as an alternative to if statements) Magic word - break multiple options
answer
Case
question
Allows you to quickly display a dialog box, which is a small graphical window displaying a message or requesting input.
answer
JOptionPane
question
% ... returns the remainder of a division operation involving two integers.
answer
Modulus
question
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)
answer
While loop
question
- 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)
answer
Do-while loop
question
ideal for performing a known number of iterations. Pre-test.
answer
For loop
question
A loop that has no way of stopping. It continues to repeat until the program is interrupted.
answer
Infinite loop
question
tests each expression before each iteration (while loop, for loop)
answer
Pre-test loop
question
tests each expression after each iteration (Do-while loop)
answer
Post-test loop
question
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.
answer
Sentinel
question
variable used to accumulate the total of the numbers. (Running total)
answer
Accumulator
question
constant (cant be changed)
answer
final
Get an explanation on any task
Get unstuck with the help of our AI assistant in seconds
New