{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

pastexam1

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

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

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

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

View Full Document
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
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 ).

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}