Intro to Programming Fundamentals Exam 1

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

The statement: cin >> setw(10) >> str; will read up to this many characters into str.

Ten

An Integrated Development Environment typically consists of:

Text editor, compiler, debugger

True/False: The cin << statement will stop reading input when it encounters a newline character.

True

True/False: The only difference between the get function and the >> operator is that get reads the first character typed, even if it is a space, tab, or the [Enter] key.

True

True/False: When C++ is working with an operator, it strives to convert the operands to the same type.

True

True/False: When the fixed manipulator is used, the value specified by the setprecision manipulator will be the number of digits to appear after the decimal point.

True

True/False: When writing long integer literals or long long integer literals in C++ 11, you can use either an uppercase or lowercase L.

True

Programmer-defined names of memory locations that may hold data are:

Variables

________ represent storage locations in the computer's memory.

Variables

Which character signifies the beginning of an escape sequence?

\

Which escape sequence causes the cursor to move to the beginning of the current line?

\r

The ________ decodes an instruction and generates electrical signals.

control unit

The ________ is/are used to display information on the computer's screen.

cout object

To use the rand() function, you must #include this header file in your program.

cstdlib

Besides decimal, two other number systems you might encounter in C++ programs are:

hexadecimal and octal

In any program that uses the cin object, you must include the ________.

iostream header file

This manipulator causes the field to be left-justified with padding spaces printed to the right.

left

Associativity is either right to left or:

left to right

In a broad sense, the two primary categories of programming languages are:

low-level and high-level

The float data type is considered ________ precision, and the double data type is considered ________ precision.

single, double

This function in C++ allows you to identify how many bytes of storage on your computer system an integer data value requires.

sizeof

In programming terms, a group of characters inside a set of quotation marks is called a(n):

string literal

The purpose of a memory address is:

to identify the location of a byte in memory

True/False: A preprocessor directive does not require a semicolon at the end.

true

The ________ causes the contents of another file to be inserted into a program.

#include directive

What is the modulus operator?

%

When this operator is used with string operands it concatenates them, or joins them together.

+

These are used to declare variables that can hold real numbers.

- Floating point data types

A statement that starts with a # symbol is called a:

. Preprocessor directive

According to orientation clip what grade do you get for lab assignments missed their due dates?

0

According to orientation clip how many hours is required for successful completion of this course?

180 hours

According to orientation clip how many EXAMs (excluding FINAL) are there in this course?

3

What is the value of number after the following statements execute? int number = 10; number += 5; number -= 2; number *= 3;

39

Which one of the following would be an illegal variable name?

3dGraph

Assuming you are using a system with 1-byte characters, how many bytes of memory will the following string literal occupy? "William"

8

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

>>, <<

In a C++ program, two slash marks ( // ) indicate:

A comment

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

Algorithm

_______________ 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

True/False: A variable called "average" should be declared as an integer data type because it will probably hold data that contains decimal places.

False

True/False: Arithmetic operators that share the same precedence have right to left associativity.

False

True/False: If you do not follow a consistent programming style, your programs will generate compiler errors.

False

True/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

True/False: In C++, it is impossible to display the number 34.789 in a field of 9 spaces with 2 decimal places of precision.

False

True/False: The fixed manipulator causes a number to be displayed in scientific notation.

False

During which stage does the central processing unit retrieve from main memory the next instruction in the sequence of program instructions?

Fetch

Three primary activities of a program are:

Input, Processing, and Output

Which is true about the following statement? cout << setw(4) << num4 << " ";

It allows four spaces for the value in the variable num4.

Which line in the following program will cause a compiler error? 1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 const int MY_VAL = 77; 7 MY_VAL = 99; 8 cout << MY_VAL << endl; 9 return 0; 10 }

Line 7

In memory, C++ automatically places a ________ at the end of string literals.

Null terminator

When converting some algebraic expressions to C++, you may need to insert ________ that do not appear in the algebraic expression.

Parenthesis

A(n) ____________ is a set of instructions that the computer follows to solve a problem.

Program

This is a complete instruction that causes the computer to perform some action.

Statement

This is a set of rules that must be followed when constructing a program.

Syntax

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

The data type of the variable

According to orientation clip what happens if you missed an EXAM due to conditions that you could not control?

The final exam can replace the zero

________ must be included in any program that uses the cout object.

The header file iostream

A CPU really only understands instructions that are written in machine language.

True

In C++, key words are written in all lowercase letters.

True

True/False: C++ 11 introduces an alternative way to define variables, using the template key word and an initialization value.

True

True/False: Escape sequences are always stored internally as a single character.

True

True/False: Floating point constants are normally stored in memory as doubles.

True

Of the following, which is a valid C++ identifier? a. Junē997 b. _employee_number c. ___department d. myExtraLongVariableName e. All of the above are valid identifiers.

all

In C++ 11, the ________ tells the compiler to determine the variable's data type from the initialization value.

auto keyword

A variable whose value can be either true or false is of this data type.

bool

You want the user to enter the length, width, and height from the keyboard. Which cin statement is correctly written?

cin >> length >> width >> height;

The ________ causes a program to wait until information is typed at the keyboard and the Enter key is pressed.

cin object

This statement will pause the screen, until the [Enter] key is pressed.

cin.get()

This function tells the cin object to skip one or more characters in the keyboard buffer.

cin.ignore

The function, pow(x, 5.0), requires this header file.

cmath

These are data items whose values do not change while the program is running.

const

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

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

double payCheck

True/False: The C++ language requires that you give variables names that indicate what the variables are used for.

false

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

false

This stream manipulator forces cout to print the digits in fixed-point notation.

fixed

Every complete C++ program must have a ________.

function named main

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

getline(cin, address);

When a variable is assigned a number that is too large for its data type, it:

overflows

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

parenthesis

A variable's ________ is the part of the program that has access to the variable.

scope

This is used to mark the end of a complete C++ programming statement.

semicolon

This manipulator is used to establish a field width for the value immediately following it.

setw

The total number of digits that appear before and after the decimal point is sometimes referred to as:

significant digits and precision

Character constants in C++ are always enclosed in ________.

single quotation marks


Kaugnay na mga set ng pag-aaral

MRU12.2: THE BALANCE OF INDUSTRIES AND CREATIVE DESTRUCTION

View Set

Ch. 30 - Liability of Principals, Agents, and Independent Contractors.

View Set

IS-0200.c Basic Incident Command System for Initial Response, ICS 200

View Set

Chapter 9 - Multinational Corporations Test

View Set