midreview08f - 8 Write the truth table for the(not operator...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS1MD3 MidReview. 1 Midterm Review Chapter 1 1. What are the three criteria an algorithm must satisfy? 2. What is JVM (Java Virtual Machine)? Chapter 2 1. Indicate the class hierarchy in the program in FIGURE 2-9, p. 46. Chapter 3 1. What are the two attributes that de±ne a data type? 2. What are the three important attributes of a variable? 3. Indicate the values and types of the following expressions: a) 2 + 3 b) 19 / 5 c) 19.0 / 5 d) 3 * 6.0 e) 19 % 5 f) 2 % 7 4. By applying the appropriate precedence rules, calculate the result of each of the following expressions: a) 6 + 5 / 4 - 3 b) 10 + 9 * ((8 + 7) % 6) + 5 * 4 % 3 * 2 + 1 5. If the variable k is declared to be of type int , what value does k contain after the program executes the assignment statement k = (int) 3.14159; What value k contain after the assignment state k = (int) 2.71828 6. Write the truth table for the (and) operator. 7. Write the truth table for the || (or) operator.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 8. Write the truth table for the ! (not) operator. 9. What is De Morgan’s law? 10. How would you write a Boolean expression to test whether the value of the integer variable n was in the range 0 to 9, inclusive? CS1MD3 MidReview. 2 11. Describe in English what the following conditional expression means: (x != 4) || (x != 17) For what values of x is this condition true? 12. In the program in FIGURE 3-5, p. 87, how are the named constants de±ned? How does the program center the ±gure? Chapter 4 1. What for loop control line would you use in each of the following situations: a) Counting from 1 to 100. b) Counting by sevens starting at 0 until the number has more than two digits. c) Counting backward by twos from 100 to 0. 2. In the program in FIGURE 4-2, p. 104, how does the program add a list of integers using a sentinel?...
View Full Document

This note was uploaded on 10/27/2009 for the course COMP SCI 1MD3 taught by Professor Various during the Winter '07 term at McMaster University.

Page1 / 2

midreview08f - 8 Write the truth table for the(not operator...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online