Chapter 1: Software Engineering Principles and C++ Classes

TRUE/FALSE

	1.	A program goes through many phases from the time it is first conceived until the time it is retired, called the life cycle of the program.

ANS:	T	PTS:	1	REF:	2

	2.	The three fundamental stages through which a program goes are implementation, use, and maintenance.

ANS:	F	PTS:	1	REF:	2

	3.	In the software maintenance process, the program is modified to fix the (identified) problems and/or to enhance it.

ANS:	T	PTS:	1	REF:	2

	4.	A program that is well developed is more expensive to maintain.

ANS:	F	PTS:	1	REF:	3

	5.	Software engineers typically break the software development process into the following four phases: analysis, design, implementation, and testing and debugging.

ANS:	T	PTS:	1	REF:	3

	6.	Dividing a problem into smaller subproblems is called structured design.

ANS:	T	PTS:	1	REF:	4

	7.	The structured design approach is also known as modular programming.

ANS:	T	PTS:	1	REF:	4

	8.	Encapsulation is the ability to handle data and operations as separate units.

ANS:	F	PTS:	1	REF:	4

	9.	In OOP, each object consists of data and operations on that data.

ANS:	T	PTS:	1	REF:	4

	10.	OOD has three basic principles: encapsulation, inheritance and polymorphism.

ANS:	T	PTS:	1	REF:	4

	11.	Encapsulation is the ability to create new data types from existing data types.

ANS:	F	PTS:	1	REF:	4

	12.	Polymorphism is the ability to use the same expression to denote different operations.

ANS:	T	PTS:	1	REF:	4

	13.	A precondition is a statement specifying the condition(s) that must be true before the function is called.

ANS:	T	PTS:	1	REF:	5

	14.	A postcondition is a statement specifying what is true before the function call is completed.

ANS:	F	PTS:	1	REF:	6

	15.	In black-box testing, you do not know the internal working of the algorithm or function.

ANS:	T	PTS:	1	REF:	7

	16.	White-box testing relies on the internal structure and implementation of a function or algorithm.

ANS:	T	PTS:	1	REF:	8

	17.	The term asymptotic means the study of the function f as n becomes larger and larger without bound.

ANS:	T	PTS:	1	REF:	14

	18.	The components of a class are called objects.

ANS:	F	PTS:	1	REF:	17

	19.	If g(n) = 1, the growth rate is constant and does not depend on the size of the problem.

ANS:	T	PTS:	1	REF:	17

	20.	In C++, the mechanism that allows you to combine data and the operations on that data in a single unit is called a class.

ANS:	T	PTS:	1	REF:	17

	21.	The members of a class are classified into three categories: private, public, and main.

ANS:	F	PTS:	1	REF:	18

	22.	Private, public, and protected are member access specifiers.

ANS:	T	PTS:	1	REF:	18

	23.	A class and its members can be described graphically using a notation known as Unified Modeling Language (UML) notation.

ANS:	T	PTS:	1	REF:	22

	24.	Class objects cannot be passed as parameters to functions or returned as function values.

ANS:	F	PTS:	1	REF:	32

	25.	As parameters to functions, class objects can be passed only by reference.

ANS:	F	PTS:	1	REF:	32

MULTIPLE CHOICE

	1.	The three fundamental stages a program goes through are: development, use, and ____.
a.	implementation	c.	analysis	
b.	maintenance	d.	requirements gathering	

ANS:	B	PTS:	1	REF:	2

	2.	When a program is considered too expensive to maintain, the developer might decide to ____ the program and no new version of the program will be released.
a.	delete	c.	retire	
b.	restructure	d.	release	

ANS:	C	PTS:	1	REF:	2

	3.	____ is the first and most important step of the software development process.
a.	Analyzing the problem	c.	Implementing the software	
b.	Designing the software	d.	Test marketing	

ANS:	A	PTS:	1	REF:	3

	4.	A(n) ____ is a step-by-step problem-solving process in which a solution is arrived at in a finite amount of time.
a.	design plan	c.	process plan	
b.	algorithm	d.	structured program	

ANS:	B	PTS:	1	REF:	4

	5.	The structured design approach is also known as ____.
