COSC 1550 – Introduction to Programming
Circle the letter of the statement that bests answers/completes each question. Each question is worth three points.
1. Even when there is no power to the computer, data can be retained in:
a. Secondary storage
b. The Input Device
c. The Output Device
2. Words that have a special meaning and may only be used for their intended purpose are known as:
b. Programmer Defined Words
c. Key Words
3. The name for a memory location that may hold data is:
a. Key Word
4. A _____________ is a complete instruction that causes the computer to perform some action.
d. Key Word
5. A variable declaration announces the name of a variable that will be used in a program, as well as:
a. What type of data it will be used to hold
b. The operators that will be used on it
c. The number of times it will be used in the program
d. The area of the code in which it will be used
6. Three primary activities of a program are:
a. Variables, Operators, and Key Words
b. Lines, Statements, and Punctuation
c. Integer, Floating-point and Character
d. Input, Processing, and Output
7. Mistakes that cause a program to produce erroneous results are called:
a. Syntax errors
b. Logic errors
c. Compiler errors
d. Linker errors
8. Computer programs are also known as ___________.
9. _______ is an example of a volatile type of memory, used for temporary storage.
a. A floppy disk
c. A hard disk
10. _____________ involves rules that must be followed when constructing a program.
11. Which of the following is a preprocessor directive?
a. pay = hours * rate;
b. #include <iostream.h>
c. // This program calculates the user's pay.
d. void main(void)
12. The programmer usually enters source code into a computer using:
b. A text editor
c. A hierarchy chart
d. A compiler
13. In a broad sense, the two primary categories of programming languages are:
a. Mainframe and PC
b. Single-tasking and Multi-tasking
c. Low-level and High-level
d. COBOL and BASIC
14. In the process of translating a source file into an executable file, which of the following is the correct sequence?
a. Source code, preprocessor, modified source code, linker,
object code, compiler, executable code.
b. Preprocessor, source code, compiler, executable code,
linker, modified source code, object code.
c. Source code, compiler, modified source code, preprocessor,
object code, linker, executable code.
d. Source code, preprocessor, modified source code, compiler,
object code, linker, executable code.
15. What is the output of the C++ cout instruction?
cout << 15 / 4 * 4 << endl;
16. In programming terms, a group of characters inside a set of double quotation marks is called a:
a. String constant
17. The ________ is used to mark the end of a complete C++ programming statement.
a. Pound Sign
c. Data type
18. Which character signifies the beginning of an escape sequence?
19. If you use a C++ Key Word as an identifier, your program will:
a. Execute with unpredictable results
b. Receive a compiler error
c. Refuse to compile
d. Compile, link, but not execute
20. In the C++ instruction, cookies = number % children;
given the following declaration statement:
int number = 38, children = 4, cookies;
what is the value of cookies after the execution of the statement?
21. This function in C++ allows you to identify how many bytes of storage on your computer system an integer data value requires.
22. Character constants in C++ are always enclosed in ______.
b. "double quotation marks"
d. 'single quotation marks'
23. _______________ are used to declare variables that can hold numbers that contain a decimal point.
a. Integer data types
b. Real data types
c. Floating point data types
d. Long data types
24. The float data type is considered _____ precision, and the double data type is considered _______ precision.
a. single, double
b. float, double
c. integer, double
d. short, long
25. A variable whose value can be either true or false has a data type of:
26. How many bytes of memory are needed to store the literal string "This is a test"?
27. A variable's _____ is the part of the program that has access to the variable.
a. data Type
28. This control sequence is used to skip over to the next horizontal tab stop.
29. Indicate whether the following variable names are valid or invalid. If a variable name is invalid, state the reason why.
30. Show the results that will display on the console, when the following code segments are executed. Show a blank line with a series of dots, such as . . . . . . . .
int year = 2004;
cout << "This year is " << year << endl;
cout << "\nNext year is " << year +1 << endl;
cout << "\n\nThe last year is " << "year + 1" << endl;
double length = 10.0;
double width = 2.0;
double area = 0.0;
cout << "The area of a rectangle is " << area << "\n" << endl;
cout << "The area of this rectangle with a length of "
<< " and a width of "
<< " is " << length* width
bool isEmployed = true;
cout << "It is " << isEmployed << " that I have a job" << endl;