Guest User

Untitled

a guest
Jun 23rd, 2017
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. True / False
  2. 1. The first generation of programming language is assembly language. F
  3. 2. Java is an example of a high-level language. T
  4. 3. Mistakes found early in the coding process are much more expensive to fix than mistakes found later in the process. F
  5. 4. Byte code is a program that behaves like a computer. F
  6. 5. An arithmetic expression consists of operands and binary operators combined as in algebra. T
  7. 6. Programs manipulate objects by sending them methods. F
  8. 7. An integer is a positive or negative whole number. T
  9. 8. Strings are objects, not primitive data types. T
  10. 9. A relational operator is used to compare data items. T
  11. 10. Most, but not all, information in a computer is represented in binary form. F
  12.  
  13. Fill In The Blank
  14. 1. OOP stands for object-oriented programming.
  15. 2. The software responsible for translating a program in a high-level language to machine code is called a compiler.
  16. 3. JVM stands for Java Virtual Machine.
  17. 4. When an object receives a message, the object responds by running a block of code called a method.
  18. 5. Numbers with a fractional part are called floating point numbers.
  19. 6. When evaluating an expression, Java performs operations of higher precedence first unless overridden by parenthesis.
  20. 7. Use the concatenation operator to create a new string out of existing strings.
  21. 8. The while statements implements a conditional.
  22. 9. An off by one error occurs when a loop goes around one too many or one too few times.
  23. 10. An infinite loop error occurs when a loop never stops.
  24.  
  25. Written Questions
  26. 1. What is the purpose of a variable in a program?
  27. Variables allow for a value to change within a program.
  28. 2. What are the three types of programming errors? Give a brief example of each.
  29. The three types of programming errors are compilation errors, run time errors, and logic errors. An example of a compilation error is a misspelled word. A run time error could occur when an equation gives an imaginary number. A logic error would be if the program was supposed to prompt the user for two things and it only prompted for one.
  30. 3. Describe the differences between the data types double and int.
  31. A double holds decimals, an int holds whole numbers.
  32. 4. Assume that the variables x and y contain the values 8 and 4, respectively. What are the values of the expressions listed below?
  33. A. x * y * 2
  34. 16
  35. B. (x+ y ) / 3
  36. 4
  37. C. x-y *3
  38. -4
  39. D. x + y * 1.5
  40. 14
  41. 5. Write a valid java statement that adds 5 to the value of variable x if the value of variable y is greater than 10
  42. if (y > 10) {
  43. x = x + 5;
  44. }
  45. 6. A program has the following loop heading: while ( 3 < x < 10 ). Is the heading syntactically correct? If incorrect, explain why.
  46. It is incorrect, there should be a comma, so it is while (3 < x , x < 10 ) {...
  47. 7. Write a loop that outputs the first 10 positive powers of 2
  48. while (x < 2^10) {
  49. int x;
  50. x = 2;
  51. x = x *2;
  52. System.out.println (x);
  53. }
Advertisement
Add Comment
Please, Sign In to add comment