2_Questions_3-1

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

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
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 );
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/02/2011 for the course CIS 15BG taught by Professor Staff during the Spring '10 term at DeAnza College.

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 Right Arrow Icon
Ask a homework question - tutors are online