C++ Exam 1
Which of the following is a preprocessor directive?
#include <iostream>
These are data items whose values do not change while the program is running.
Literals
Mistakes that cause a running program to produce incorrect results are called:
Logic errors
The programmer usually enters source code into a computer using
A text editor
What statement best describes a variable and its primary purpose?
A variable is a named storage location in the computer's memory used for holding a piece of information.
A set of well-defined steps for performing a task or solving a problem is known as a(n):
Algorithm
An Integrated Development Environment typically consists of:
All of these
At the heart of a computer is its central processing unit. The CPU's job is:
All of these
Which of the following is a common input device?
All of these
Of the following, which is a valid C++ identifier?
All of these are valid identifiers.
Which of the following best describes an operator?
An operator allows you to perform operations on one or more pieces of data
These are used to declare variables that can hold real numbers.
Floating point data types
In C++ 11, if you want an integer literal to be treated as a long long int, you can append ________ at the end of the number.
LL
The ________ causes the contents of another file to be inserted into a program.
#include directive
Character constants in C++ are always enclosed in ________.
'single quotation marks'
In a broad sense, the two primary categories of programming languages are:
Low-level and High-level
In memory, C++ automatically places a ________ at the end of string literals.
Null terminator
Characters or symbols that perform operations on one or more operands are:
Operators
Which of the following is not one of the five major components of a computer system?
Preprocessor
A statement that starts with a # symbol is called a:
Preprocessor directive
A(n) ________ is a set of instructions that the computer follows to solve a problem.
Program
This is used in a program to mark the beginning or ending of a statement, or separate items in a list.
Punctuation
The computer's main memory is commonly known as:
RAM
his is a volatile type of memory, used for temporary storage.
RAM
Even when there is no power to the computer, data can be held in:
Secondary storage
The statements written by the programmer are called:
Source code
In the process of translating a source file into an executable file, which of the following is the correct sequence?
Source code, preprocessor, modified source code, compiler, object code, linker, executable code.
This is a complete instruction that causes the computer to perform some action.
Statement
in programming terms, a group of characters inside a set of quotation marks is called a(n):
String literal
This is a set of rules that must be followed when constructing a program.
Syntax
What does the term hardware refer to?
The physical components that a computer is made of
A variable declaration announces the name of a variable that will be used in a program, as well as:
The type of data it will be used to hold
The name for a memory location that may hold data is:
Variable
Programmer-defined names of memory locations that may hold data are:
Variables
The ________ is/are used to display information on the computer's screen.
cout object
During which stage does the central processing unit analyze the instruction and encode it in the form of a number, and then generate an electronic signal?
decode
During which stage does the central processing unit retrieve from main memory the next instruction in the sequence of program instructions?
fetch
A(n) ________ is a diagram that shows the logical flow of a program.
flowchart
Every complete C++ program must have a ________.
function named main
The numeric data types in C++ can be broken into two general categories:
integer and floating point
A variable's ________ is the part of the program that has access to the variable.
scope
A character literal is enclosed in ________ quotation marks, whereas a string literal is enclosed in ________ quotation marks.
single, double
Assuming you are using a system with 1-byte characters, how many bytes of memory will the following string literal occupy?
8
For every opening brace in a C++ program, there must be a
Closing brace
________ are used to translate each source code instruction into the appropriate machine language instruction
Compilers
This step will uncover any syntax errors in your program.
Compiling
The ________ decodes an instruction and generates electrical signals.
Control Unit
Words that have a special meaning and may be used only for their intended purpose are known as:
Key Words
The programming process consists of several steps, which include:
Design, Creation, Testing, and Debugging
This term refers to the programmer reading the program from the beginning and stepping through each statement.
Desk Checking
Besides decimal, two other number systems you might encounter in C++ programs are:
Hexadecimal and Octal
Three primary activities of a program are:
Input, Processing, and Output
Internally, the CPU consists of two parts:
The Control Unit and the Arithmetic and Logic Unit
In a C++ program, two slash marks ( // ) indicate:
The beginning of a comment
An example of a secondary storage device is:
The disk drive
The purpose of a memory address is:
To identify the location of a byte in memory
In C++ 11, the ________ tells the compiler to determine the variable's data type from the initialization value.
auto key word
A variable whose value can be either true or false is of this data type.
bool
Assume that a program has the following variable definition:Which of the following statements correctly assigns the character Z to the variable?
letter = 'Z';
Assume that a program has the following string object definition:Which of the following statements correctly assigns a string literal to the string object?
name = "Jane";
If you use a C++ key word as an identifier, your program will:
not compile
A(n) ________ is the most fundamental set of programs on a computer.
operating system
Computer programs are also known as:
software
The first step in using the string class is to #include the ________ header file.
string