Which of the following is NOT a possible value of the expression 4 + 12 / 4 - 1 (hint: it means no matter what is the operators' precedence, that result will never be reached)
8 3 2 6
Java is a natural language
if statement is a loop statement
Which of the following is not constructed by a typical compiler?
Parse tree Object program Symbol table Source code
to allow authors to distribute their work while maintaining certain ownership rights.
Copyright laws were established
to allow ideas to be traced back to their origins. to allow authors to distribute their work while maintaining certain ownership rights. to allow authors to maintain ownership of their ideas. to restrict access to publications to certain groups within society
Which of the following software engineering methodologies is the most rigid?
Incremental model Waterfall model Extreme programming Evolutionary prototyping
Indicate it is coupling or cohesion: The interaction between modules
Which of the following is a stronger form of cohesion? Functional cohesion Logical cohesion
each object of "type" X will be associated with only one object of "type" Y.
If a class diagram indicates a one-to-one relationship between class X and class Y, then:
there will be only one object in the system of "type" X.
each object of "type" X will be associated with only one object of "type" Y.
there will be exactly one object of "type" X and exactly one object of "type" Y.
an object of "type" Y cannot occur without first constructing an object of "type" X.
Which of the following is the first phase of a software development? design implementation requirement analysis testing
Which of the following is a way of testing the design of a software system?
Structure chart Structured walkthrough Class diagram Entity-relationship diagram
Which of the following is the method proposed by UML for representing sequences of communication between objects? Sequence diagram Use case diagram Generalization Class diagram
Number of columns in the array
Which of the following is not used when determining the location of an entry in a two-dimensional array stored in column-major order?
Indices Number of rows in the array Number of columns in the array Address polynomial
An important distinction in constructing abstract data structures is whether the structure being simulated is static or dynamic. A static structure doesn't change the size over time.
Which of the following is used to refer the froint of the queue?
front pointer null pointer tail pointer head pointer
The table below represents a portion of a computer's main memory containing a binary tree stored row by row in a contiguous block as described in the chapter. What is the right children of the node B?
y, z, r
If a queue contained the entries w, x, y, z (from head to tail), which of the following would be the contents after two entries were removed and the entry r was inserted?
y, z, r r, w, x w, x, r r, y, z
Which of the following is static in the sense that it does not change size or shape as information is stored and retrieved?
tree queue stack array
Suppose a binary tree contained the nodes W, X, Y, and Z, and each node had at most one child. How many terminal nodes would be in the tree?
Two Three One Four
B (A, C)
The nodes in which of the trees below will be printed in alphabetical order by the following recursive procedure?
def printTree (Tree):
if (Tree is not None):
C (A, B) A (C, B) A (B, C) B (A, C)
The table below represents a portion of a computer's main memory containing a binary tree stored row by row in a contiguous block as described in the chapter. What is the left child of the node V?
Z W X Y
A string would have the structure of "yes no," or the word yes followed by a "sentence" followed by the word no.
Design a set of syntax diagrams that describes the grammatical structure of "sentences" that consist of occurrences of the word yes followed by the same number of the word no. For example, "yes yes no no" would be such a sentence, whereas "no yes," "yes no no," and "yes no yes" would not.
Both types and classes are templates used to describe the composition of "variables." Types, however, are predefined whereas classes are defined by the programmer within the "written program.
In an object-oriented programming environment, how are types and classes similar? How are they different?
Imperative paradigm: consist of a sequence of commands. Object-oriented paradigm: organized as elements called objects. Functional paradigm: consist of nested functions. Declarative paradigm: consist of declarative statements that describe properties.
Name and describe four different programming paradigms.
Y = 5 Z = 9
Simplify the following code segment
if (Y == 7 ):
An assembly language is essentially a mnemonic form of a machine language.
Summarize the distinction between a machine language and an assembly language.
A translator merely converts a program form one language to another. An interpreter executes the source program without producing a translated copy.
Summarize the distinction between a translator and an interpreter
2100 31XY 2003 B110 2201 5112 31XY B006
Translate the following Python program into the machine language described in Appendix C. You may assume that the program begins at address 00, and the x is stored at memory cell whose address is XY. x= 0
while (x < 3):
2000 11XX 12YY B1VV 11WW VV: 5012 30ZZ
Translate the high-level statement if (X == 0): Z=Y+ W else: Z=Y+ X into the machine language of Appendix C, assuming that W, X, Y, and Z are all values represented in two's complement notation, each using one byte of memory.
10XX 11YY 6001 30ZZ
Translate the statement Halfway = Length + Width into the machine language of Appendix C, assuming that Length, Width, and Halfway are all represented in floating-point notation.
the language is not made in terms of a particular machine's characteristics.
What does it mean to say that a programming language is machine independent?
a. Operator precedence is a priority system given to operations that determines the order in which operations will be performed unless otherwise specified. b. Depending on operator precedence the expression could be equal to either 24 or 12.
What is operator precedence? Depending on operator precedence, what values could be associated with the expression 6 + 2 * 3? (if + has higher precedence, what is the result? If x has higher precedence, what is the result? In real math, which result is produced?)
A literal is a specific value appearing as itself; a constant is a name for a fixed value; a variable is a name whose associated value can change as the program executes.
Explain the differences between a literal, a constant, and a variable.
The declarative statement contains the programmer-defined terminology; the imperative contains the steps in the algorithm to be executed.
Summarize the distinction between declarative statements and imperative statements.
If the required coercion was allowed the value 2.5 would probably be truncated to 2.
Suppose the variable X in a program was declared to be of type integer. What error would occur when executing the program statement X = 2.5
All operations must be performed without coercion.
What does it mean to say that a programming language is strongly typed?
It results in a subjective discipline in which theories are debated but few precise
Explain how the lack of metrics for measuring certain software properties affects the software engineering discipline.
A good modular design allows alterations to focus on only the pertinent sections of the software. The use of local variables reduces side effects and thus reduces the chance of "corrections" introducing more errors, etc.
Give an example of how efforts in the devel- opment of software can pay dividends later in software maintenance.
Other fields of engineering tend to be based on exact science. Mechanical engineering, for example, has a strong foundation in physics.
How does software engineering differ from other, more traditional fields of engineering such as electrical and mechanical engineering?
bottom-up design in that the final system is built by expanding a simpler system. In fact, the functionality of the final system is usually not known at the beginning of the project. Instead, it evolves according to the desires of the developers.
Is open-source development a top-down or bottom-up methodology? Explain your answer.
the hope to construct predefined building blocks from which large systems can be constructed.
Summarize the role of design patterns in soft- ware engineering.
one-to-many relationship, each occurrence may be related to several occurrences, but not vice-versa. In a many-to-many relationship, each occurrence of either entity may be related to several occurrences of the other entity.
What is the difference between a one-to- many relationship and a many-to-many relationship?
Black-box testing tests the performance of software without regard for its internal construction. Glass-box testing is done with the knowledge of the system's internal design.
What is the difference between black-box test- ing and glass-box testing?
Coupling is the connections between modules; cohesion is the connectivity within a module. minimize coupling (because that leads to independent modules that can be maintained individually) and maximize cohesion (because that leads to modules whose activities can be more easily understood).
What is the difference between coupling and cohesion? Which should be minimized and which should be maximized? Why?
if the structure of one of the global elements was modified, it would be difficult to identify the portions of the program that access that element
What problems could arise during main- tenance if a large software system were designed in such a way that all of its data elements were global?
beta testing the tester is only allowed to test; in open-source development the "tester" is allowed to test and modify the software.
How does open-source development differ from beta testing? (Consider glass-box testing versus black-box testing.)
a. The lack of flexibility means that mistakes can be very expensive. b. The waterfall model provides a well-defined process in which progress can be measured.
Identify a disadvantage and an advantage of the traditional waterfall model for software development.
If instance variable is private, no data coupling on that variable can occur between objects. declaring instance variables as private will reduce the potential for data coupling.
In an object-oriented program, what does declaring an instance variable to be public or private indicate about data coupling? What would be the rationale behind a preference toward declaring instance variables as private?
An entire automobile is an example of logical cohesion, whereas a component such as a single seat or the steering wheel is more functional cohesive.
Select an object from everyday life and analyze its components in terms of functional or logical cohesion.
the process of developing the final software system by enhancing the prototype
What is evolutionary prototyping?
We use three list: ListA, ListB & MergedList We add ListA and ListB and place it in MergedList
Design an algorithm for combining two sorted contiguous lists into a single sorted contiguous list.
def Reverse(List): CurrentPointer = List.Head PreviousPointer = None while (CurrentPointer is not None): NextPointer = CurrentPointer.Next CurentPointer.Next = Previous PreviousPointer = CurrentPointer CurrentPointer = NextPointer List.Head = PreviousPointer
Design an algorithm for reversing the order of a linked list.
def removeBottom(stack): auxStack = new empty stack if (not stack.isEmpty()) then repeat: auxStack.push(stack.pop()) until (stack.isEmpty()) auxStack.pop() while (not auxStack.isEmpty()): stack.push(auxStack.pop())
Design an algorithm to remove the bottom entry from a stack so that the rest of the stack is retained. You should access the stack using only push and pop operations. What auxiliary storage structure should be used to solve this problem?
Suppose an array with six rows and eight columns is stored in row major order starting at address 20 (base 10). If each entry in the array requires only one memory cell, what is the address of the entry in the third row and fourth column?
Suppose the contiguous cells representing a binary tree as described in Section 8.3 contained the values A, B, C, D, E, F, and F, respectively. Draw a picture of the tree. You may draw the tree on paper and scan and e-mail to your instructor
x = 13 y = 18
Suppose the entries in a queue require one memory cell each, the head pointer contains the value 11, and the tail pointer contains the value 17. What are the values of these pointers after one entry is inserted and two are removed? The head pointer is [x] and the tail pointer is [y]
The letters A, B, and C must be moved forward, or the letters E, F, and G must be moved backward, or the entire list must be moved to another location in memory.
Suppose the list of letters A, B, C, E, F, and G is stored in a contiguous block of memory cells. What activities are required to insert the letter D in the list, assuming that the list's alphabetical order is to be maintained?
30 J 31 38 32 B 33 30 34 X 35 46 36 N 37 40 38 K 39 40 40 P 41 34
The following table represents a portion of a linked list in a computer's main memory. Each entry in the list consists of two cells: The first contains a letter of the alphabet; the second contains a pointer to the next list entry. Alter the pointers so that the letter N is no longer in the list. Your list starts from cell 32. Address Content
additions to the list could force the entire list to be moved to a new location. (In general, arrays are inherently static and thus are problematic when used to implement dynamic structures.
What complications are imposed if one tries to implement a dynamic list using a traditional one-dimensional array?
A queue crawl through memory in the direction of its tail.
Declare ListA and List B Check if ListA is empty return ListB Check if ListB is empty then return ListA Keep the address of first node of ListA in pointer p Move pointer p to last node keep address of the first node of the ListB in next of node currently pointed by p then return listA
Design an algorithm for concatenating two linked lists (that is, placing one before the other to form a single list).
Suppose the queues were A and B and the entries to be reversed are in queue A. Cycle the entries in queue A until the first of the target entries comes to the front. Then move this entry to the tail of queue B and move the next entry in queue A to the tail of A. Now cycle queue B until the entry from queue A comes to the front and then move that entry to the tail of queue A. Finally, cycle queue A until all its entries except the reversed entries are back in their original positions.
Suppose you were given two queues and you were only allowed to move one entry at a time from the head of a queue to the tail of either. Design an algorithm for reversing two adjacent entries in one of the queues.
Routine 1 is correct. Routine 2 results in the New Entry pointing to itself.
Which of the following routines correctly inserts NewEntry immediately after the entry called PreviousEntry in a linked list? What is wrong with the other routine? Routine 1: 1. Copy the value in the pointer field of PreviousEntry into the pointer field of NewEntry. 2. Change the value in the pointer field of PreviousEntry to the address of NewEntry. Routine 2: 1. Change the value in the pointer field of PreviousEntry to the address of NewEntry. 2. Copy the value in the pointer field of PreviousEntry into the pointer field of NewEntry.
Which of the following is an example of a language that is based on the functional paradigm? A. LISP B. PROLOG C. C D. C++
Which of the following is an example of a language that is based on the object-oriented paradigm? A. LISP B. PROLOG C. C D. C++
Which of the following is not a type of statement found in a typical high-level imperative programming language? A. Imperative statement
B. Exclamatory statement
C. Declarative statement
D. Comment statement
Which of the following does not require a Boolean structure?
A. If-then-else statement
B. While loop statement
C. Assignment statement
D. For loop statement
Which of the following is not a control statement? A. If-then-else statement
B. While loop statement
C. Assignment statement
D. For loop statement
Executing the program
Which of the following is not a step in the process of translating a program?
A. Executing the program
B. Parsing the program
C. Lexical analysis
D. Code generation
Which of the following is not associated with object-oriented programming?
A. Inheritance B. Resolution C. Encapsulation
Which of the following is not associated with the concept of data type?
A. Coercion B. Boolean C. Operator precedence D. Strongly typed language
Positions within arrays are identified by means of numbers called
A. Indices B. Parameters C. Instance variables D. Constants
Which of the following is ignored by a compiler?
A. Control statements
B. Declarations of constants
C. Procedure headers
D. Comment statements
Which of the following is not a possible value of the expression
4 + 6
2 - 1
Which of the following is not a way of referring to a value in a program?
A. Variable B. Literal C. Constant D. Type
The portion of the program in which the variable can be accessed
Which of the following is the scope of a variable?
A. The number of characters in the variable's name
B. The portion of the program in which the variable can be accessed
C. The type associated with the variable
D. The structure associated with the variable
Which of the following is a means of nullifying conflicts among data types?
A. Inheritance B. Parsing C. Coercion D. Code optimization
Which of the following is a means of defining similar yet different classes in an object-oriented program?
A. Inheritance B. Parsing C. Coercion D. Code optimization
Which of the following is a notational system for representing object-oriented designs?
B. Structure charts C. Modular designs D. Dataflow diagrams
Which of the following is an attempt to construct software from off-the-shelf components as is done in other engineering fields?
A. Extreme programming B. Evolutionary prototyping C. Component architecture D. Open-source development
Dinner guests and table settings
Which of the following is most likely an example of a one-to-one relationship?
A. Subscribers and magazines B. Birth dates and people C. Planets and their moons D. Dinner guests and table settings
Subscribers and magazines
Which of the following is most likely an example of a many-to-many relationship?
A. Subscribers and magazines B. Birth dates and people
C. Planets and their moons D. Dinner guests and table settings
Which of the following is not a feature of UML?
A. Use case diagrams
B. Class diagrams
C. Dataflow diagrams
D. Sequence diagrams
The use of design patterns in software engineering was adopted from what other field?
A. Business administration B. Architecture
basis path testing
Which of the following is a form of glass-box testing?
A. basis path testing B. Boundary value analysis C. Beta testing
Which of the following is a means of controlling the complexity of a software system?
A. CRC cards B. Modularity C. Specifications
D. Beta testing
Which of the following is not related to the others?
A. Structure Chart
B. Imperative paradigm
C. Class diagram
The number of instances each class will have
Which of the following is not represented in a class diagram? A. Generalizations
B. The methods within a class
C. The attributes within a class D. The number of instances each class will have
Better late than never
Which of the following is least related to the Pareto principle?
A. When it rains, it pours.
B. Birds of a feather flock together.
C. Better late than never
The Pareto principle is traditionally applied during which phase of software development?
A. Analysis B. Design C. Implementation D. Testing
Which of the following is the oldest approach to software development?
A. Component architecture B. Waterfall model
C. Open-source development D. Extreme programming
Which of the following is not a tool for designing modular systems?
A. Structure charts
B. Data dictionaries C. Class diagrams
D. Sequence diagrams
A module that only records deposits to checking accounts
Which of the following appears to be the most functionally cohesive?
A. A module that handles all of a customers banking needs
B. A module that handles only transactions related to checking accounts C. A module that only records deposits to checking accounts
D. A module that collects data for monthly statements
The entry X[1,2] would appear before X[2,1]
If the two-dimensional array X were stored in row-major order, then in the block of main memory containing X, which of the following would be true?
A. The entry X[1,2] would appear before X[2,1].
B. The entry X[1,2] would appear after X[2,1].
C. The entry X[1,2] would be in the same location as X[2,1].
D. None of the above
Number of rows in the array
Which of the following is not used when determining the location of an entry in a two-dimensional homogeneous array stored in row-major order?
B. Number of rows in the array
C. Address polynomial D. Number of columns in the array
Which of the following is not a means of locating an entry in a linked storage structure?
A. Head pointer B. Child pointer C. Root pointer D. NIL pointer
If the longest path in a binary tree contained exactly four nodes, what is the maximum number of nodes that could be in the entire tree?
Each terminal node in the tree is always at the end of a path that is as least as long as any other path in the tree.
Suppose a binary tree is implemented as a linked structure in which each node contains both a left child pointer and a right child pointer. Which of the following statements is false?
A. The number of nodes in the tree is always at least the number of nodes on the longest path in the tree. B. The number of NIL pointers in the tree is always greater than the number of nodes in the tree. C. Each terminal node in the tree is always at the end of a path that is as least as long as any other path in the tree. D. Both the left child and right child pointers of every terminal node are NIL.
In a machine language, the technique in which the data to be manipulated by an instruction is included within the instruction itself is called
A. Immediate addressing
B. Direct addressing C. Indirect addressing
In a machine language, the technique in which an instruction contains the location of a pointer to the data to be manipulated is called