Programming in C - W4

profiledanmelvanderson_i01c
w4_questions.docx

Question 1

1.  

What statement would you use to print the phrase “Hello, world” and then start a new line?

For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). Content Editor

Use arrow keys to select functions

Bold

Italic

Underline

Font family

Font size

Text Color

Bullet List

Number List

Toggle Spell Checker

Insert/Edit Link

Remove Link

Bold

Italic

Underline

Strikethrough

Format

Font family

Font size

Bullet List

Number List

Text Color

Highlight

Remove Formatting

Cut

Copy

Paste

Find

Undo

Redo

Align Left

Align Center

Align Right

Align Full

Indent

Outdent

Superscript

Subscript

Insert/Edit Link

Remove Link

Direction Left to Right

Direction Right to Left

Line

Horizontal Rule

Insert Nonbreaking Space Character

Toggle Spell Checker

Record from Webcam

Launch Math Editor

https://lms.grantham.edu/webapps/vtbe-tinymce/tiny_mce/plugins/bb_mashup/mashuplogo.pngInsert Mashup

Show Nonprinting Characters

Blockquote

Symbol

Emotions

Anchor

Insert/Edit Table

Table Row Properties

Table Cell Properties

Insert Row Before

Insert Row After

Delete Row

Insert Column Before

Insert Column After

Delete Column

Merge Table Cells

Split Merged Table Cells

HTML Code View

Edit CSS Style

Preview

Help

Full Screen

Show More

Path:

Words:0

10 points  

Question 2

1.  

What statement would you use to assign the value 32 to the variable cheeses?

For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). Content Editor

Use arrow keys to select functions

Bold

Italic

Underline

Font family

Font size

Text Color

Bullet List

Number List

Toggle Spell Checker

Insert/Edit Link

Remove Link

Bold

Italic

Underline

Strikethrough

Format

Font family

Font size

Bullet List

Number List

Text Color

Highlight

Remove Formatting

Cut

Copy

Paste

Find

Undo

Redo

Align Left

Align Center

Align Right

Align Full

Indent

Outdent

Superscript

Subscript

Insert/Edit Link

Remove Link

Direction Left to Right

Direction Right to Left

Line

Horizontal Rule

Insert Nonbreaking Space Character

Toggle Spell Checker

Record from Webcam

Launch Math Editor

https://lms.grantham.edu/webapps/vtbe-tinymce/tiny_mce/plugins/bb_mashup/mashuplogo.pngInsert Mashup

Show Nonprinting Characters

Blockquote

Symbol

Emotions

Anchor

Insert/Edit Table

Table Row Properties

Table Cell Properties

Insert Row Before

Insert Row After

Delete Row

Insert Column Before

Insert Column After

Delete Column

Merge Table Cells

Split Merged Table Cells

HTML Code View

Edit CSS Style

Preview

Help

Full Screen

Show More

Path:

Words:0

10 points  

Question 3

1.  

What statement would you use to read a value from keyboard input into the variable cheeses?

For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). Content Editor

Use arrow keys to select functions

Bold

Italic

Underline

Font family

Font size

Text Color

Bullet List

Number List

Toggle Spell Checker

Insert/Edit Link

Remove Link

Bold

Italic

Underline

Strikethrough

Format

Font family

Font size

Bullet List

Number List

Text Color

Highlight

Remove Formatting

Cut

Copy

Paste

Find

Undo

Redo

Align Left

Align Center

Align Right

Align Full

Indent

Outdent

Superscript

Subscript

Insert/Edit Link

Remove Link

Direction Left to Right

Direction Right to Left

Line

Horizontal Rule

Insert Nonbreaking Space Character

Toggle Spell Checker

Record from Webcam

Launch Math Editor

https://lms.grantham.edu/webapps/vtbe-tinymce/tiny_mce/plugins/bb_mashup/mashuplogo.pngInsert Mashup

Show Nonprinting Characters

Blockquote

Symbol

Emotions

Anchor

Insert/Edit Table

Table Row Properties

Table Cell Properties

Insert Row Before

