1/41
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
The java interpreter is known as the ______________________
Virtual Machine
javac is the ___________________
local compiler
Java ___________________ represent the portable intermediate
language that is interpreted by running the Java interpreter
bytecodes
Java defines __ primitive types
8
Java's primitive integral data types are __________________
int, byte,short and long
Floating-point numbers are represented by the types __________ and _________________
float, double
_______________ has more significant digits, so use of it is recommended
over use of ___________________________
double, float
The __________ type is used to represent single characters, it occupies _____________ bits to represent the unicode standard
char, 16
What is the range of a byte data type and what does it store?
-128 to 127, 8 bit integer
What is the range of a short data type and what does it store?
-32,768 to 32,767, 16 bit integer
What is the range of an int data type and what does it store?
-2,147,483,648 to 2,147,483,647, 32 bit integer
What is the range of a long data type and what does it store?
-2^63 to 2^63 - 1, 64 bit integer
What is the range of a float data type and what does it store?
6 significant digits ( 10-46, 1038 ), 32 bit floating point
What is the range of a double data type and what does it store?
15 significant digits ( 10-324, 10308 ),
Which data type holds a value that is either true or false?
Boolean
The assignment operator is the _________________ ___________________
equals sign
What does the "+=" sign achieve
The += sign is an assignment operator that adds the value on its right-hand side to the variable on the left-hand side
What are other assignment operators?
-=, *=, /=
What are the binary arithmetic operators?
-, / ,* , %
What are the unary operators?
++ and --
Java's logical operators are______________,_______________,________________ and are used to simulate boolean algebra. They are sometimes known as ______________,_______________,________________
AND, OR, NOT, conjunction, disjunction, negation
Which logical operator takes highest precedence and which takes the lowest?
! (negation) has the highest precedence while || (or) has the lowest precedence.
What does it mean for a logical operator to be a short-circuit evaluation and which operators are short-circuit?
Short-circuit evaluation means that if the result can be determined by examining
the first expression, then the second expression is not evaluated.
The three basic forms of looping in Java are __________________, __________________, ___________________
for, do, and while
What is the break statement?
the break statement exits the innermost loop only. It is used in conjunction with loops and the switch statement for termination often times before the
What does the continue statement do?
The continue statement goes to the next iteration of the innermost loop. It is commonly used to avoid complex if-else patterns inside loops
What symbol is used for the conditional operator?
The question(?) mark in the following form x<=y ? x : y;
What is known as a function or procedure in other programming languages is known as a ___________________ in java.
method
The parameter list consist of zero or more of these ?
Formal parameters
When a method is called , the __________________ are sent into the formal parameters using normal assignment.
actual arguments
Java allows the _______________ of method names.
overloading - This means that several
methods may have the same name and be declared in the same class scope as
long as their signatures (that is, their parameter list types) differ.
static final variables are _____________________
constants
What extensions are used for java source and compiled files?
.java for java source files, and .class for compiled files.
Describe the three kinds of comments used in Java programs.
// which is for single line comments. / -- / which is for multiline comments. and /** which generates documentation from its comments.
What are the eight primitive types in java?
byte, long, boolean, int, double, float, char, String
What is the difference between the and = operators?
* is a binary operator.
*= is an assignment operator.
Explain the difference between the prefix and postfix increment
operators.
The prefix increment will increment the value immediately, while the postfix operator will increment the value the next time it is called.
Describe the three types of loops in Java
There are three loops in java, do..while, while, and for. The for loop is sufficient to express all repetition, the do...while loop always executes at least once, the while loop on the other hand will only increment if the statement evaluates to true.
Describe all the uses of a break statement. What is a labeled break
statement?
The break statement allows exit from the innermost loop. If there are several
loops that need exiting, the break will not work, and most likely you have poorly
designed code.
The break statement is often used in the switch statement.
What is a labeled break
statement?
a loop is labeled, and then a break statement can be applied to the
loop, regardless of how many other loops are nested
outer:
while( ... )
{
while( ... )
if( disaster )
break outer; // Go to after outer
}
// Control passes here after outer loop is exited
What does the continue statement do?
Occasionally, we want to give up on the current iteration of a loop and go
on to the next iteration. This can be handled by using a continue statement.
The following fragment prints the first 100
integers, with the exception of those divisible by 10:
for( int i = 1; i <= 100; i++ )
{
if( i % 10 == 0 )
continue;
System.out.println( i );
}
Of
What is method overloading?
is the allowance of multiple methods of the same name in the same class as long as their parameter lists differ.