



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




What is a program? - answer A program is a set of instructions that a computer follows to perform a task. How many bits are in a byte? - answer 8 Is this a valid java variable? boolean 18isLegal = false; - answer False Java variables cannot start with a number Are Java variables case sensitive? T/F - answer True What does JVM stand for? - answer Java Virtual Machine JVM is specifically responsible for converting bytecode to machine- specific code Are char variables internally represented as numbers? - answer Yes
When Java converts a lower- ranked value to a higher- ranked type, it is called a( n) __________. - answer Widening Conversion This type of operator lets you manually convert a value, even if it means that a narrowing conversion will take place. - answer Cast Listen the different types of primitive types of Data - answer a) byte b) short c) int d) long e) float f) double g) char h) boolean The if statement is an example of a __________ - answer decision structure This type of expression has a value of either true or false. - answer Boolean Expression This is a boolean variable that signals when some condition exists in the program. - answer flag The = operator and == operator perform the same operation T/F - answer True What is each repetition of a loop known as? - answer iteration
The last subscript in an array is always - answer 1 less than the number of elements Each element of an array is accessed by a number known as a( n) __________. - answer Subscript What package needs to be imported to use JOptionPane.showInputDialog? - answer import javax.swing.JOptionPane; Write a boolean expression to test the char variable chr is not equal to the character 'C', regardless of the case. - answer char != 'C' || chr != 'c' Assuming str is a String variable with the value of "10". Write an expression that converts the value of str to an int called num. - answer num = Integer.parseInt(str); Write a statement that prints out "Hello World" with a new line using on System.out.print i) Include the quotes in "Hello World" - answer System.out.print(""Hello World"\n"); Assume the value and score are int variables. Write a boolean expression that assigns the value to 10 if the score is greater than 20 - answer if(score > 20) value = 10;
Assume str is a String Variable. Write ONE boolean expressions that check to see if it does NOT equal 'hello"? - answer a) If(str != "hello") b) !str.contains("hello") c)if(!str.equals("hello")) ALL CORRECT OPTIONS This type of method does not return a value - answer void You must have a return statement in a value-returning method T/F - answer True When passing an argument to a method, Java will automatically perform a narrowing conversion (convert the argument to a lower- ranking data type) T/F - answer False A value that is passed into a method when it is called is known as a - answer Parameter String Reversal Write a program that reverses the String "Hello" to "olleH" - answer public class StringReverser { public static void main(String [] args) { String str = "Hello"; String reversed = " ";