Insert Row After

Delete Row

Insert Column Before

Insert Column After

Delete Column

Merge Table Cells

Split Merged Table Cells

HTML Code View

Edit CSS Style

Preview

Help

Full Screen

Show More

Path:

Words:0

10 points  

Question 4

1.  

What statement would you use to print “We have X varieties of cheese,” where the current value of the cheeses variable replaces X?

For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). Content Editor

Use arrow keys to select functions

Bold

Italic

Underline

Font family

Font size

Text Color

Bullet List

Number List

Toggle Spell Checker

Insert/Edit Link

Remove Link

Bold

Italic

Underline

Strikethrough

Format

Font family

Font size

Bullet List

Number List

Text Color

Highlight

Remove Formatting

Cut

Copy

Paste

Find

Undo

Redo

Align Left

Align Center

Align Right

Align Full

Indent

Outdent

Superscript

Subscript

Insert/Edit Link

Remove Link

Direction Left to Right

Direction Right to Left

Line

Horizontal Rule

Insert Nonbreaking Space Character

Toggle Spell Checker

Record from Webcam

Launch Math Editor

https://lms.grantham.edu/webapps/vtbe-tinymce/tiny_mce/plugins/bb_mashup/mashuplogo.pngInsert Mashup

Show Nonprinting Characters

Blockquote

Symbol

Emotions

Anchor

Insert/Edit Table

Table Row Properties

Table Cell Properties

Insert Row Before

Insert Row After

Delete Row

Insert Column Before

Insert Column After

Delete Column

Merge Table Cells

Split Merged Table Cells

HTML Code View

Edit CSS Style

Preview

Help

Full Screen

Show More

Path:

Words:0

10 points  

Question 5

1.  

Write a C program that displays your name and address (or if you value your privacy, a fictitious name and address).

For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). Content Editor

Use arrow keys to select functions

Bold

Italic

Underline

Font family

Font size

Text Color

Bullet List

Number List

Toggle Spell Checker

Insert/Edit Link

Remove Link

Bold

Italic

Underline

Strikethrough

Format

Font family

Font size

Bullet List

Number List

Text Color

Highlight

Remove Formatting

Cut

Copy

Paste

Find

Undo

Redo

Align Left

Align Center

Align Right

Align Full

Indent

Outdent

Superscript

Subscript

Insert/Edit Link

Remove Link

Direction Left to Right

Direction Right to Left

Line

Horizontal Rule

Insert Nonbreaking Space Character

Toggle Spell Checker

Record from Webcam

Launch Math Editor

https://lms.grantham.edu/webapps/vtbe-tinymce/tiny_mce/plugins/bb_mashup/mashuplogo.pngInsert Mashup

Show Nonprinting Characters

Blockquote

Symbol

Emotions

Anchor

Insert/Edit Table

Table Row Properties

Table Cell Properties

Insert Row Before

Insert Row After

Delete Row

Insert Column Before

Insert Column After

Delete Column

Merge Table Cells

Split Merged Table Cells

HTML Code View

Edit CSS Style

Preview

Help

Full Screen

Show More

Path:

Words:0

10 points  

Question 6

1.  

Declare variables matching the following descriptions:

a. A short integer with the value 80

b. An unsigned int integer with the value 42,110

c. An integer with the value 3,000,000,000

For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). Content Editor

Use arrow keys to select functions

Bold

Italic

Underline

Font family

Font size

Text Color

Bullet List

Number List

Toggle Spell Checker

Insert/Edit Link

Remove Link

Bold

Italic

Underline

Strikethrough

Format

Font family

Font size

Bullet List

Number List

Text Color

Highlight

Remove Formatting

Cut

Copy

Paste

Find

Undo

Redo

Align Left

Align Center

Align Right

Align Full

Indent

Outdent

Superscript

Subscript

Insert/Edit Link

Remove Link

Direction Left to Right

Direction Right to Left

Line

Horizontal Rule

Insert Nonbreaking Space Character

Toggle Spell Checker

Record from Webcam

Launch Math Editor

