CMPS 221 Homework 1 Spring 2015 Chapter 1 1. 2. 3. 4. 5. 6. 7. Explain the difference between an object file and an executable file. Explain the difference between a syntax error and a logical error. A program is a set of ____________. Words that have special meaning in a programming language are called ____________. Words or names defined by the programmer are called ____________. ____________ are characters or symbols that perform operations on one or more operands. ____________ characters or symbols mark the beginning or ending of programming statements, or separate items in a list. Chapter 2 8. Write assignment statements that perform the following operations with variables a, b, and c: A) Adds 2 to a and stores the result in b B) Multiplies b times 4 and stores the result in a C) Divides a by 3.14 and stores the result in b D) Subtracts 8 from b and stores the result in a E) Stores the value 27 in a F) Stores the character 'K' in c 9. Every complete statement ends with a A) period B) # symbol C) semicolon D) ending brace 10. Which of the following statements is correct? A) #include (iostream) B) #include {iostream} C) #include <iostream> D) #include [iostream] E) All of the above 11. Every C++ program must have a: A) cout statement B) main function C) #include statement D) All of the above Chapter 3 12. Assume that the following variables are defined: int age; double pay; char section; Write a single cin statement that will read input into each of these variables. 13. Write C++ expressions for the following algebraic expressions: 14. The ____________ file must be included in a program that uses the cin and cout functions. 15. The ____________ file must be included in a program that uses the mathematical functions.
© Copyright 2024