Quiz 1 CSCI 240

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/11

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

12 Terms

1
New cards

Most lines in a C++ program end with a

; (semi-colon)

2
New cards

main() marks the beginning of a C++ program. What C++ reserved word precedes it?

int

3
New cards

What is the correct way to declare an integer variable named "score"?

int score;

4
New cards
  1. Given the following declaration:

    double x;

    What is the value of x?

garbage

5
New cards

According to the lecture notes, the two main conceptual components of a program are _____ and _____.

data and instructions

6
New cards
  1. Given the following:

  double price = 30.00;
  double tax   = 1.80;
  double sum;

  sum = price + tax;

Explain in detail what the last line does in terms of variables, calculations, and assignment of values.

The last line takes the variables price and tax, adds them together, and saves the result in the variable sum.

7
New cards

When you write an illegal C++ statement and try to compile and run the program, you will get a

compile error

8
New cards

What is the value (in C++) of the expression 4 / 2 * 2?

4

9
New cards

What is the value (in C++) of the expression 3/2?

1

10
New cards

Which data type has the largest range?

double

11
New cards

About how many decimal places of accuracy does a float have?

6

12
New cards
  1. Modify (rewrite) the following instruction so that the subtraction is evaluated first:

    i = a * b / c - d;

i = a * b / (c - d);