https://lms.grantham.edu/webapps/vtbe-tinymce/tiny_mce/plugins/bb_mashup/mashuplogo.pngInsert Mashup

Show Nonprinting Characters

Blockquote

Symbol

Emotions

Anchor

Insert/Edit Table

Table Row Properties

Table Cell Properties

Insert Row Before

Insert Row After

Delete Row

Insert Column Before

Insert Column After

Delete Column

Merge Table Cells

Split Merged Table Cells

HTML Code View

Edit CSS Style

Preview

Help

Full Screen

Show More

Path:

Words:0

10 points  

Question 7

1.  

Evaluate the following expressions as C++ would:

a. 8 * 9 + 2

b. 6 * 3 / 4

c. 3 / 4 * 6

d. 6.0 * 3 / 4

e. 15 % 4

For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). Content Editor

Use arrow keys to select functions

Bold

Italic

Underline

Font family

Font size

Text Color

Bullet List

Number List

Toggle Spell Checker

Insert/Edit Link

Remove Link

Bold

Italic

Underline

Strikethrough

Format

Font family

Font size

Bullet List

Number List

Text Color

Highlight

Remove Formatting

Cut

Copy

Paste

Find

Undo

Redo

Align Left

Align Center

Align Right

Align Full

Indent

Outdent

Superscript

Subscript

Insert/Edit Link

Remove Link

Direction Left to Right

Direction Right to Left

Line

Horizontal Rule

Insert Nonbreaking Space Character

Toggle Spell Checker

Record from Webcam

Launch Math Editor

https://lms.grantham.edu/webapps/vtbe-tinymce/tiny_mce/plugins/bb_mashup/mashuplogo.pngInsert Mashup

Show Nonprinting Characters

Blockquote

Symbol

Emotions

Anchor

Insert/Edit Table

Table Row Properties

Table Cell Properties

Insert Row Before

Insert Row After

Delete Row

Insert Column Before

Insert Column After

Delete Column

Merge Table Cells

Split Merged Table Cells

HTML Code View

Edit CSS Style

Preview

Help

Full Screen

Show More

Path:

Words:0

10 points  

Question 8

1.  

What is the variable type for each of the following declarations?

a. auto cars = 15;

b. auto iou = 150.37f;

c. auto level = 'B';

d. auto crat = U'/U00002155';

e. auto fract = 8.25f/2.5;

For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). Content Editor

Use arrow keys to select functions

Bold

Italic

Underline

Font family

Font size

Text Color

Bullet List

Number List

Toggle Spell Checker

Insert/Edit Link

Remove Link

Bold

Italic

Underline

Strikethrough

Format

Font family

Font size

Bullet List

Number List

Text Color

Highlight

Remove Formatting

Cut

Copy

Paste

Find

Undo

Redo

Align Left

Align Center

Align Right

Align Full

Indent

Outdent

Superscript

Subscript

Insert/Edit Link

Remove Link

Direction Left to Right

Direction Right to Left

Line

Horizontal Rule

Insert Nonbreaking Space Character

Toggle Spell Checker

Record from Webcam

Launch Math Editor

https://lms.grantham.edu/webapps/vtbe-tinymce/tiny_mce/plugins/bb_mashup/mashuplogo.pngInsert Mashup

Show Nonprinting Characters

Blockquote

Symbol

Emotions

Anchor

Insert/Edit Table

Table Row Properties

Table Cell Properties

Insert Row Before

Insert Row After

Delete Row

Insert Column Before

Insert Column After

Delete Column

Merge Table Cells

Split Merged Table Cells

HTML Code View

Edit CSS Style

Preview

Help

Full Screen

Show More

Path:

Words:0

10 points  

Question 9

1.  

Construct logical expressions to represent the following conditions:

a. weight is greater than or equal to 115 but less than 125.

b. ch is q or Q.

c. x is even but is not 26.

d. x is even but is not a multiple of 26.

e. donation is in the range 1,000–2,000 or guest is 1.

For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). Content Editor

Use arrow keys to select functions

Bold

Italic

