2021 Java Programming Vocabulary Final Exam
methodName();
How do you call a method in Java?
False
Java is short for "JavaScript". True or False.
toUpperCase()
Which method can be used to return a string in upper case letters?
==
Which operator can be used to compare two values?
methodName()
How do you create a method in Java?
Modulus (%)
Returns the remainder of a division operation involving to integers
[]
To declare an array in Java, define the variable type with:
float
variable declaration for the primitive data type that is 4 bytes in size and includes floating-point numbers in the range of +/-3.4 x 10^-38 to +/-3.4 x 10^38, with 7 digits of accuracy
float x = 2.8f;
How do you create a variable with the floating number 2.8?
int x = 5;
How do you create a variable with the numeric value 5?
if (x > y)
How do you start writing an if statement in Java?
*
Which operator is used to multiply numbers?
break
Which statement is used to stop a loop?
Boolean Expressions
is either true or false (used for if statements)
0
Array indexes start with:
System.out.println("Hello World");
Correct syntax to output "Hello World" in Java?
// for short comments and /* */ for longer
How do you insert COMMENTS in Java code?
while (x > y)
How do you start writing a while loop in Java?
a set of well defined steps for performing a task or solving a problem, sequentially ordered.
What is the definition of an Algorithm?
String
Which data type is used to create a variable that stores text?
class
Which keyword is used to create a class in Java?
import
Which keyword is used to import a package from the Java API library?
Math.max(x,y)
Which method can be used to find the highest value of x and y?
int
variable declaration for the primitive data type that is 4 bytes in size and includes integers in the range of -2,147,483,648 to +2,147,483,648
long
variable declaration for the primitive data type that is 8 bytes in size and includes integers in the range of -9,223,372,036,854,775 to +9,223,372,036,854,775
The + sign
Which operator is used to add together two values?
byte
variable declaration for the primitive data type that is 1 byte in size and includes integers in the range of -128 to +127
short
variable declaration for the primitive data type that is 2 bytes in size and includes integers in the range of -32,768 to +32,767
double
variable declaration for the primitive data type that is 4 bytes in size and includes floating-point numbers in the range of +/-1.7 x 10^-308 to +/-1.7 x 10^308, with 15 digits of accuracy