This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Page 1-7 Java Midterm for ECE 203 First ………………………. Last …………….……………. Part A: General Understanding 1. The Java Virtual Machine translates byte-code into: a. source code b. virtual code c. machine language code d. ordinary English sentences. 2. The Java source code for a class should be in a file ending with the suffix (or extension): a. java b. class c. html d. javac 3. When a human writes a program in Java, they are writing: a. source code b. byte-code c. machine language code d. object code 4. The Java compiler translates your program into: a. source code b. byte-code c. machine language code d. object code 5. To store an item of data that is too large to fit into a single byte, the computer uses a number of adjacent bytes. The address of this large memory location is the address of: a. the first byte b. the last byte c. the middle byte d. all the bytes used 6. Programming languages that are designed for people to use are called … languages. a. low-level b. high-level c. machine d. assembly 7. Java is said to be an OOP language. What does OOP stand for? ___________________________________________________________________________________ 8. The process of hiding the details of how a program works is called: a. polymorphism b. encapsulation c. OOP d. disassembly e. inheritance 9. A programmer accidentally replaced a minus sign with a plus sign. The program compiles and runs, but gives the wrong answer. This is an example of a(n): a. OOPs b. encapsulation c. syntax error d. run-time error e. logic error 10. When a Java object performs the action for a given method it is said to call or … the method. a. encapsulate b. invoke c. provoke d. coordinate e. assemble 11. The technical term for a name in a programming language, such as the name of a variable is a: a. class b. object c. identifier d. keyword e. assemble 12. Identify the name below which would not be acceptable in Java. a. number1 b. Number1 c. 1Number d. number_1 e. numberOne 13. Which of these is not a primitive type? a. byte b. int c. long d. float e. String 14. In Java the assignment operator is represented by: a. := b. = c. && d. % e. == 15. A value of type int can be assigned or automatically converted to a variable of any of these types except : a. short b. int c. long d. float e. double 16. Given that x = 9.0 has been entered as the value of the variable x of type double , which of these assignments will correctly store the value of 9 in the integer variable y? a. y = x; b. y = (int) x; c. y = (double) x; d. y = (undouble) x; 17. A variable that has been declared but not yet given a value is said to be: a. short b. null c. void d. uninitialized e. anonymous 18. In the statement totalCost = n1*p1 +n2*p2; n1 is an int, n2 is a long, p1 is a float and p2 is a double. Therefore totalCost must be a: a. short b. int c. long d. float e. e....
View Full Document
This note was uploaded on 01/17/2012 for the course ECE 203 taught by Professor Robincarr during the Fall '07 term at Drexel.
- Fall '07