M02 Flashcards
A control structure alters the normal sequential flow of execution in a program.
True
The result of a logial expression cannot be assigned to an int variable, but it can be assigned to a bool variable.
False
In C++, both ! and != are relational operatios.
False
The expression (x >= 0 && x = 100).
False
Suppose P and Q are logical expressions. The logical expression P && Q is true if both P and Q are true.
True
In C++, has a higher precedence than l l .
True
The operator != and == have the same order of precedence.
True
A compound statement functions as if it was a single statement.
True
if the expression is an assert statement evaluates to true, the program terminates.
False
In a __ control structure, the computer executes particular statements depending on some condition(s).
selection
What does
less than or equal to
Which of the following is a relational operator?
a. =
b. ==
c. !
d.
b. ==
Which of the follwing is the “not equal to” relational operator?
a. !
b. l
c. !=
d.
c. !=
Suppose x is 5 and y is 7. Choose the value of the following expression:
(x != 7) && (x
true
Suppose that x is an int variable. Which of the following expressions always evaluates to true?
a. (x > 0) || ( x = 0) || (x == 0)
c. (x > 0) && ( x 0) && (x == 0)
a. (x > 0) || ( x
Which of the following expressions correctly determines that x is greater than 10 and less than 20?
a. 10
c. 10
What is the output of the following C++ code?
int x = 35;
int y = 45;
int z;
if (x > y)
z = x + y;
else
z = y - x;
cout
35 45 10
What is the output of the following code?
if (6 > 8)
{
cout
*
Which of the following will cause a logical error if you are attempting to compare x to 5?
a. if (x = 5)
c. if (x == 5)
d. if (x = 5)
d. if (x = 5)
What is the output of the following code?
char lastInitial = ‘S’;
switch (lastInitial)
{
case ‘A’:
cout
section 5
char lastInitial = ‘A’;
switch (lastInitial)
{
case ‘A’:
cout
section 1
What is the output of the following C++ code?
int x = 55;
int y = 5;
switch (x % 7) { case 0: case 1: y++; case 2: case 3: y = y + 2; case 4: break; case 5: case 6: y = y - 3; }
cout
2
You can disable assert statements by using which of the following?
a. #include
b. #define
c. #clear NDEBUG
d. #define NDEBUG
d. #define NDEBUG
The __ holds the insturctions currently being executed.
IR
The __ carries out all arithmetic and logical operations.
ALU
True or False: All registers proved temporary storage.
True
True or False: All software is written in programming languages.
True
True or False: The screen (such as a touch screen) and keyboard are examples of input devices.
True
True or False: The ALU performs arithmetic operations and finds logical errors.
False
True or False: Analog signals represent information with a sequence of 0s and 1s.
False
True of False: When you compole your program, the compiler not only identifies the logic errors, but also typically suggests how to correct them.
False
True or False: Examples of output devices are the mouse and secondary storage.
False
True or False: Assembly, C, C++, and Java are all high-level languages.
False
True or False: The CPU contains several components, including the CU and ALU.
True
True or False: Programming is a process of problem solving.
True
True or False: In assembly language, an instruction is an easy to remember form called a mnemonic.
True
An __ is 1,024 bytes.
kilobyte
How do you convert a seven bit binary representation of an ASCII character to an eight bit binary representation?
Add zeros in the front so that there is 8 characters
The Finch Robot could be considered an example of an input device, output device, or both?
both
An __ is 1,024 gigabytes.
terabyte