This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Computer Techniques for Electronic Design II (ESE 224) Quiz for chapter 3 Period: 10 minutes Multi‐Choice Problems Consider the following statement: Float a = 32.17, b = 0.00; 1. Which of the following statements are true? a) !(b < 1.00) b) a > 30.00 c) (a > 30.00) && (b < 12) d) (a <= b)  ! (a >= b) Problems 2 ~ 4 refer to the following statements: Int sum(0), count; for(count=0; count <= 5; ++count) { Sum += count; If (count == 2) Continue; If (count ==4) Break; } Count << “sum = “ << sum << endl; 2. What would you see on the screen if these statements are executed? a) Sum = 1; b) Sum = 3; c) Sum = 10; d) Sum = 15; e) F ive lines of output; 3. What is the value of count after execution of the for loop? a) 1 b) 2 c) 3 d) 4 e) 5 4. How many times is the for loop executed? a) 1 b) 2 c) 3 d) 4 e) 5 Memory Snapshot Problems 5. Give the corresponding value of b after the following set of statements is executed. Int a = 2, b = 3; Char ch = ‘*’; Switch(ch) { Case ‘+’: b = a + b; case ‘‐‘: b = a – b; case ‘*’: b = a * b; case ‘/’: b = a / b; } (hint: no ‘break’ after each case). Solutions 1.
2.
3.
4.
5. B, C C D E 0 ...
View
Full
Document
This note was uploaded on 10/23/2011 for the course ECE 224 taught by Professor Wangxin during the Spring '09 term at SUNY Stony Brook.
 Spring '09
 WangXin

Click to edit the document details