Classes, types, identifiers, operators, I/O, storage, binary/hex, control structures, errors and exceptions
335117881 | Java developer | James Gosling (with a team) at Sun Microsystems | |
335117882 | Classes should... | ...begin with a capital letter | |
335117883 | The identifier 'myVariable' demonstrates... | ...camel case | |
335117884 | OOP | Object-Oriented Programming | |
335117885 | Block comment syntax | /**blah blah blah**/ | |
335123645 | Single line syntax | // blah blah blah | |
335123646 | All Java methods must be contained in a ... | class | |
335123647 | public, static, void and main are examples of... | reserved words | |
335123648 | Reserved words aka | keywords | |
335123649 | Methods that will not access any objects of a class | static | |
335127850 | Java files comprising your program | source files | |
335127851 | Converts source code to machine-readable form | compiler | |
335127852 | Machine-readable code | bytecode | |
335127853 | Extension for machine-readable code | class | |
335127854 | Extension for source code | java | |
335127855 | Java program that runs inside a web browser | applet | |
335127856 | 'dog' vs 'Dog' demonstrates | case sensitivity | |
335127857 | Halmark of good identifier names | self-documenting | |
335131403 | Variable name | identifier | |
335131404 | 'Container' for a piece of information | variable | |
335131405 | Denotes the kind of information stored in a variable | data type | |
335131406 | Java is a heavily ______ language | typed | |
335133317 | Binary data type | boolean | |
335133318 | Data type indicative of a single symbol | char | |
335135481 | int x; | declaration | |
335135484 | double pi = 3.14; | declaration/initialization | |
335135486 | Given: int myVal; myVal = 8; //this statement, an example of ... | initialization | |
335138648 | Java is a ______ language | case-sensitive | |
335138649 | int x = 2; int y = 3; double quotient = (double) x/y; //an example of... | casting | |
335139817 | Delimiter symbol(s) for a class | { } | |
343943509 | Equivalent to: x /=2; | x = x/2; | |
343943510 | Equivalent to: x = x + 1; | x++; | |
343943511 | Write a complete declaration/initialization for an integer called r that is the remainder when 8 is divided by 3 | int r = 8%3; | |
343943512 | Another name for % operator | modulus operator | |
343943513 | Number of bytes in an int | 4 | |
343943514 | Number of bits in an int | 32 | |
343943515 | Number of bits in a byte | 8 | |
343943516 | Integer.MAX_VALUE | 2^31 - 1 (^ stands for 'raised to the power of') | |
343943517 | Integer.MIN_VALUE | -2^31 (^ stands for 'raised to the power of') | |
343943518 | NaN | Not a Number | |
343943519 | Number base for hexadecimal | 16 | |
343943520 | Largest symbol in a hexadecimal value | F | |
343943521 | To denote a hex number in Java, use this prefix | 0x or 0X | |
343943522 | Key word denoting a user-defined constant | final | |
343943523 | Constant identifiers are, by convention, ________ | capitalized | |
343943524 | Given: int x = 17; int y = 4; double q = x/y; What will be the value of q? | 4 | |
343943525 | When a computer processes the expression: 5/2 and yields a '2' as a result, the answer is said to be ______________ | truncated | |
343943526 | Relational operator for 'equal to' | == | |
343943527 | Relational operator for 'not equal to' | != | |
343943528 | Relational operator for 'less than or equal to' | <= | |
343943529 | Logical operator for 'AND' | && | |
343943530 | Logical operator for 'OR' | || | |
343943531 | Name of the '|' symbol | pipe | |
343943532 | Simple assignment operator | = | |
343943533 | Increment operator | ++ | |
343943534 | Decrement operator | -- | |
343943535 | Concatenation symbol | + | |
343943536 | The expression '\n' is known as an ______ _______ | escape sequence | |
343943537 | Newline escape sequence | \n | |
343943538 | Double quote escape sequence | \" | |
343943539 | Backslash escape sequence | \\ | |
343943540 | An escape sequence is used to print _____ ______ | special characters | |
343943541 | Syntax for one-way selection | if( | |
343965020 | A ______ expression is one that can be evaluated as either true or false | boolean | |
343965021 | True or false: 'true' is a reserved word in Java | true | |
343965022 | Syntax for two-way selection | if( | |
343965023 | If an 'if' block itself contains an 'if' block, the result is a ________ if statement | nested | |
343965024 | Delimiters for selection logic blocks with multiple lines | { } | |
343965025 | Syntax for standard 'fixed iteration' repetition structure | for( | |
343965026 | 'for-each' syntax for a repetition structure | for(SomeType element : collection)
{
/** | |
343965027 | Output of: for(int k = 20; k >=15; k--) System.out.print(k + " "); | 20 19 18 17 16 15 | |
343965028 | Output of: for(int j = 2; j <=10; j+=2) System.out.print(j + " "); | 2 4 6 8 10 | |
343965029 | Output of: for(int k = 20; k <=15; k--) System.out.print(k + " "); | //no output: termination condition met in first pass | |
343965030 | Syntax for pre-condition repetition structure | while( | |
343965031 | The body of a while loop must contain ________ | A statement that leads to termination | |
343965032 | An ______ loop never ends | infinite | |
343965033 | Loops that contain other loops are known as ______ loops | nested | |
343965034 | An _______ is an error condition that occurs during the execution of a Java program | exception | |
343965035 | Use this exception to guard against division by zero | ArithmeticException | |
343965036 | Use this exception to make sure the correct value of a parameter is being used | IllegalArgumentException | |
343965037 | Use this exception to make sure you do not exceed the size of an array | ArrayIndexOutOfBoundsException | |
343965038 | Correct the error: if(age = 2) System.out.println("Terrible two"); | if(age == 2) System.out.println("Terrible two"); | |
343965039 | Syntax for post-condition repetition structure | do
{
/** | |
343965040 | Hex value of binary number: '10110010' | B2 | |
343965041 | Decimal value of hex number: 'B2' | 178 | |
344872501 | Output of: for(int k = 1; k <=5; k++); System.out.print(k + " "); | 6 | |
354207564 | You want to use keyboard input for an application. What line lets bring in the necessary library? | import java.util.Scanner; | |
354207565 | How do you create an object (called 'keyBoard') to read user-input from the keyboard, assuming the necessary libraries have been brought in? | Scanner keyBoard = new Scanner(System.in); | |
354207566 | You have created an object named 'keyBoard' to read user-inputs. Use it to read a String value into a variable named 'userName' . Write a complete line of code. | String userName = keyBoard.nextLine(); | |
354207567 | You have created an object named 'keyBoard' to read user-inputs. Use it to read an integer value into a variable named 'age' . Write a complete line of code. | int age = keyBoard.nextInt(); | |
367921566 | Ternary operator | ?: | |
367921567 | if(happyAndKnowIt)sound = clapHands(); else sound=booHoo(); //Write using shortcut | sound = (happyAndKnowIt)? clapHands():booHoo(); |