{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

pastexam1 - Exam 1 ECS 102 Dr Baruch Spring 2006 Name No...

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

View Full Document Right Arrow Icon
Exam 1 ECS 102 Dr. Baruch Spring 2006 Name: No calculators. problem points score 1 12 2 5 3 6 4 3 5 6 6 3 7 12 8 8 9 10 10 5 11 9 12 15 13 6 Total 100 1
Background image of page 1

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

View Full Document Right Arrow Icon
1. Evaluate as a computer would (a) floor(6.9) (b) ceil(6.9) (c) 17%5 (d) 17 / 5 (e) pow(6,2) (f) 20 . 0 - 3 . 0 * 4 . 0 2. Write a C expression that could be used for computing the following expression: a = x 2 - 1 e 2 + 3 - | x + 3 | 3. Circle any invalid variable names. (a) luv2sing (b) star**struck (c) main (d) 2ndBase (e) TimeTravel (f) on the hill 4. Write a preprocessor directive for a constant INCH PER YD with value 36. 2
Background image of page 2
5. Answer the questions about this code segment. The data entered at the keyboard are s t u v double a,b; int x; char m, k, n, p; a=1.1; b=3*a; x = (int)a; (int) b; printf("Enter four letters: "); scanf("%c%c %c %c", &p, &k, &m, &n); printf("a is %lf,\n b is %lf,\n x is %d",a, b, x); (a) What will be the memory for each variable, from beginning to end? (Cross out old values.) (b) What will we see on the monitor? (From the beginning.) Use to indicate each space. 6. Write a declaration for a variable that will (a) store a T-shirt size ( S, M, or L ).
Background image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}