Underline

Font family

Font size

Text Color

Bullet List

Number List

Toggle Spell Checker

Insert/Edit Link

Remove Link

Bold

Italic

Underline

Strikethrough

Format

Font family

Font size

Bullet List

Number List

Text Color

Highlight

Remove Formatting

Cut

Copy

Paste

Find

Undo

Redo

Align Left

Align Center

Align Right

Align Full

Indent

Outdent

Superscript

Subscript

Insert/Edit Link

Remove Link

Direction Left to Right

Direction Right to Left

Line

Horizontal Rule

Insert Nonbreaking Space Character

Toggle Spell Checker

Record from Webcam

Launch Math Editor

https://lms.grantham.edu/webapps/vtbe-tinymce/tiny_mce/plugins/bb_mashup/mashuplogo.pngInsert Mashup

Show Nonprinting Characters

Blockquote

Symbol

Emotions

Anchor

Insert/Edit Table

Table Row Properties

Table Cell Properties

Insert Row Before

Insert Row After

Delete Row

Insert Column Before

Insert Column After

Delete Column

Merge Table Cells

Split Merged Table Cells

HTML Code View

Edit CSS Style

Preview

Help

Full Screen

Show More

Path:

Words:0

10 points  

Question 10

1.  

Convert the following to a do/while loop. It should produce exactly the same output.

#include

int main(){

int i=0, k=0;

float j=0;

int counter = 10;

printf("Begin counting");

for (i=0; i < counter; i++) {

printf(i);

}

return 0;

}

For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). Content Editor

Use arrow keys to select functions

Bold

Italic

Underline

Font family

Font size

Text Color

Bullet List

Number List

Toggle Spell Checker

Insert/Edit Link

Remove Link

Bold

Italic

Underline

Strikethrough

Format

Font family

Font size

Bullet List

Number List

Text Color

Highlight

Remove Formatting

Cut

Copy

Paste

Find

Undo

Redo

Align Left

Align Center

Align Right

Align Full

Indent

Outdent

Superscript

Subscript

Insert/Edit Link

Remove Link

Direction Left to Right

Direction Right to Left

Line

Horizontal Rule

Insert Nonbreaking Space Character

Toggle Spell Checker

Record from Webcam

Launch Math Editor

https://lms.grantham.edu/webapps/vtbe-tinymce/tiny_mce/plugins/bb_mashup/mashuplogo.pngInsert Mashup

Show Nonprinting Characters

Blockquote

Symbol

Emotions

Anchor

Insert/Edit Table

Table Row Properties

Table Cell Properties

Insert Row Before

Insert Row After

Delete Row

Insert Column Before

Insert Column After

Delete Column

Merge Table Cells

Split Merged Table Cells

HTML Code View

Edit CSS Style

Preview

Help

Full Screen

Show More

Path:

Words:0

10 points  

 Save and Submit

Click Save and Submit to save and submit. Click Save All Answers to save all answers.

essay-ans-_62329

Arial

3 (12pt)

essay-ans-_62329

Paragraph

-- Font family --

-- Font size --

Arial

H

essay-ans-_62329

Arial

3 (12pt)

3 (12pt)

Paragraph

-- Font family --

-- Font size --

H

essay-ans-_62329

Arial

3 (12pt)

Paragraph

-- Font family --

-- Font size --

Paragraph

H

essay-ans-_62329

Arial

3 (12pt)

-- Font family --

Paragraph

-- Font family --

-- Font size --

-- Font size --

H

essay-ans-_62329

Arial

3 (12pt)

Paragraph

-- Font family --

-- Font size --

H

essay-ans-_62329

Arial

3 (12pt)

Paragraph

-- Font family --

-- Font size --

H

essay-ans-_62329

Arial

3 (12pt)

Paragraph

-- Font family --

-- Font size --

H

essay-ans-_62329

Arial

3 (12pt)

Paragraph

-- Font family --

-- Font size --

H

essay-ans-_62329

Arial

3 (12pt)

Paragraph

-- Font family --

-- Font size --

H

H