Chapter 3 Review, CSC 134, Ch. 4

Ace your homework & exams now with Quizwiz!

Camel case means capitalizing the entire name of a variable or named constant ( T or F )

False

If the value's data types does not match the memory location's data type, the computer uses a process called explicit type conversion to convert the value to fit the memory location ( T or F )

False

Number are represented in memory using the decimal number system ( T or F )

False

What happens in C++ when a real number is converted from one data type to another data type that can store only smaller numbers? Are there any potential consequences from this occurring? If so, please give an example.

It is demoted, yes it can completely change a numbers value and mess up the entire program. If you give the value 7.2 but put it in and integer syntax it is going to be demoted to 7.

Why are the names given to named constants usually spelled in all capitals in C++?

So you can tell it is a constant.

When declaring a named constant, the _________ keyword indicates that the memory location being declared cannot be changed during runtime.

const

Which stream manipulator can be used to advance the cursor to the next line on the computer screen?

endl

In C++, which file contains all of the machine code necessary to run a program as many times as desired without the need for translating the program again?

executable file

Explicit type conversion is accomplished in C++ with which of the following operators?

static_cast

What type of objects are used in C++ to handle standard input and output operations?

steam

Which of the following is defined in C++ as a sequence of characters?

stream

Which C++ program instruction will subtract a value of 3 from the sum variable?

sum -= 3;

What type of error occurs when you break one of the programming language's rules?

syntax

What can be used to provide a convenient way to merge the source code from one file with the source code in another file, without having to retype the code?

the #include directive

What is used to tell the compiler where it can find the definitions of keywords and classes?

using directive

What symbol is used in C++ for the modulus operator?

%

What extension does a source file name have?

.cpp

To insert a comment into a C++ program you begin the line with which of the following?

//

The proper initial value for a variable declared to be of the float data type would be ________.

0.0

What is the binary equivalent of the decimal number 7

0111

In all number systems, the result of raising the base number to the 0th power is _______.

1

Memory locations assigned the char data type can store ______ character(s).

1

The short data type can store a number in the range from -32,768 to +32,767. How many bytes of memory is required for the short data type?

2

​Given the following code, what is the final value of the variable gpa? ​ int gpa; int numclasses = 3; int class1 = 4; int class2 = 2; int class3 = 3; gpa = (class1 + class2 + class3)/numclasses;

3.0

What is the decimal equivalent of the binary number 110?

6

When creating a program using C++, which symbol is used for the insertion operator?

<<

When creating an assignment statement, which symbol is used for the assignment operator?

=

In C++, which symbol is used for the extraction operator?

>>

________ is a coding scheme that assigns a specific numeric code to each character on your keyboard.

ASCII

The name of a memory location in C++ can be a keyword ( T or F )

False

The name of a memory location in C++ can contain a space ( T or F )

False

The string data types is an example of a fundamental data type in C++

False

The value of a named constant is allowed to change during runtime ( T or F )

False

User-defined data types are the basic data types built into the C++ language ( T or F )

False

When naming a memory location in C++, names are not case sensitive ( T or F )

False

_______ refers to the rules of a programming language.

Syntax

A keyword is a word that has special meaning in the programming language in which you are using ( T or F )

True

A variable is a memory location whose value can change during runtime ( T or F )

True

Another name for fundamental data types are primitive data types ( T or F )

True

In C++, the float and double variable data types are used to store real numbers ( T or F )

True

The name of a memory location in C++, names must begin with a letter ( T or F )

True

The term syntax refers to the rules of a programming language ( T or F )

True

What is the primary difference between a variable and a named constant in C++?

Variables can change during runtime while named constants cannot.

Which of the following would be an invalid name for a memory location in C++? (write the correct letter for answer) a. 2ndname b. CiTy c. middle_name d. zip3Code

a

Which of the following data types can contain a real number? (write the correct letter for answer) a. int b. float c. bool d. char

b

Data is stored in memory using the _________ number system.

binary

What is the code contained between a function's opening and closing braces known as?

body

All of the following are fundamental data types except _________. (write the correct letter for answer) a. short b. char c. string d. bool

c

Which of the following would be a valid name for a memory location in C++? (write the correct letter for answer) a. my.name b. 3oreos c. alB2c3D4 d. me&you

c

Which of the following would be a valid string literal constant? (write the correct letter for answer) a. string b. 'name' c. "string" d. empty string

c

When a variable's name contains two or more words, most C++ programmers enter the name using _________ ___________.

camel case

Which object tells the computer to pause program execution while the user enters one or more characters at the keyboard?

cin

All of the following are rules for naming a memory location in C++ except _________. ( write the correct letter for answer ) a. the name must begin with a letter b. the name cannot contain spaces c. the name cannot be a keyword d. names in C++ are not case sensitive

d

The ASCII value of the number zero would be _________. (write the correct letter for answer) a. 0 b. 0.0 c. either a or b d. none of the above

d

Which of the following is a string literal constant? (write the correct letter for answer) a. "" b. "&" c. "Hello" d. all of the above

d

Which of the following is a valid integer value? (write the correct letter for answer) a. 5.132456e+03 b. '9' c. 16.2 d. -123

d

When a numeric value is converted from one data type to another data type that can store smaller numbers, the value is said to be _________.

demoted

All numeric literal constants with a decimal place are treated as the ________ data type.

double

What is the first line in a function called?

header

If the value's data type does not match the memory location's data type, the computer uses a process called _______ to convert the value to fit the memory location.

implicit type conversion

Assigning a beginning value to a memory location is referred to as _________.

initializing

Which file must be included in any program that uses the cin or cout objects?

iosteam

A _________ is a word that has a special meaning in the programming language you are using.

keyword

Which development component combines the object file with other machine code necessary for your C++ program to run correctly?

linker

A ________ __________ is not a memory location; rather, it is an item of data that can appear in a program instruction and can be stored in a memory location.

literal constant

What type of error is often difficult to find, and can occur for many reasons, such as entering instructions in the incorrect order?

logic

A ________ is a memory location whose value cannot change during runtime.

named constant

When a numeric value is converted from one data type to another data type that can store larger numbers, the value is said to be _______.

promoted

A character literal constant is a single character enclosed in _________ quotation marks.

single

The original program instructions entered into an editor is known as which of the following?

source code

A ________ is a memory location whose values can change during runtime.

variable

The extraction operator stops removing characters from the cin object when it encounters which of the following?

white-space character

​Examine the following code. What type of error do you find and what is the correct line of code if the goal of the program is to calculate a grade point average from the point values of three classes? ​ int gpa; int numclasses = 3; int class1 = 4; int class2 = 2; int class3 = 3; gpa = (class1 + class2) + class3/numclasses;

​logic error, gpa = (class1 + class2 + class3)/numclasses;


Related study sets

Intro to Religion EXAM 2-PowerPoint Questions

View Set

Economics Today The Macro View Ch.5 Public Spending and Public Choice

View Set

Individual Health Insurance Policy General Provisions

View Set

O' MEARA CHAPTER 18- THE NEWBORN

View Set

BIOL-1308-E90 Chs. 7 & 8 Homework

View Set

Abeka Grade 8 America Land I Love Test 9

View Set