cmpr 120

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/118

flashcard set

Earn XP

Description and Tags

Yes

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

119 Terms

1
New cards

a binary digit

is a zero or a one

2
New cards

source code

The code that a programmer writes is

3
New cards

object code

compilers translate the instructions written by the program into

4
New cards

CPU

when a program runs on a computer, the part of the computer that carries out the instructions

5
New cards

software engineering is a field that encompasses designing, writing, testing, debugging, documenting, modifying, and maintaining computer programs.

true

6
New cards

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

false

7
New cards

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

true

8
New cards

the preprocessor executes after the compiler

false

9
New cards

machine language is an example of a high-level language

false

10
New cards

programs are often referred to as hardware

false

11
New cards

programming style refers to the way a programmer uses elements such as identifiers, spaces, and blank lines.

true

12
New cards

RAM is a volatile type of memory that is used for temporary storage

true

13
New cards

an input device can sometimes be an output device too

true

14
New cards

C++ is a specific purpose programming language

false

15
New cards

every C++ program must have a main function

true

16
New cards

the following code is a correct layout of a main function:

int main()
{

return 0;
}

true

17
New cards

in C++ rules of making identifiers, you are required to name your identifiers so they indicate the purpose for which they will be used for

false

18
New cards

there are eight bits in one byte. each bit stands for a binary digit. a binary digit is 0 or 1.

true

19
New cards

in c++, any Boolean value that is not zero is true.

true

20
New cards

internally, the CPU consists of

control unit and an arithmetic logic unit (ALU)

21
New cards

in the following statement, the characters Hello! are a(n)

string literal

22
New cards

#include directive

causes the content of another file to be inserted into a program

23
New cards

the header file iostream

must be included in any program that uses the cout object

24
New cards
<p></p>

none of these

25
New cards

fetch

the CPU’s control unit retrieves the next instruction in a sequence of program instructions from main memory in this stage

26
New cards
<p></p>

Roses are redand violets/nareblue

27
New cards

a variable definition tells the computer

the variable’s name, the type of data it will hold, and its value

28
New cards

requirements for identifiers:

  • the first character must be one of the letters a through z, A through Z, or an underscore character (_)

  • after the first character, you may use letters a through z or A through Z, the digits 0 through 9, or underscores.

  • uppercases and lowercase characters are distinct.

29
New cards

program

a set of instructions that the computer follows to solve a problem

30
New cards
term image

none of these (correct answer is unsigned int value = 100;)

31
New cards
<p>What will be the output after the following lines of code execute?</p>

What will be the output after the following lines of code execute?

Your choice is1

32
New cards

What is the value of number after the following statements execute?

int number;

number = 18 / 4;

4

33
New cards
<p>Given the following program, which line(s) cause(s) output to be displayed on the screen?</p>

Given the following program, which line(s) cause(s) output to be displayed on the screen?

line 16

34
New cards
<p>Suppose that the code segment in the below box were executed. What would be the value of z?</p>

Suppose that the code segment in the below box were executed. What would be the value of z?

1

35
New cards

C++ is a general purpose programming language

true

36
New cards

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

37
New cards

the cin» statement will stop reading input when it encounters a newline character

true

38
New cards

if you want to know the length of the string that is stored in a string object, you can call the object’s sizeof() function

false

39
New cards

logic errors are discovered and reported by the compiler

false

40
New cards

some c++ programs may not have a main function

false

41
New cards

an identifier is a name that we assign to variables, constants, functions, classes, etc.

true

42
New cards

in c++,you are required to name your variables so they indicate the purpose they will be used for

false

43
New cards

int 88 = myValue; // This is a valid variable definition in C++

false

44
New cards

the if statement in c++ can exist without an else statement

true

45
New cards

if the expression on the left side of the following is true, the expression on the right side will not be checked

(a > = b) || (c == d)

true

46
New cards

a variable must have a valid name and data type

true

47
New cards

int dimes = 10, quarters = 25; // This is a valid c++ code

true

48
New cards

you should be careful when using the equality operator to compare floating point values because of potential round-off errors

true

49
New cards

for every open bracket, parentheses, and braces we must have a closing bracket, parentheses, and braces.

true

50
New cards

in c++, the two greater than symbol » is called stream insertion operator and is normally used with a cout statment.

false

51
New cards

the value of result in the following expression will be 0 if x has the value of 12.

result = x > 100 ? 0 : 1;

false

52
New cards

floating numbers are signed and unsigned

false

53
New cards

for compatibility purposes with C, false has a zero value and true is anything that is not zero

true

54
New cards

the purpose of a memory address is:

to identify the location of a byte in memory

55
New cards

Which of the following is not one of the major components of a computer system?

Secondary Storage
Main Memory
Input / Output Devices
The CPU
The preprocessor

The preprocessor

56
New cards

in the process of translating a source file into an executable file, which of the following is the correct sequence?

Source code, compiler, assembler, preprocessor, loader, linker.

Preprocessor, source code, compiler, assembler, linker, loader

Source code, preprocessor, compiler, assembler, linker, loader

Source code, preprocessor, assembler, linker, compiler, loader

None of these

Source code, preprocessor, compiler, assembler, linker, loader

57
New cards

variable

a named storage location in the computer’s memory that holds a piece of information

58
New cards

cout « endl; , cout « ‘\n’; , cout « “\n”;

will advance the output in a cout statement

59
New cards

compare numbers

relational operators allow you to

60
New cards
<p>After the following code executes, what is the value of <strong>myValue </strong>if the user enters <strong>0</strong>?</p>

After the following code executes, what is the value of myValue if the user enters 0?

15

61
New cards
term image

None of these

62
New cards

program

a set of instructions that the computer follows to solve a problem

63
New cards

type conversion

