Test questions Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

[T/F]

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

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

[T/F]
Software engineering is a field that encompasses designing, writing, testing, debugging, documenting, modifying, and maintaining computer programs

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

[T/F]

Machine language is an example of a high-level language

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

[T/F]

In programming, the terms “line” and “statement” always mean the same thing

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

[T/F]

Pseudocode is a form of program statement that will always evaluate to “false”

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

[T/F]

Escape sequences are always stored internally as a single character

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

[T/F]

The cin &laquo_space;statement will stop reading input when it encounters a newline character

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

[T/F]

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

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

[T/F]

The C++ language requires that you give variables names that indicate what the variables are used for

A

false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

[T/F]

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

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

[T/F]

The preprocessor executes after the compiler

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

[T/F]

Floating point constants are normally stored in memory as doubles

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

[T/F]
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.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

[T/F]

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

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

[T/F]
A variable called “average” should be declared should be declared as an integer data type because it will probably hold data that contains decimal points

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

You want the user to enter the length, width, and height from the keyboard. What would be the correct cin statement?

A

cin.get(length, width, height)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

This term refers to the programmer reading the program from the beginning and stepping through each statement

A

desk checking

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

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

A

syntax

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

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

A

low-level and high-level

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

An integrated Development Environment typically consists of:

A

a text editor, a debugger, and a compiler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What will the following code display:

int number = 7;
cout &laquo_space;“The number is “ &laquo_space;“number” &laquo_space;endl;

A

The number is number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

The _____ causes a program to wait until information is typed at the keyboard and the enter key is presses

A

cin object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

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

A

fetch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

The purpose of a memory address is:

A

To identify the location of a byte in memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

In the following C++ statement, what will be executed first according to the order of precedence?

6 - 3 * 2 + 7 - 10 / 2

A

3 * 2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

Internally, the CPU consists of two parts:

A

the control unit and the arithmetic and logic unit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

This is used in a program to mark the beginning or ending of a statement, or separate items in a list

A

punctuation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

Mistakes that cause a running program to produce incorrect results are called:

A

logic errors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

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?

A

2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

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

A

bool

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

What will be the value of x after the following statements execute?
int x;
x = 18.0 / 4;

A

4.5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

This is a volatile type of memory, used for temporary storage.

A

RAM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

Three primary activities of a program are:

A

input, processing, and output

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

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

A

cstdlib

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

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

A

null terminator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

A variable’s ______ is the part of the program that has access to the variable

A

scope

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

In the process of translating a source file into an executable file, what is the correct sequence?

A
source code,
preprocessor,
modified source code,
compiler,
object code, 
linker, 
executable code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

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

A

statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

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

A

cmath

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

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

A

fixed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

How would you consolidate the following declaration statements into one statement:
int x = 7;
int y = 16;
int z = 28;

A

int x = 7, y = 16, z = 28;

42
Q

Computer programs are also known as :

A

software

43
Q

The name for a memory location that may hold data is :

A

variable

