Exam 1 (chapter 1-4)
| 3978073728 | These are words that have a special meaning in the programming language. o Punctuation o Programmer-defined names o Key words o Operators | Key words | 0 | |
| 3978073729 | These are symbols or words that perform operations on one or more operands. o Punctuation o Programmer-defined names o Key words o Operators | Operators | 1 | |
| 3978073730 | These characters serve specific purposes, such as marking the beginning or ending of a statement, or separating items in a list. o Punctuation o Programmer-defined names o Key words o Operators | Punctuation | 2 | |
| 3978073731 | These are words or names that are used to identify storage locations in memory and parts of the program that are created by the programmer. o Punctuation o Programmer-defined names o Key words o Operators | Programmer-defined names | 3 | |
| 3978073732 | These are the rules that must be followed when writing a program. o Syntax o Punctuation o Key words o Operators | Syntax | 4 | |
| 3978073733 | This is a named storage location in the computers memory. o Class o Key word o Variable o Operator | Variables | 5 | |
| 3978073734 | The Java compiler generates. o Machine code o Byte code o Source code o HTML | Byte code | 6 | |
| 3978073735 | Every complete statement ends with a ____. o Period o Parenthesis o Semicolon o Ending brace | Semicolon | 7 | |
| 3978073736 | The following data 72 , 'A' , "Hello World" , 2.8712 are all examples of ______. o Variables o Literals o Strings o None of these | Literals | 8 | |
| 3978073737 | A group of statements, such as the contents of a class or a method, are enclosed in _____. o Braces { } o Parentheses ( ) o Brackets [ ] o Any of these will do | Braces { } | 9 | |
| 3978073738 | Which of the following are NOT valid assignment statements? o Total = 9; o 72 = amount; o profit = 129 o letter = 'W'; | 72 = amount; profit = 129 | 10 | |
| 3978073739 | Which of the following are not valid println statements? o System.out.println + "Hello World"; o System.out.println("Have a nice day"); o Out.System.println(value); o Println.out(Programming is great fun); | System.out.println + "Hello World"; Out.System.println(value); Println.out(Programming is great fun); | 11 | |
| 3978073740 | The negation operator is _____. o Unary o Binary o Ternary o None of these | Unary | 12 | |
| 3978073741 | This key word is used to declare a named constant. o constant o namedConstant o final o concrete | namedConstant | 13 | |
| 3978073742 | These characters mark the beginning of a multi-line comment. o // o /* o */ o /** | /* | 14 | |
| 3978073743 | These characters mark the beginning of a single-line comment. o // o /* o */ o /** | // | 15 | |
| 3978073744 | These characters mark the beginning of a documentation comment. o // o /* o */ o /** | /** | 16 | |
| 3978073745 | Which Scanner class method would you use to read a string as input? o nextString o nextLine o readString o getLine | nextLine | 17 | |
| 3978073746 | Which Scanner class method would you use to read a double as input? o nextDouble o getDouble o readDouble o None of these; you cannot read a double with Scanner class | nextDouble | 18 | |
| 3978073747 | You can use this class to display dialog boxes. o JOptionPane o BufferedReader o InputStreamReader o DialogBox | JOptionPane | 19 | |
| 3978073748 | When Java converts a lower-ranked value to a higher-ranked type, it is called a(n) _____. o 4-Bit conversion o Escalating conversion o Widening conversion o Narrowing conversion | Widening conversion | 20 | |
| 3978073749 | This type of operator lets you manually convert a value, even if it means that a narrowing conversion will take place. o Cast o Binary o Uploading o Dot | Cast | 21 | |
| 3978073750 | A left brace in a Java program is always followed by a right brace later in the program. o True o False | True | 22 | |
| 3978073751 | A variable must be declared before it can be used. o True o False | True | 23 | |
| 3978073752 | Variable names may begin with a number. o True o False | False | 24 | |
| 3978073753 | You cannot change the value of a variable whose declaration uses the final key word. o True o False | True | 25 | |
| 3978073754 | Comments that begin with // can be processed by javadoc. o True o False | False | 26 | |
| 3978073755 | If one of an operators operands is a double, and the other operand is an int, Java will automatically convert the value of the double to an int. o True o False | False | 27 | |
| 3978073756 | The if statement is an example of a _____. o Sequence structure o Decision structure o Pathway structure o Class structure | Decision Structure | 28 | |
| 3978073757 | This type of expression has a value of either true or false. o Binary expression o Decision expression o Unconditional expression o Boolean expression | Boolean expression | 29 | |
| 3978073758 | > , < , and == are _____. o Relational operators o Logical operators o Conditional operators o Ternary operators | Relational operators | 30 | |
| 3978073759 | && , || , and ! are _____. o Relational operators o Logical operators o Conditional operators o Ternary operators | Logical operators | 31 | |
| 3978073760 | This is an empty statement that does nothing. o Missing statement o Virtual statement o Null statement o Conditional statement | Null statement | 32 | |
| 3978073761 | To create a block of statements, you enclose the statement in these. o Parentheses ( ) o Square brackets [ ] o Angled brackets < > o Braces { } | Braces { } | 33 | |
| 3978073762 | This is a Boolean variable that signals when some condition exists in the program. o Flag o Signal o Sentinel o Siren | Flag | 34 | |
| 3978073763 | How does the character 'A' compare to the character 'B'? o 'A' is greater than 'B' o 'A' is less than 'B' o 'A' is equal to 'B' o You cannot compare characters | 'A' is less than 'B' | 35 | |
| 3978073764 | This is an if statement that appears inside another if statement. o Nested if statement o Tiered if statement o Dislodged if statement o Structured if statement | Nested if statement | 36 | |
| 3978073765 | An else clause always goes with _____. o The closest previous if clause that doesn't already have its own else clause o The closest if clause o The if clause that is randomly selected by the compiler o None of these | The closest previous if clause that doesn't already have its own else clause | 37 | |
| 3978073766 | When determining whether a number is inside a range, its best to use this operator. o && o ! o || o ? : | && | 38 | |
| 3978073767 | This determines whether two different String objects contain the same string. o The == operator o The = operator o The equals method o The StringCompare method | The equals method | 39 | |
| 3978073768 | The conditional operator takes this many operands. o One o Two o Three o Four | Three | 40 | |
| 3978073769 | This section of a switch statement is branched to if none of the case expressions match the switch expression. o Else o Default o Case o Otherwise | Default | 41 | |
| 3978073770 | You can use this method to display formatted output in a console window. o Format.out.println o Console.format o System.out.printf o System.out.formatted | System.out.printf | 42 | |
| 3978073771 | The = operator and the == operator perform the same operation. o True o False | False | 43 | |
| 3978073772 | A conditionally executed block should be indented one level from the if clause. o True o False | True | 44 | |
| 3978073773 | All lines in a conditionally executed block should be indented one level. o True o False | True | 45 | |
| 3978073774 | When an if statement is nested in the if clause of another statement, the only time the inner if statement is executed is when the Boolean expression of the outer if statement is true. o True o False | True | 46 | |
| 3978073775 | When an if statement is nested in the else clause of another statement, the only time the inner if statement is executed is when the Boolean expression of the outer if statement is true. o True o False | False | 47 | |
| 3978073776 | The scope of a variable is limited to the block in which it is defined. o True o False | True | 48 | |
| 3978073777 | What will the println statement in the following program segment display? Int x = 5; System.out.println(x++); o 5 o 6 o 0 o none of these | 5 | 49 | |
| 3978073778 | What will the println statement in the following program segment display? Int x = 5; System.out.println(++x); o 5 o 6 o 0 o none of these | 6 | 50 | |
| 3978073779 | In the expression number++, the ++ operator is in what mode? o Prefix o Protest o Postfix o Posttest | Postfix | 51 | |
| 3978073780 | What is each repetition of a loop known as? o Cycle o Revolution o Orbit o Iteration | Iteration | 52 | |
| 3978073781 | This is a variable that controls the number of iterations performed by a loop. o Loop control variable o Accumulator o Iteration register variable o Repetition meter | Loop control variable | 53 | |
| 3978073782 | The while loop is this type of loop. o Pretest o Posttest o Prefix o Postfix | Pretest | 54 | |
| 3978073783 | The do while loop is this type of loop. o Pretest o Posttest o Prefix o Postfix | Posttest | 55 | |
| 3978073784 | The for loop is this type of loop. o Pretest o Posttest o Prefix o Postfix | Pretest | 56 | |
| 3978073785 | This type of loop has no way of ending and repeats until the program is interrupted. o Intermediate o Interminable o Infinite o Timeless | Infinite | 57 | |
| 3978073786 | This type of loop always executes at least once. o While o Do-while o For o Any of these | Do-while | 58 | |
| 3978073787 | This expression is executed by the loop only once, regardless of the number of iterations. o Initialization expression o Test expression o Update expression o Pre-increment expression | Initialization expression | 59 | |
| 3978073788 | This is a variable that keeps a running total. o Sentinel o Sum o Total o Accumulator | Accumulator | 60 | |
| 3978073789 | This is a special value that signals when there are no more items from a list of times to be processed. This value cannot be mistaken as an item from the list. o Sentinel o Flag o Signal o Accumulator | Sentinel | 61 | |
| 3978073790 | To open a file for writing, you use the following class. o PrintWriter o FileOpen o OutputFile o FileReader | PrintWriter | 62 | |
| 3978073791 | To open a file for reading, you use the following classes. o File and Writer o File out Output o File and Input o File and Scanner | File and Scanner | 63 | |
| 3978073792 | When a program is finished using a file, it should do this. o Erase the file o Close the file o Throw an exception o Reset the read position | Close the file | 64 | |
| 3978073793 | This class allows you to use the print and println methods to write data to a file. o File o FileReader o OutputFile o PrintWriter | PrintWriter | 65 | |
| 3978073794 | This class allows you to read a line from a file. o FileWriter o Scanner o InputFile o FileReader | Scanner | 66 | |
| 3978073795 | The while loop is a pretest loop. o True o False | True | 67 | |
| 3978073796 | The do-while loop is a pretest loop o True o False | False | 68 | |
| 3978073797 | The for loop is a posttest loop. o True o False | False | 69 | |
| 3978073798 | It is not necessary to initialize accumulator variables. o True o False | False | 70 | |
| 3978073799 | One limitation of the for loop is that only one variable may be initialized in the initialization expression. o True o False | False | 71 | |
| 3978073800 | A variable may be defined in the initialization expression of the for loop. o True o False | True | 72 | |
| 3978073801 | In a nested loop, the inner loop goes through all of its iterations for every iteration of the outer loop. o True o False | True | 73 | |
| 3978073802 | To calculate the total number of iterations of a nested loop, add the number of iterations of all the loops. o True o False | False | 74 | |
| 3978073803 | Characters serve specific purposes, such as marking the beginning or ending of a statement, or separating items in a list. | Java Punctuation | 75 | |
| 3978073804 | Rules that must be followed when writing a program. Syntax dictates how key words and operators may be used, and where punctuation symbols must appear. | Syntax | 76 | |
| 3978073805 | Named storage location in the computer's memory. (The most fundamental way that Java programs store an item of data in memory is with a variable.) | Variables | 77 | |
| 3978073806 | Generated by the Java Compiler | Byte code | 78 | |
| 3978073807 | The data contained in an object. (An object is a software entity that contains data and procedures) | Attributes | 79 | |
| 3978073808 | A container for an application | Class | 80 | |
| 3978073809 | A group of one or more programming statements that collectively has a name eg: main method (file name!) | Method | 81 | |
| 3978073810 | Allows you to create one of two values: True or False (they can't be copied to a variable of any type other than Boolean) | Boolean | 82 | |
| 3978073811 | used to store characters. Can only hold 1 character at a time | char | 83 | |
| 3978073812 | A set of numbers that are used as code for representing characters | Unicode | 84 | |
| 3978073813 | consists of 8 bits... Integer that takes up 1 byte of memory | Byte | 85 | |
| 3978073814 | Integer that takes up 2 bytes of memory | Short | 86 | |
| 3978073815 | Integer that takes up 8 bytes of memory | Long | 87 | |
| 3978073816 | Whole numbers (uses 4 bytes of memory) | Int | 88 | |
| 3978073817 | Decimal number to the 15th place (uses 8 bytes of memory) | Double | 89 | |
| 3978073818 | Decimal number to the 7th place (uses 4 bytes of memory) | Float | 90 | |
| 3978073819 | Method used for reading strings, bytes, integers, long integers, short integers, floats, and doubles. It waits for the user to press the enter key before it returns a value. | Scanner | 91 | |
| 3978073820 | A collection of characters | String | 92 | |
| 3978073821 | A value that is written in the code of a program | Literal | 93 | |
| 3978073822 | a group of related classes JOptionPane, IS, Scanner | Packages | 94 | |
| 3978073823 | operator used that let you convert a value, even if it means that a narrowing conversion takes place (less accurate) | Cast | 95 | |
| 3978073824 | Allows you to format the appearance of floating-point numbers rounded to a specific number of decimal places. It is useful for formatting numbers that will be displayed in message dialogs | DecimalFormat | 96 | |
| 3978073825 | used in switch statements. Each case value must be unique. (Used as an alternative to if statements) Magic word - break multiple options | Case | 97 | |
| 3978073826 | Allows you to quickly display a dialog box, which is a small graphical window displaying a message or requesting input. | JOptionPane | 98 | |
| 3978073827 | % ... returns the remainder of a division operation involving two integers. | Modulus | 99 | |
| 3978073828 | Control structure that causes a statement or group of statements to repeat... has two important parts... 1) a Boolean expression that is tested for a true or false value, and 2) a statement or block of statements that is repeated as long as the expression is true. (pretest) | While loop | 100 | |
| 3978073829 | - Looks like an inverted while-loop... Always performs at least one iteration, even if the Boolean is false to begin with. (User has to answer yes for it to continue repeating) (posttest) | Do-while loop | 101 | |
| 3978073830 | ideal for performing a known number of iterations. Pre-test. | For loop | 102 | |
| 3978073831 | A loop that has no way of stopping. It continues to repeat until the program is interrupted. | Infinite loop | 103 | |
| 3978073832 | tests each expression before each iteration (while loop, for loop) | Pre-test loop | 104 | |
| 3978073833 | tests each expression after each iteration (Do-while loop) | Post-test loop | 105 | |
| 3978073834 | a special value that cannot be mistaken as a member of the list, and signals that there are no more values to be entered. When the user enters the sentinel value, the loop terminates. | Sentinel | 106 | |
| 3978073835 | variable used to accumulate the total of the numbers. (Running total) | Accumulator | 107 | |
| 3978073836 | constant (cant be changed) | final | 108 |