when c++ is working with an operator, it strives to convert operands to the same type

64
New cards
term image

x<= y

65
New cards

what is the value of x after the following statements is executed?

int x = 0, y = 5, z = 10;

0

66
New cards

what is the value of the number after the following statements is executed?

int number;

number = 4 % 18

4

67
New cards

if you intend to place a block of statements within an if statement, you must place ___ around the block

curly braces { }

68
New cards

logical AND

&&

69
New cards

break

without this statement appearing in a switch construct, the program “falls through” all of the statements below the one with the matching case expression

70
New cards

literals or constants

data items whose value do not change while the program is running

71
New cards

a character literal is ______, whereas a string literal is _____

enclosed in single quotation marks, enclosed in double quotation mark

72
New cards

what is the value of x after the following code executes?

int x;

x = 3 / static_cast<int>(4.5 + 6.4);

0

73
New cards
<p><span>The following </span><em>code snippet&nbsp;&nbsp;</em><span>has an error. The program is supposed to ask the user for the length and width of a rectangular room, and then display the room’s area. The program must multiply the width by the length in order to determine the area. Find the error</span></p>

The following code snippet  has an error. The program is supposed to ask the user for the length and width of a rectangular room, and then display the room’s area. The program must multiply the width by the length in order to determine the area. Find the error

The error is in line 14 and line 19.

74
New cards
<p>The following program has one or more errors. Find the error.</p>

The following program has one or more errors. Find the error.

All the lines have at least one error.

75
New cards
<p><span>Examine the following program and determine if there is an error. If there is an error, please select the line where you believe there is an error.</span></p>

Examine the following program and determine if there is an error. If there is an error, please select the line where you believe there is an error.

The error is in line 7.

76
New cards
<p><span>Examine the following program and determine if there is an error. If there is an error, please select the line where you believe there is an error.</span></p>

Examine the following program and determine if there is an error. If there is an error, please select the line where you believe there is an error.

The error is in line 7.

77
New cards
<p><span>Examine the following program and determine if there is an error. If there is an error, please select the line where you believe there is an error.</span></p>

Examine the following program and determine if there is an error. If there is an error, please select the line where you believe there is an error.

The error is in line 23.

78
New cards

Examine the following algorithm:

The variable x starts with the value 0.

The variable y starts with the value 5.

Add 1 to x .

Add 1 to y .

Add x and y , and store the result in y .

Subtract 3 from y .

Display the value in x on the screen.

What would be displayed on the screen if this was an actual program?

1

79
New cards
<p><span>Examine the following code and determine the output of the program. What would be displayed on the screen once the program runs.</span></p>

Examine the following code and determine the output of the program. What would be displayed on the screen once the program runs.

Syntax Error

80
New cards
<p>Examine the following code and determine the output of the program:</p><p><br><span>What would be displayed on the screen if this was an actual program?</span></p>

Examine the following code and determine the output of the program:


What would be displayed on the screen if this was an actual program?

4

81
New cards
<p>Examine the following code and determine the output of the program:</p><p><br>What would be displayed on the screen if this was an actual program?</p>

Examine the following code and determine the output of the program:


What would be displayed on the screen if this was an actual program?

0

82
New cards
<p>Examine the following code and determine the output of the program:</p><p><br>What would be displayed on the screen if this was an actual program?</p>

Examine the following code and determine the output of the program:


What would be displayed on the screen if this was an actual program?

Santiago Canyon College is Proud of You!

83
New cards

output devices

a piece of computer hardware that displays or presents information to the user after it has been processed by the computer

84
New cards

bit

a binary digit, like 0 or 1

85
New cards

address

a byte in memory is identified by a unique number

86
New cards

key words

words that have a special meaning in a programming language

87
New cards

comment

uses // & can be anything the programmer wants to right

88
New cards

preprocessor

starts with # & directives carried out before the compiler

89
New cards

word in the brackets

a file containing code that is copied into the program at that point.

90
New cards

include<iostream> must be added before line 5

You are given a program designed to print out “Hello there!” on the screen. However, the #include directive allowing the use of IO objects such as cin and cout is missing. Where would you add the preprocessor directive (#include <iostream>)?

<p>You are given a program designed to print out “Hello there!” on the screen. However, the #include directive allowing the use of IO objects such as cin and cout is missing. Where would you add the preprocessor directive (#include &lt;iostream&gt;)?</p>
91
New cards
<p>Which of the following is NOT a legal identifier in C++?</p>

Which of the following is NOT a legal identifier in C++?

None of these

92
New cards
<p><span>How may the <strong>double </strong>variables <strong>temp</strong>, <strong>weight</strong>, and <strong>age</strong> be defined in one statement?</span><br></p>

How may the double variables temp, weight, and age be defined in one statement?

double temp, weight, age;

93
New cards

What type of comment is the following:

/* This program was written by M. A. Codewriter */

multi-line comment

94
New cards

Assume result = 0, w=5, x=4, y=8. what value will be stored in result after the following statement is executed.

 

result = w % x + y;

9

95
New cards

 What is the correct way to take an integer input using cin?

 

int number; cin >> number;

 

cin >> int number;

 

cout >> number;

 

cin >> number;

 

None of these

int number; cin » number;

96
New cards
<p><span>What will be the output of the following program if the user enters </span><code>10 3.5 B</code><span>?</span></p>

What will be the output of the following program if the user enters 10 3.5 B?

You are 10 years old, 3.5 meters tall, and your first initial is B

97
New cards
<p>What will be the value of <code>result</code> after running the following code?</p>

What will be the value of result after running the following code?

3

98
New cards

the == operator is used to assign a value to a variable

false

99
New cards

relational operators always return a boolean value (true or false)

yes

100
New cards

In an if statement, the condition inside the parentheses must be a boolean expression.

true