Exam

Name___________________________________

TRUE/FALSE. Write 'T' if the statement is true and 'F' if the statement is false.
 
1)  All information is stored in the computer using binary numbers. 1) ______

2)  Java is an object-oriented programming language. 2) ______

3)  System.out.print is used in a program to denote that a comment follows. 3) ______

4)  Java byte codes are directly executable whereas Java source code is not. 4) ______

5)  The Java compiler is able to find all programmer errors. 5) ______

6)  Java is a case-sensitive language meaning that Current, current, and CURRENT will all reference the same identifier. 6) ______

7)  Code placed inside of comments will not be compiled and therefore will not execute. 7) ______

8)  The word "Public" is a reserved word. 8) ______

9)  Reserved words in Java can be redefined by the programmer to mean something other than their original intentions. 9) ______

10)  In a Java program, dividing by 0 is a syntax error. 10) ______

11)  Binary numbers are composed entirely of 0s and 1s. 11) ______

12)  RAM is random access memory while ROM is not random access memory. 12) ______

13)  Java is an example of a fourth generation language. 13) ______

14)  The line of Java code "// System.out.println("Hello");" will cause "Hello" to be output. 14) ______

15)  A unique aspect of Java that allows code compiled on one machine to be executed on a machine of a different hardware platform is Java's bytecodes. 15) ______

16)  A Java compiler can determine if you have followed both proper syntax and semantics. 16) ______

17)  A black and white picture can be stored by representing each pixel using a single bit. 17) ______

18)  Mistyping "println" as "printn" will result in a run-time error. 18) ______

19)  One terabyte is equivalent to approximately 1000 gigabytes. 19) ______

20)  An operating system is considered software. 20) ______

21)  Older computers store information in analog. 21) ______

22)  Data written to a memory location overwrites and destroys any information that was stored at that location. 22) ______

23)  If x is a string, then x = new String("OH"); and x = "OH"; will accomplish the same thing. 23) ______

24)  Only difficult programming problems require a pseudocode solution before the programmer creates the implementation (program) itself. 24) ______

25)  In Java, if and if-else are selection statements. 25) ______

26)  In Java, the symbol "=" and the symbol "==" are used synonymously (interchangeably). 26) ______

27)  When comparing any primitive type of variable, == should always be used to test to see if two values are equal. 27) ______

28)  The statements x++; and ++x; will accomplish the same thing. 28) ______

29)  The statement { } is a legal block. 29) ______

30)  The statement if (a >= b) a++; else b--; will do the same thing as the statement if (a < b) b--; else a++;. 30) ______

31)  An if statement may or may not have an else clause, but an else clause must be part of an if statement. 31) ______

32)  In order to compare int and double variables, you can use <, >, ==, !=, <=, >=, but to compare char and String variables, you must use compareTo( ), equals( ) and equalsIgnoreCase( ). 32) ______

For question(s) below, assume that boolean done = false, int x = 10, int y = 11, String s = "Help" and String t = "Goodbye".
35)  The expression (!done && x <= y) is true. 35) ______

36)  The expression (done | | s.compareTo(t) < 0) is true. 36) ______

40)  The relational operators < and > can be used to tell whether one string comes before another alphabetically. 40) ______

41)  The expression 'Z' < 'a' is true. 41) ______

42)  The expression a || b will be true if either a or b is true, but not if both are true. 42) ______

43)  The statement num -= num; will have the same result as the statement num = 0. 43) ______

44)  If the integer variable answer is 5, then after answer %= 8; is executed, answer will be 3. 44) ______

48)  If x is the String "Hi There", then x.toUpperCase().toLowerCase(); will return the original version of x. 48) ______

49)  If String name = "George W. Bush"; then the instruction name.length(); will return 14. 49) ______

50)  If String a = "ABCD" and String b = "abcd" then a.equals(b); returns false but a.equalsIgnoreCase(b); returns true. 50) ______

51)  Unlike the String class where you must pass a message to an object (instance) of the class, as in x.length( ), in order to use the Math class, you pass messages directly to the class name, as in Math.abs( ). 51) ______

52)  A double is wider than an int. 52) ______

53)  A variable of type boolean will store either a 0 or a 1. 53) ______

54)  In Java, 'a' and 'A' are considered to be different values. 54) ______

55)  You cannot cast a String to be a char and you cannot cast a String which stores a number to be an int or double. 55) ______

56)  If a, b and c are int variables with a = 5, b = 7, c = 12, then the statement int z = (a * b - c) / a; will result in z equal to 4. 56) ______

57)  The mod operator, %, can only be performed on int values and its result is a double. 57) ______

58)  The word println is a reserved word. 58) ______

59)  A Java variable is the name of a data value stored in memory that can not change during the program's execution. 59) ______

60)  If you want to use classes from a package other than java.lang, you must import them. 60) ______

61)  The operators * and + have the same precedence. 61) ______

62)  Since double to int is a narrowing conversion, there is no way to convert a double to an int. 62) ______