44
Q
Which line in the following program will cause a compiler error?
1 #include 
2 using namespace std;
3 
4 int main( )
5 {
6   const int MY_VAL;
7   MY_VAL = 77;
8    cout
A

6

45
Q

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

A

left

46
Q

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

A

literals

47
Q

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

A

definition

48
Q

Describe an operator

A

an operator allows you to perform operations on one or more pieces of data

49
Q

[T/F]

If the sub-expression on the left side of the || operator is true, the expression on the right side will not be checked

A

True

50
Q

[T/F]

12.5 could be a valid constant for a switch statement

A

False

51
Q

[T/F]

An expression that has any value other than 0 has a boolean value of true

A

true

52
Q

[T/F]

A for loop is somewhat limited, because the counter can only be incremented by one each time through the loop

A

False

53
Q

[T/F]

An initialization expression may be omitted from the for loop if no initialization is required

A

True

54
Q

[T/F]

You may not use the break and continue statements within the same set of nested loops

A

False

55
Q

[T/F]

It is possible to define a file stream object and open a file in one statement.

A

True

56
Q

[T/F]

A parameter is a special-purpose variable that is declared inside the parentheses of a function header.

A

True

57
Q

[T/F]

A function’s return data type must be the same as the function’s parameter(s).

A

False

58
Q

Relational operators allow you to ______ numbers.

A

Compare

59
Q

When a relational operator is false, it has the value ______.

A

zero

60
Q

When an if statement is placed within the conditionally- executed code of another if statement, this is known as:

A

nesting

61
Q

This operator takes an operand and reverses its truth or falsehood:

A

!

62
Q

This statement lets the value of a variable or expression determine where the program will branch to:

A

switch

63
Q

The ______ of a variable is limited to the block in which it is declared

A

scope

64
Q

The operand of an increment operator can be:

A

an Ivalue

65
Q

This operator increments the value of its operand, then uses the value in context

A

prefix increment

66
Q

a for statement contains three expressions: initialization, test, and

A

incrementation

67
Q

To allow file access in a program, you must #include this header file.

A

fstream

68
Q

This statement may be used to stop a loop’s current iteration and begin the next one:

A

continue

69
Q

To allow file access in a program, you must #include this header file:

A

fstream

70
Q

To write data to a file, you define an object of this data type:

A

ofstream

71
Q

This is a collection of statements that performs a specific task:

A

function

72
Q

A function _____ contains the statements that make up the function

A

definition

73
Q

A function can have zero to many parameters, and it can return this many values:

A

only one

74
Q

The default section of a switch statement performs a similar task as the ______ portion of an if/else if statement

A

trailing else

75
Q

[T/F]

A local variable and a global variable may not have the same name within the same program

A

false

76
Q

[T/F]

Local variables are initialized to zero by default

A

False

77
Q

[T/F]
Assume array1 and array2 are the names of arrays. To assign the contents of array2 to array1, you would use the following statement:
array1 = array2;

A

False

78
Q

[T/F]

If you attempt to store data past an array’s boundaries, it is guaranteed that the compiler will issue an error

A

False

79
Q

[T/F]

The bubble sort is an easy way to arrange data into ascending order, but it cannot arrange data into descending order

A

False

80
Q

[T/F]
In the average case, an item is just as likely to be found near the beginning of an array as near the end, if data is unsorted

A

True

81
Q

[T/F]
C++ does not perform array bounds checking, making it possible for you to assign a pointer the address of an element out of the boundaries of an array

A

True

82
Q

Unlike regular variables, these can hold multiple values

A

vectors and arrays

83
Q

The individual values contained in arrays are known as:

A

elements

84
Q

The statement

int grades [ ] = { 100, 90, 99, 80};

shows an example of:

A

implicit array sizing

85
Q

The name of an array stores the ______ of the first array element

A

memory address

86
Q

A two-dimensional array can be viewed as ______ and _______.

A

rows, columns

87
Q

If you leave out the size declarator in an array definition:

A

You must furnish an initialization list

88
Q

When writing function that accept multi-dimensional arrays as arguments, _____ must be explicitly stated in the parameter list

A

all but the first dimension

89
Q

An array’s size declarator must be a(n) ______ with a value greater than ______.

A

constant integer expression, zero

90
Q

Arrays must be ______ at the time they are ______

A

initialized, declared

91
Q

A ______ algorithm is a method of locating a specific item of information in a larger collection of data

A

search

92
Q

The advantage of a linear search is :

A

simplicity

93
Q

The ______ sort usually performs fewer exchanges than the ______.

A

selection, bubble

94
Q

A two-dimensional array can have elements of ______ data type(s)

A

one

95
Q

The ______ is automatically appended to a character array when it is initialized with a string constant

A

null terminator

96
Q

an array with no elements is:

A

Illegal in C++

97
Q

It is ______ to pass an argument to a function that is an individual array element, such as numbers[3].

A

legal in C++

98
Q

With pointer variables, you can ______ manipulate data stored in other variables

A

indirectly

99
Q

When you work with a dereferenced pointer, you are actually working with:

A

The actual value of the variable whose address is stored in the pointer variable

100
Q

A pointer may be initialized with:

A

the address of an existing object

101
Q

When the less than operator ( < ) is used between two pointer variables, the expression is testing whether:

A

the address of the first variable comes before the address of the second variable in the computers memory

102
Q

What is true of global variables?

A

A global variable can have the same name as a variable that is declared locally within a function