Fundamentals of Programming and Software Engineering - Java Test
Select the terms relating to comparisons for equality.
!= <= >= ==
Given the following statement, what is the value of myExample? myExample = (3 ^ 2) + (10 % 3) - 5;
4.3
What is the difference between the public and private access modifier in a user-defined method?
A public modifier makes the method accessible to other programs; a private one makes it accessible only within the current program.
What is an escape sequence, and how is it used?
An escape sequence is simple codes used in conjunction with a backslash to format program output.
Which statement correctly distinguishes between curly brackets ({ }) and parentheses ( )?
Curly brackets {} enclose statements, while parentheses () enclose arguments or parameters.
What is "public static grossPay()" an example of?
Private()
What is the correct Java syntax to output the sentence: My dog's name is "dee-dee"?
System.out.printIn("My dog's name is \"dee-dee"\");
Describe the Order of Operations in Java programming.
The Order of Operations in programming are known under the acronym PEMDMAS, which stands for parentheses, exponentiation, multiplication, division, modulus, addition, and subtraction. This is the order that Java follows this specific order for processing math calculations correctly.
In a Java conditional statement, on what does the value of the variable depend?
The boolean statement being true or false.
How are comments in a Java program treated by the compiler?
They are ignored.
Explain why each UDM should only perform one action.
UDM creates a single data narrative, in order to stay clear, it should perform only one action.
__________ is space between lines of program code that makes the code easier to read and that the compiler ignores.
Whitespace
Select the terms relating to Java data types.
byte, long, double
Select the terms relating to numbers larger than 50,000.
double long
Select the words that involve the order of operations.
exponentiation, modulus, parentheses, addition (remember PEMDMAS)
What is string literal in Java?
group of printable characters enclosed within double quotation marks
Demonstrate how to write each condition as an if-else in Java. If yes, then the computer should print "The answer is A," "The answer is B," or "The answer is C." Otherwise, the computer should print "The answer is not here." Condition: variable choice is A, B, or C.
if (10 <= 12)} System.out.printIn ("The answer is A"); }
To which statement is the case statement most similar?
if-else
What would be the Java code line to produce "Hello my name is Sue"?
info += "Hello my name is Sue"
Which symbols are used when defining arguments or variables in Java methods?
parentheses ()
User-defined methods that are __________ are available only within the program in which they are created.
private
What are code breaks in Java?
related groups of code (?)
Which characterization would accurately describe hump notation?
starting with a dollar sign, using lowercase for the remaining parts of each word
Consider the following statement: String myMiddleInitial = "h"; Is it correct? If not, what should the syntax be?
this is correct
Which term is a Java keyword indicating that a method will not return a value?
void