Shared Flashcard Set

Details

midterm
Programming 1 C++ chap.1-5
106
Computer Science
Undergraduate 4
06/25/2013

Additional Computer Science Flashcards

 


 

Cards

Term
______ models software in terms similar to those that people use to describe real-world objects.
Definition
Object-oriented design
Term
the linker links:
Definition
the object code with the external libraries
Term
Which of the following is not one of the six logical units of a computer?
Definition
Printer
Term
Which of the following is not a goal stated by the creator of C++ for the new C++ standard?
Definition
Make C++ an open source programming language
Term
Wich software product release category is "generally feature complete and supposedly bug free, and ready for use by the community?"
Definition
Release candidate
Term
Which of the following data items are arranged from the smallest to the largest in the data hierarchy.
Definition
bits, characters, fields, records, files
Term
The ________ creates object code and stores it on disk.
Definition
complier
Term
Which of the following code segments prints a single line containing hello there with the words separated by a single space?
Definition
std::cout << "hello";
std::cout << "there";
Term
Which of the following statements could potentially change the value of number2?
Definition
std::cin >> number2;
Term
End-of-line comments that should be ignored by the compiler are denoted using:
Definition
Two forward slashes ( // )
Term
The std::endl stream manipulator ________.
Definition
outputs a newline and flushes the oputput buffer
Term
Which of the following is a compilation error?
Definition
all of the above
Term
What will be the output after the following C++ statements have been executed?
int a,b, c, d;
a = 4;
b = 12;
c = 37;
d = 51;
if ( a < b )
cout << "a < b" << endl;
if ( a > b )
cout << "a > b" << endl;
if ( d <= c)
cout << "d <= c' << endl
if ( c != d)
cout << "c != d" << endl;
Definition
a < b
c != d
Term
Which of the following is the escape character?
Definition
\
Term
Which of the following is not a valid C++ identifier?
Definition
my Value
Term
Which of the following does not cause a syntax error to be reported by C++ compiler?
Definition
Extra blank lines
Term
Which is the output of the following statements?

std::cout << "Hello ";
std::cout << "World ";
Definition
Hello World
Term
When compiling a class's source code file (which does not contain a main function), the information in the class's header file is used for all of the following, except
Definition
All of the above are uses that the compiler has for the header file information.
Term
What type of member functions allow a client of a class to assign values of private data members?
Definition
Set member functions
Term
Two adjacent parameters are separated by what symbol?
Definition
comma
Term
Assuming that the string object text contains the string "Hello!!! ", the "expression text.substr( 2 , 5 ) would return a string object containing the string:
Definition
"llo!! "
Term
To execute multiple statements when an if statement's condition is true enclose those statements in a pair of:
Definition
Braces, {}
Term
The compiler will implicitly create a default constructor if:
Definition
the class does not define any constructors
Term
C++ functions other than main are executed:
Definition
when they are explicitly called by another function
Term
Function headers contain all of the following except:
Definition
Left brace
Term
When a client code programmer uses a class whose implementation is a separate file from its interface, that implementation code is merged with the client's code during the:
Definition
linking phase
Term
Assuming that GradeBook.h is found in the current director and the iostream header file is found in the C++ Standard Library header file directory, which of the following preprocessor directives will fail to find its desired header file?
Definition
#include
Term
Which of the following encompasses the other three?
Definition
control structure
Term
Which of the following for headers is not valid?
Definition
for ( int i = 0; int j = 5;; i++ )
Term
Using a while loop's counter-control variable in a calculation after the loop ends often causes a common logic error called:
Definition
An off-by-one error
Term
A switch statement should be used:
Definition
as a multiple-selection structure
Term
In indefinite repetition, an input value:
Definition
should always be evaluated before being processed
Term
Which of the following does counter-controlled repetition require?
Definition
all of the above
Term
If a do... while structure is used:
Definition
the body of the loop will execute at least once
Term
Pseudocode does not include
Definition
declarations
Term
of the following, which is not a logic error?
Definition
using commas instead of the two required semicolons in a for header
Term
Which of the following is false?
Definition
continue and break statements may be embedded only within repetition statements
Term
Which of the following statements is false?
Definition
the Global Positioning System (GPS)uses a network of cellular communications towers to retrieve location-based information.
Term
Which of the following statements is false?
Definition
information in the memory unit is persistent-it is retained when the computer's power is turned off.
Term

Consider the following code, assuming that x is an int with an initial value of 12

 

if( x = 6 )

  cout << x;

 

What is the output?

Definition
6
Term
what type of member functions allow a client of a class to assign values to private data members?
Definition
set member functions
Term
Which software product release category is "generally feature complete and supposedly bug free, and ready for use by the community?"
Definition
release candidate
Term
Which of the following is a poor programming practice?
Definition
Using floating-point values for counter-controlled repetition
Term
_______ involves reworking programs to make them clearer and easier to maintain while preserving their correctness and functionality.
Definition
Refactoring
Term
which of the following statements is true?
Definition
compilers translate high-level language programs into machine language programs
Term
An uninitialized local variable contains:
Definition
the value last stored in the memory location reserved for that variable
Term
Assuming that x is equal to 4, which of the following statements will not result in y containing the value 5 after execution
Definition
y = x++;
Term
which of the following is not one of the C++ control structures?
Definition
break
Term
which of the following operations has the highest precedence?
Definition
postincrement
Term
In the source-code file containing a class's member function definitions, eaach member function definition must be tied to the class definition by preceding the member function name with the class name and ::, which is known as the:
Definition
Binary scope resolution operator
Term
Using a while loop's counter-control variable in a calculation after the loop ends often causes a common logic error called:
Definition
An off-by-one error
Term
in a switch structure:
Definition
Multiple actions in a case do not need to be enclosed in braces
Term
What is the default initial value of a string?
Definition
empty string
Term
The escape sequence for a newline is:
Definition
\n
Term
How many times will the following loop print hello?

i = 1
while ( 1 <= 10 )
cout << "hello";
Definition
An infinite number of times
Term
the assignment operator _____ assigns the value of the expression on its right to the variable on its left.
Definition
=
Term
_____ is a graphical language that allows people who design software systems to use an industry standard notation to represent them.
Definition
the unified modeling languageThe impressive functions performed by computers involve only the simplest manipulations of 1s and 2s.
Term
Which of the following statements is false?
Definition
impressive functions performed by computers involve only the simplest manipulations of 1s and 2s.
Term
_______ models software in terms similar to those that people use to describe real-world objects
Definition
object-oriented design
Term
The _____ creates object code and stores it on disk
Definition
compiler
Term
Which statement is false?
Definition
A class is an instance of its object.
Term
Which of the following statements is false?
Definition
In use today are more that a trillion general-purpose computers and trillions more cellphone, smartphones, and other handheld devices
Term
Which of the following is not one of the three general types of computer languages?
Definition
Spoken languages
Term
Which of the following statements would display the phrase C++ is fun?
Definition
std::cout << "C++ is fun";
Term
What is the value of result after the following C++statements execute?

int a, b, c, d, result;
a = 4;
b= 12; c = 37;
d = 51;
result = d%a*c+b%b+a
Definition
119
Term
In what order would the following operators be evaluated -,*,/,+,%
Assume that if two operations have the same precedence, the one listed first will be evaluated first.
Definition
*,/,%,-,+
Term
A header file is typically given the filename extension
Definition
.h
Term
A constructor can specify the return type:
Definition
A constructor cannot specify a return type
Term
What is the name of the values the method call passes to the method for the parameters?
Definition
Arguments
Term
Attributes of a class are also known as:
Definition
data members
Term
A default constructor has how many parameters?
Definition
0
Term
in indefinite repetition, an input value:
Definition
should always be evaluated before being processed
Term
What is wrong with the following while loop?

while ( sum <= 1000 )
sum = sum - 30
Definition
sum = sum - 30 should be sum = sum + 30 or else the loop may nevre end
Term
a switch statement should be used
Definition
as a multiple-selection structure
Term
which of the following is false?
Definition
you should always try to write the fastest, smallest code possible before attempting to make it simple and correct
Term
Variables are also known as:
Definition
Ivalues, but can be used as rvalues
Term
Which of the following is a paramterized stream manipulator used to format output?
Definition
setw
Term
Which of the following does not perform the following task: display correct if answer is equal to 7 and incorrect if the answer is not equal to 7?
Definition
cout << ( answer == 7 ? "correct" : "incorrect" );
Term
Which of the following statements is false
Definition
windows is an open source operating system
Term
_______ helps internet-based applications perform like desktop applications
Definition
ajax
Term
Which of the following is not a key organization in the open-source community?
Definition
firefox
Term
Which of the following companies is widely regarded as the "signature" company of Web 2.0?
Definition
google
Term
Which of the following is a variable declaration statement?
Definition
int total
Term
Which of the following does not cause a syntax error to be reported by the C++ compiler?
Definition
extra blank lines
Term
Which of the following statements does not overwrite a preexisting value stored in a memory locations?
Definition
int a
Term
In the UML, the top compartment of the rectangle modeling a class contains:
Definition
the class's name
Term
Assuming that text is a variable of type string, what will be the contents of text after the statement cin >> text; is executed if the user types "Hello World!" then presses Enter?
Definition
Hello
Term
In the source-code file containing a class's member function definitions, each member function definition must be tied to the class definition by preceding the member function name with the class name and ::, which is known as the:
Definition
Binary scope resolution operator
Term
Calling a member function of an object requires which item?
Definition
the dot operator
Term
A grade has the value of 60, what will the following code display?

if ( grade >= 60 )
cout << "Passed"
Definition
Passed
Term
An operator that associates from right to left is
Definition
?
Term
the expression if ( num != 65 ) cannot be replaced by:
Definition
if ( !( num - 65 ))
Term
Which of the following is not one the rules for forming structured programs?
Definition
any transition arrow can be reversed
Term
Which of the following does not perform the following task, display correct if answers is equal to 7 and incorrect if answer is not equal to 7?
Definition
cout << answer ==7 ? "correct" "incorrect"
Term
Which of the following is not one of the C++ control structures?
Definition
break
Term
The _________, __________, and _________ are the only three forms of control necessary.
Definition
sequence, selection, repetition
Term
The OR (||) operator
Definition
stops evaluation upon finding one condition to be true
Term
Which of the following does counter-controlled repetition require?
Definition
all of the above
Term
Which of the following will not increment c by 1?
Definition
c + 1
Term
Which operation does not take place in the following example?

int x = 21
double y = 6
double z = 14
y = x / z
x = 5.5 * y
Definition
explicit conversion
Term
which of the following is not a syntax error?
Definition
std::cout << "hello world!"
Term
What is the final value of x after the following operation?


int x = 21
double y = 6
double z = 14
y = x / z
x = 5.5 * y
Definition
8
Term
the ________ object enables a program to read data from the user.
Definition
std::cin
Term
today virtually all new major operating systems are written in
Definition
C or C++
Term
Which of the following is false?
Definition
continue and break statements may be embedded only within repetition statements
Term
Which language was developed by Microsoft in the early 1990s to simplify the development of Windows applications?
Definition
visual basic
Supporting users have an ad free experience!