a.	top-down design	c.	object design	
b.	bottom-up design	d.	stepwise updating	

ANS:	A	PTS:	1	REF:	4

	6.	____ is the ability to create new data types from existing data types.
a.	Encapsulation	c.	Inheritance	
b.	Information hiding	d.	Polymorphism	

ANS:	C	PTS:	1	REF:	4

	7.	____ is the ability to use the same expression to denote different operations.
a.	Overloading operators	c.	Inheritance	
b.	Polymorphism	d.	Encapsulation	

ANS:	B	PTS:	1	REF:	4

	8.	The output of ____  is immediately sent to the standard error stream, which is usually the screen.
a.	cerr	c.	cerror	
b.	cout	d.	cerrout	

ANS:	A	PTS:	1	REF:	5

	9.	The main types of testing are ____ testing.
a.	white-box and blue-box	c.	white-box and green-box	
b.	black-box and blue-box	d.	white-box and black-box	

ANS:	D	PTS:	1	REF:	7

	10.	In the function ____, the growth rate is a function of the base 2 logarithm of n.
a.	g(n)=1	c.	g(n)=nlog2n	
b.	g(n)=log2n	d.	g(n)=2n	

ANS:	B	PTS:	1	REF:	17

	11.	In the function ____, the growth rate is quadrupled when the problem size is doubled.
a.	g(n)=1	c.	g(n)=n2	
b.	g(n)=nlog2n	d.	g(n)=2n	

ANS:	C	PTS:	1	REF:	17

	12.	In the function ____, the growth rate is exponential.
a.	g(n)=1	c.	g(n)=nlog2n	
b.	g(n)=n2	d.	g(n)=2n	

ANS:	D	PTS:	1	REF:	17

	13.	A(n) ____ is a collection of a fixed number of components.
a.	object	c.	class	
b.	member	d.	friend	

ANS:	C	PTS:	1	REF:	17

	14.	The components of a class are called the ____  of the class.
a.	operators	c.	objects	
b.	friends	d.	members	

ANS:	D	PTS:	1	REF:	17

	15.	The members of a class are classified into three categories called ____ access specifiers.
a.	member	c.	function	
b.	object	d.	object	

ANS:	A	PTS:	1	REF:	18

	16.	Deciding which member to make private and which to make public depends on the ____ of the member.
a.	nature	c.	function	
b.	size	d.	identity	

ANS:	A	PTS:	1	REF:	19

	17.	By default, all members of a class are ____.
a.	public	c.	private	
b.	protected	d.	open	

ANS:	C	PTS:	1	REF:	20

	18.	To guarantee that the instance variables of a class are initialized, you use ____.
a.	friend functions	c.	void functions	
b.	constructors	d.	destructors	

ANS:	B	PTS:	1	REF:	21

	19.	The constructor without parameters is called the ____.
a.	helper function	c.	destructor	
b.	default constructor	d.	default destructor	

ANS:	B	PTS:	1	REF:	21

	20.	The name of a constructor is the same as the name of the ____.
a.	class	c.	helper function	
b.	main function	d.	friend function	

ANS:	A	PTS:	1	REF:	21

	21.	In C++ terminology, a class variable is called a ____.
a.	class object	c.	class member	
b.	class placeholder	d.	class template	

ANS:	A	PTS:	1	REF:	23

	22.	The general syntax for declaring a class object that invokes the default constructor is ____.
a.	className classObject.new;	
b.	className ObjectName;	
c.	className classObjectName;	
d.	classObjectName className;	

ANS:	C	PTS:	1	REF:	23

	23.	____ serves to hide the details of the operations on the data.
a.	Inheritance	c.	A destructor	
b.	Information hiding	d.	A constructor	

ANS:	B	PTS:	1	REF:	25

	24.	The destructor automatically executes when the class object goes out of ____.
a.	scope	c.	bounds	
b.	use	d.	phase	

ANS:	A	PTS:	1	REF:	33

	25.	A(n) ____ is a data type that separates the logical properties from the implementation details.
a.	public	c.	private	
b.	protected	d.	abstract data type	

ANS:	D	PTS:	1	REF:	34