Review for Exam 1

¡Supera tus tareas y exámenes ahora con Quizwiz!

A ternary operator has __ operands

3

In the following C++ statement, what will be executed first according to the order of precedence? result = 6 - 3 * 2 + 7 - 10 / 2 ;

3*2

The ________ operator always follows the cin object, and the ________ operator follows the cout object.

>>, <<

Which of these is a secondary storage device?

Hard Disk Drive

These are named storage locations in the computer memory that contain data:

Identifiers

The numeric data types in C++ can be brokin into two general categories:

Int and floating point

Words in a programming language that have a special meaning and may only be used for their intended purpose are known as

Keywords

Microsoft Windows, UNIX, and MacOS are examples of

Operating system

A ______ is a set of instructions that the computer follows to solve a problem

Program

C++, Java, Visual Basic are examples of

Programming Languages

An example of secondary storage device is

The hard drive

What are the two rules that govern the construction of identifiers?

The identifier must not begin with a digit The identifier may only use letters (uppercase or lowercase), digits, and the _ character.

Which of these storage technologies are non-volatile choose all that apply

The main memory in a tablet USB Flash Drive DVD disc (NOT main memory in a desktop computer)

Which of these storage technologies are RAM (Random Access Memory)?

The main memory of a desktop computer The memory in your cell phone a USB "Flash" drive The SIM card in your digital camera

What will the following code display? int number = 42; cout << "The number is " << "number" << endl;

The number is number

If you use a c++ keyword as an identifier, what will happen when you try to compile and execute the program?

The program will not compile

this function tell the cin object to skip over the next character in the keyboard buffer

cin.ignore()

To have access to mathematical functions such as pow(), sqrt(), and tan() you must include this C++ header file.

cmath

System software

consists of the operating system and drivers to manage the computer's hardware

you must have a ___ for every variable you intend to use in a program

declaration, almost every language is typed, meaning that you must associate your identifiers with data types before you can use them.

Which of the following defines a double-precision floating point variable named payCheck

double payCheck

A string literal is indicated by ___

double quotes like this: "abc"

This stream manipulator forces cout to print floating-point values in exponential notation.

exp

A variable called "average" should be declared as data type int because it will probably only hold data that contains decimal places

false

Arithmetic operators that share the same precedence are processed from right to left

false

If you do not follow a consistent programming style, your programs will generate compiler errors

false

If you want to know the length of the string that is stored in a string object, you can call the object's size member function.

false

The c++ language requires that you give variable names that indicate what the variables are used for.

false

The sequence of statements double dollars = 5; cout << setprecision(5) << dollars << endl; will output $5.00 to the screen.

false

When a program uses the setw manipulator, the iosetwidth header file must be included in a preprocessor directive.

false, <iomanip>

the stream manipulator forces cout to print floating-point values in decimal notation

fixed

___ reads a line of input, including leadinga nd embedded spaces, and stores it in a string object

getline

Which statement will read an entire line of input from the keyboard into the following string object? string address;

getline(cin,address);

Names that are defined by the programmers are

identifiers

This stream manipulator forces cout to right-justify the next item of output in the current field.

right

Every complete statement in C++ ends with a

semicolon;

This stream manipulator forces cout to show decimal point in floating point number even if they are really int values

showpoint

A character literal is indicated by

single quotes, like this : 'a'

A computer program is a set of

statements

The set of rules that must be followed when constructing a program is called

syntax

An error created because the programmer violate the rules of grammar or syntax in the language is a

syntax error

When the final value of an expression is assigned to a variable it will be converted to:

the data type of the destination variable

__ must be included in any program that uses the cout object

the iostream header file

Application software

the programs that allow us to make use of the computer to do something useful or fun

A variable must be declared before it can be used on a program

true

Escape sequences are always stored internally as a single character

true

The cin << statement will stop reading input when it encounters a newline character.

true

When typing your source code into the computer, you must be very careful since c++ instructions, header files, and variable names are case sensitive

true

C++ does not have a built in data type for storing strings of characters

true (There is no support for strings in the core language- we must bring in the 'string' library to include this data type in our programs.)

You can use these to override the rules of operator precedence in a mathematical expression

(parentheses)

In a c++ program comments are indicated by

// double slash /* slash star and star slash like this */

What will the following code display? int x = 0, y = 1, z = 2; cout << x << y << z << endl;

012

What is the value of average after the following code executes? double average; average = ( 1.0 + 2.0 + 3.0 ) / 3.0;

2.0

Which 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

Internally, the CPU (central Processing Unit) consists of two parts

ALU Control Unit

ALU

Arithmetic Logic Unit, performs any arithmetic computations that may be required

The job of ______ is to fetch instructions and operands, execute the instructions, and store the result

CPU

The job of the _____ is to fetch instructions, carry out the operations commanded by the instructions, and produce some outcome and store the result

CPU

CPU

Central Processing Unit executes the programs and produces the desired results

Even when there is no power to the computer, data can be held in:

Secondary storage

Which of the following are binary operators?

Subtraction addition

The two general categories of computer software are

System software Application software

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 - in typed languages the variable must be associated with a data type before it can be used

A CPU only understands instructions that are written in machine language

True

The negation operator (such as the - in -42) is a __ operator

Unary- only have one operand

__ represents storage locations in the computer's memory

Variables

A c/C++ preprocessor directive is indicated by ___

a hashtag like this: #abc

What can't an identifiers have in C++

a number at the beginning spaces symbols like * & $ @

A set of well-defined steps for performing a task or solving a problem is known as a(n)

algorithm

What does "Random Access" mean?

any location in memory can be accessed in one "addressing cycle" regardless of location. Think of this as the opposite of "Sequential Access" memory. Virtually all electronic memory since the 1970s has been "random access" memory.

in programming two number bases that are frequently encountered (other than decimal) are

binary (base 2) Hexadecimal (base 16)

You want the user to enter the length, width, and height from the keyboard. Which cin statement accomplishes this?

cin >> length >> width >> height;

The primary activities of a program are:

input, processing, and output

This stream manipulator forces cout to left-justify the next item of output in the current field.

left

Assume the program has the following variable definition: char letter; which of the following statements correctly assigns the character Z to the variable?

letter = 'Z';

An error that causes the program to produce incorrect or unexpected results is a

logical error

Every c++ program must include a

main function

An example of a primary storage device is:

main memory

sequential access

must be traversed from beginning until the desired location is reached, so the time required to obtain the desired information is dependent on the location within memory.

Assume that a program has the following string object definition string name; which of the following correctly assigns a string literal to the string object?

name = "Jane"

Which statement is equivalent to the following number += 1;

number = number +1

Characters or symbols that perform operations on one or more arguments are

operators

___ perform operations on one or more operators

operators

A _______ is a set of instructions that the computer follows to solve a problem

program

Computers can perform many different tasks because they can be

programmed

escape sequences

used to construct a single character that can't be generated directly from the keyboard. Escape sequences are used to construct single characters that can't be generated directly from the key board.

When a computer loses its contents when power is removed, we say that memory is

volatile

When computer memory loses its contents when power is removed, we say that the memory is

volatile- its a side effect of the technology that makes desktop computer memory as fast as possible


Conjuntos de estudio relacionados

Networking Questions: Ethernet Concepts

View Set

Maternal Child Nursing Chapter 37 Impact of Cognitive and Sensory Impairment on the Child and Family

View Set

TBS - Phase 1 Exam (Study Guide)

View Set