2_Questions_3-1

# 2_Questions_3-1 - CIS 15AG 1 Questions Chapter 3 Structure...

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

CIS 15AG Questions Chapter 3: Structure of a C Program: Expressions and Statements 1. Evaluate the following arithmetic expressions. For each result circle the appropriate type (int, float, double, char). Expression Value Type a. 11 / 2 int, float, double, char b. 5 + 2 * 2 int, float, double, char c. 11 / 2 * 2 int, float, double, char d. 15 / 5.0 int, float, double, char e. 11 % 5 int, float, double, char f. 5 % 11 int, float, double, char g. (2 + 2 * 3 + 4 * (5 - 1)) / 2.0 int, float, double, char 2. What is the output displayed by the following program fragment? int a; int b; int c; float x; a = 10; a = a + 5; printf( "%3d\n", a ); Answer: a = 7; b = 2; x = (float) a / b; printf( "%3d %3d %5.2f\n", a, b, x ); Answer: 1

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

View Full Document
CIS 15AG Questions Chapter 3: Structure of a C Program: Expressions and Statements 3. What is the output displayed by the following program fragment? int a; int b; int c; int d; a = 10; a += 5; printf( "%3d\n\n", a ); a = b = c = 10; d = a + b++ + ++c; printf( "%3d %3d %3d %3d\n", a, b, c, d );
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

2_Questions_3-1 - CIS 15AG 1 Questions Chapter 3 Structure...

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

View Full Document
Ask a homework question - tutors are online