Given the following statement which statement will write calvin to the file diskfile txt
Question 1Question Show
Which of the following statements opens a file named MyFile.txt and allows you to append data to its existing contents? Answer
Question 2Question When an object is created, the attributes associated with the object are called Answer
Question 3Question What will be the value of x after the following code is executed? Question 4Question Which of the following strings could be passed to the DecimalFormat constructor to display 12.78 as 12.8%? Answer
Question 5Question Given the following statement, which statement will write the string "Calvin" to the file DiskFile.txt? Answer
Question 6Question What would be the value of discountRate after the following statements are executed? Answer
Question 7Question The ________ is ideal in situations where the exact number of iterations is known. Answer
Question 8Question What will be the result of executing the following code? Answer
Question 9Question What will be displayed when the following code is executed? Answer
Question 10Question What will be the value of bonus after the following code is executed? Question 11Question In an if-else statement, if the boolean expression is false Answer
Question 12Question Assume that inputFile references a Scanner object that was used to open a file. Which of the following while loops shows the correct way to read data from the file until the end of the file is reached? Answer
Question 13Question What would be the value of discountRate after the following statements are executed? Answer
Question 14Question A ________ is a boolean variable that signals when some condition exists in the program. Answer
Question 15Question You should not define a class field that is dependent upon the values of other class fields Answer
Question 16Question Variables are classified according to their Answer
Question 17Question A class that is defined inside of another class is called a(n) Answer
Question 18Question Because Java byte code is the same on all computers, compiled Java programs Answer
Question 19Question Java requires that the boolean expression being tested by an if statement be enclosed in Answer
Question 20Question The scope of a local variable is Answer
Question 21Question What will be returned from the method, if the following is the method header? Answer
Question 22Question How many bits are in a byte? Question 23Question What will be the value of x after the following code is executed? Question 24Question If you do not provide initialization values for a class's numeric fields, they will Answer
Question 25Question ________ operators are used to determine whether a specific relationship exists between two values. Answer
Question 26Question Using a counter-controlled while loop, write Java code to compute the sum of the integers from 1 to 100, inclusively, and output that result to the console. You will declare the integer variable num to count the number of executions (in the counter-controlled loop) and initialize it to 1. You will also declare the integer variable sum to store your computation result and initialize it to 0. Be sure to print your result to the console. Question 27Question How many times will the following for loop be executed? Question 28Question This type of loop will always be executed at least once. Answer
Question 29Question Before entering a loop to compute a running total, the program should first Answer
Question 30Question Class objects normally have ________ that perform useful operations on their data, but primitive variables do not. Answer
Question 31Question After the header, the body of the method appears inside a set of Answer
Question 32Question A for loop normally performs which of these steps? Answer
Question 33Question In UML diagrams, what symbol indicates that a member is public? Question 34Question How many times will the following do-while loop be executed? Question 35Question What would be the value of discountRate after the following statements are executed? Answer
Question 36Question A method (NEED TO FIND ANSWER) Answer
Question 37Question What is the result of the following expression? Question 38Question What will be the result of the following code? Answer
Question 39Question A loop that executes as long as a particular condition exists is called a(n) ________ loop. Answer
Question 40Question UML diagrams do not contain Answer
Question 41Question To print "Hello, world" on the monitor, use the following Java statement: Answer
Question 42Question If str1 and str2 are both String objects, which of the following expressions will correctly determine whether or not they are equal? Answer
Question 43Question What will be displayed after the following code has been executed? Answer
Question 44Question The key word new Answer
Question 45Question Which of the following expressions could be used to perform a case-insensitive comparison of two String objects named str1 and str2? Answer
Question 46Question How many times will the following do-while loop be executed? Question 47Question What will be the value of x after the following code is executed? Question 48Question A UML diagram uses the ________ symbol to indicate that a member is private. Question 49Question What will be the value of x after the following code is executed? Question 50Question Which of the following is not a rule that must be followed when naming identifiers? Answer
Question 51Question A computer program is Answer
Question 52Question In all but rare cases, loops must contain within themselves Answer
Question 53Question A method's signature consists of Answer
Question 54Question What does the following UML diagram entry mean? Answer
Question 55Question Using a for loop, write Java code that prints out all multiples of 5 from 0 to 100, inclusively, to the console. Question 56Question A loop that repeats a specific number of times is known as a(n) ________ loop. Answer
Question 57Question What will be displayed when the following code is executed? Answer
Question 58Question What will be the values of ans, x, and y after the following statements are executed? Answer
Question 59Question What would be the value of x after the following statements were executed? Question 60Question When working with the PrintWriter class, which of the following import statements should you have near the top of your program? Answer
Question 61Question The boolean expression in an if statement must evaluate to Answer
Question 62Question This is a named storage location in the computer's memory. Answer
Question 63Question Methods that operate on an object's fields are called Answer
Question 64Question The variable used to keep the running total is called a(n) Answer
Question 65Question If object1 and object2 are objects of the same class, to make object2 a copy of object1 Answer
Question 66Question If you wish to use the System.out.printf method to print a string argument, use the ________ format specifier. Question 67Question A static field is created by placing the key word static Answer
Question 68Question Character literals are enclosed in ________, and string literals are enclosed in ________. Answer
Question 69Question What will be the value of x after the following code is executed? Question 70Question Which of the following expressions determines whether the char variable chrA is not equal to the letter 'A'? Answer
Question 71Question A block of code is enclosed in a set of Answer
Question 72Question A class's responsibilities include Answer
Question 73Question What is syntax? (NEED RIGHT ANSWER) Answer
Question 74Question Which of the following statements opens a file named MyFile.txt and allows you to read data from it? Answer
Question 75Question What is the value of ans after the following code has been executed? Answer
Question 76Question The ________ statement is used to create a decision structure, which allows a program to have more than one path of execution. Answer
Question 77Question Rewrite the following if-else if statement as a switch statement: Question 78Question What will be displayed when the following code is executed? (NEED RIGHT ANSWER) Answer
Question 79Question What is the result of the following expression? Question 80Question A search algorithm Answer
Question 81Answer
Question 82Answer
Question 83Question Data hiding, which means that critical data stored inside the object is protected from code outside the object, is accomplished in Java by Answer
Question 84Question Which of the following expressions will determine whether x is less than or equal to y? Answer
Question 85Question When saving a Java source file, save it with an extension of Answer
Question 86Question Another term for an object of a class is a(n) Answer
Question 87Question Which of the following statements determines whether temp is within the range of 0 through 100? Answer
Question 88Question Using a switch statement, write Java code to output the season of the year to the console based on the value of an integer variable called month according to the following: Question 89Question What will be the result of the following code? (NEED ANSWER) Answer
Question 90Question A constructor is a method that Answer
Question 91Question A group of related classes is called a(n) Answer
Question 92Question Assuming that inputFile references a Scanner object that was used to open a file, which of the following statements will read an int from the file? Answer
Question 93Question What does the following code do? Answer
Question 94Question The ________ loop is ideal in situations where you always want the loop to iterate at least once. Answer
Question 95Question A ________ is a value that signals when the end of a list of values has been reached. Answer
Question 96Question ________ is the term for the relationship created by object aggregation. Answer
Question 97Question Which Scanner class method reads a String? Answer
Question 98Question Enclosing a group of statements inside a set of braces creates Answer
Question 99Question This statement tells the compiler where to find the JOptionPane class and makes it available to your program. Answer
Question 100Question Which of the following is not a valid Java comment? Answer
What type of loop is ideal in situations where the exact number of iterations is known?For-loops are typically used when the number of iterations is known before entering the loop. For-loops can be thought of as shorthands for while-loops which increment and test a loop variable.
Which is a control structure that causes a statement or group of statements to repeat?A loop is a control structure that causes a statement or group of statements to repeat.
Is a value that signals when the end of a list of values has been reached?In computer programming, a sentinel value (also referred to as a flag value, trip value, rogue value, signal value, or dummy data) is a special value in the context of an algorithm which uses its presence as a condition of termination, typically in a loop or recursive algorithm.
Which of the following Cannot be used as identifiers in Java?The 49 reserved keywords for Java cannot be used as identifiers. These are some: switch, new, if, else, void, continue, class, import, etc. Using the reserved keywords as identifiers will result in a compilation fault.
|