FINALTERM EXAMINATION
Spring 2010
CS504- Software Engineering - I (Session - 3)
Time: 90 min
M a r k s: 58
Question No: 1 ( M a r k s: 1 ) http://vuzs.net
Quantitative methods for assessing the quality of proposed architectural designs
are readily available.
► True
► False
Question No: 2 ( M a r k s: 1 ) http://vuzs.net
A decision table should be used_______________________
► to document all conditional statements
► to guide the development of the project management plan
► only when building an expert system
► when a complex set of conditions and actions appears in a component
Question No: 3 ( M a r k s: 1 ) http://vuzs.net
Test cases should be designed long before testing begins.
► True
► False
Question No: 4 ( M a r k s: 1 ) http://vuzs.net
Which of the following are characteristics of testable software?
► observability
► simplicity
► stability
► all of the given
Question No: 5 ( M a r k s: 1 ) http://vuzs.net
Comparison testing is typically done to test two competing products as part of
customer market analysis prior to product release.
► True
► False
Question No: 6 ( M a r k s: 1 ) http://vuzs.net
By collecting software metrics and making use of existing software reliability
models it is possible to develop meaningful guidelines for determining when software testing is done.
► True
► False
Question No: 7 ( M a r k s: 1 ) http://vuzs.net
Configuration reviews are not needed if regression testing has been rigorously applied during software integration.
► True
► False
Question No: 8 ( M a r k s: 1 ) http://vuzs.net
A change becomes ------------- because of close presence of data and fucntions
► Localized
► Private
► Global
► Accessible
Question No: 9 ( M a r k s: 1 ) http://vuzs.net
Requirement engineering mainly deals with the -------------- of the system
► definition phase
► development phase
► maintenance
► non of the above
Question No: 10 ( M a r k s: 1 ) http://vuzs.net
40-60% of all defects found in software projects can be traced back to poor -----------
► Requirements
► Design
► Coding
► Testing
Question No: 11 ( M a r k s: 1 ) http://vuzs.net
In the N-Tire Architecture the idea is to enhance scalability and -------------- by distributing both the data and the application using multiple server machines.
► Performance
► Efficiency
► Usability
► non of the all
Question No: 12 ( M a r k s: 1 ) http://vuzs.net
MVC pattern was based on the --------------- pattern.
► Observer
► Structural
► Behavioral
► Non of them
Question No: 13 ( M a r k s: 1 ) http://vuzs.net
Classes should be declared in individual header files with the file name matching the
---------- name.
► class
► method
► object
► non of the all
Question No: 14 ( M a r k s: 1 ) http://vuzs.net
Unit testing is roughly equivalent to ---------- testing for hardware in which each chip is tested
thoroughly after manufacturing
► Circuit level
► Chip Level
► component level
► system level
Question No: 15 ( M a r k s: 1 ) http://vuzs.net
Software should be tested more like hardware, with Built-in self testing: such that each unit can be tested -------------
► freely
► independently
► dependtly
► completely
Question No: 16 ( M a r k s: 1 ) http://vuzs.net
A system ------------- is the period in which tremendous pressure is on developers end to fix the problem and make the system running again
► Uptime
► Downtime
► Currentime
► futuretimr
Question No: 17 ( M a r k s: 1 ) http://vuzs.net
Which one of the given below is not a symptom of memory overrun?
► Program crashes quite regularly after a given routine is called, that routine should be examined for a possible overrun condition.
► If the routine in question does not appear to have any such problem the most likely cause is that another routine, called in the prior sequence, has already
trashed variables or memory blocks.
► Checking the trace log of the called routines leading up to one with the problem will often show up the error.
► Compiler warnings.
Question No: 18 ( M a r k s: 1 ) http://vuzs.net
Software architecture elements are further divided into categories which in total are -----------
► 2
► 3
► 4
► 5
Question No: 19 ( M a r k s: 1 ) http://vuzs.net
Three tier architecture contains ------------- layers
► Presentation
► Application
► Database
► All of the above
Question No: 20 ( M a r k s: 1 ) http://vuzs.net
1. Variables should be initialized where they are declared and they should be declared in
the -------------- scope possible.
► Smallest
► largest
► medium
► None of the given
Question No: 21 ( M a r k s: 1 ) http://vuzs.net
------------------ are two important tools that can help in managing and mastering the complexity of a program.
► abstraction and encapsulation
► abstraction and Inheritence
► abstraction and Polymarhphism
► None of given
Question No: 22 ( M a r k s: 1 ) http://vuzs.net
Which of the following is a/are tool used in requirement analysis?
► Flow Graphs
► Data Flow Diagrams
► Activity Networks
► Module Dependency Diagrams
Question No: 23 ( M a r k s: 1 ) http://vuzs.net
Consider the following comment. “The software which I bought won’t run on windows and when it runs I can’t use WORD at the same time”. Which of the following do you think are violated by the newly bought software?
► dependability, interchangeability
► platform independence, interoperability
► reliability, dependency
► interoperability, reliability
Question No: 24 ( M a r k s: 1 ) http://vuzs.net
……………… is a diagramming technique used to identify the types of objects in the system and the static relationships that exist among them.
► Class Diagram
► Document flow diagrams
► Data flow diagrams
► Flow charts
Question No: 25 ( M a r k s: 1 ) http://vuzs.net
Which of the following interaction style best suit the design of an interface for visually impaired users?
► direct manipulation
► direct manipulation
► natural language
► command line
Question No: 26 ( M a r k s: 1 ) http://vuzs.net
Which of the following testing involve purely black box testing?
► unit testing, beta testing
► acceptance testing, interface testing
► beta testing, acceptance testing
► integration testing, interface testing
Question No: 27 ( M a r k s: 2 )
what does this mean” Object Creation and Life Time”?
From the object creation and life time point of view, when an object is instantiated, all of its parts must also be instantiated at the same time before any useful work can be done and all of its part die with it. While in the case of association, the life time of two associated object is independent of one another. The only limitation is that an object must be alive or has to be instantiated before a message can be sent to it.
Question No: 28 ( M a r k s: 2 )
How one can avoid hazards caused by side effects while writing code. List the two guidelines.
never use “,” except for declaration
if you are initializing a variable at the time of declaration, do not declare another variable in the same statement
never use multiple assignments in the same statement
Be very careful when you use functions with side effects – functions that change the values of the parameters.
Try to avoid functions that change the value of some parameters and return some value at the same time.
Question No: 29 ( M a r k s: 2 )
What is the greatest advantage of exception handling?
Exception handling is a powerful technique that separates error-handling code from
normal code. It also provides a consistent error handling mechanism. The greatest
advantage of exception handling is its ability to handle asynchronous errors.
Question No: 30 ( M a r k s: 2 )
Give 2 Unit Testing Tips.
Unit test should be conveniently located
For small projects you can imbed the unit test for a module in the module itself
For larger projects you should keep the tests in the package directory or a /test subdirectory of the package
By making the code accessible to developers you provide them with:
Examples of how to use all the functionality of your module
A means to build regression tests to validate any future changes to the code
You can use the main routine with conditional compilation to run your unit tests.
Question No: 31 ( M a r k s: 3 )
Write unit testing quantitative benefits.
Repeatable: Unit test cases can be repeated to verify that no unintended side effects have occurred due to some modification in the code.
Bounded: Narrow focus simplifies finding and fixing defects.
Cheaper: Find and fix defects early
Question No: 32 ( M a r k s: 3 )
How Comments should be indented relative to their position in the code? Give an example
Comments should be indented relative to their position in the code.
while (true) { // NOT: while (true) {
// Do something // // Do something
something(); // something();
} // }
Question No: 33 ( M a r k s: 3 )
Consider the following code fragment.
while a
{
while b
c
d
}
If you were to test this code, what would be the test technique to adopt?
Flow Graph Testing would be used to test the code
Statement Testing
Branch Testing
Path Testing
Question No: 34 ( M a r k s: 5 )
Narrate the manner for the organization of Class and Interface declarations
Class and Interface declarations should be organized in the following manner:
1. Class/Interface documentation.
2. class or interface statement.
3. Class (static) variables in the order public, protected, package (no access modifier), private.
4. Instance variables in the order public, protected, package (no access modifier), private.
5. Constructors.
6. Methods (no specific order).
Question No: 35 ( M a r k s: 5 )
Discus the symptoms and an example of coding error bug class.
A coding error is a simple problem in writing the code. IT can be a failure to check error
returns, a failure to check for certain valid conditions, or a failure to take into account
other parts of the system. Yet another form of a coding error is incorrect parameter
passing and invalid return type coercion.
Symptoms
Unexpected errors in black box testing.
The errors that unexpectedly occur are usually caused by coding errors.
Compiler warnings.
Coding errors are usually caused by lack of attention to details.
Example
In the following example, a function accepts an input integer and converts it into a string
that contains that integer in its word representation.
void convertToString(int InInteger, char* OutString, int* OutLength)
{
switch(InInteger){
case 1: OutString = "One";OutLength = 3;
break;
case 2: OutString = "Two";OutLength = 3;
break;
case 3: OutString = "Three";OutLength = 5;
break;
case 4: OutString = "Four";OutLength = 4;
break;
case 5: OutString = "Five";OutLength = 4;
break;
case 6: OutString = "Six";OutLength = 3;
break;
case 7: OutString = "Seven";OutLength = 5;
break;
case 8: OutString = "Eight";OutLength = 5;
break;
case 9: OutString = "Nine";OutLength = 4;
break;
}
}
There are a few things to notice in the preceding code. The ConvertToString function
does not handle all cases of inputs, which becomes very obvious you pass a zero value.
Worse, the function does not initialize the output variables, leaving them at whatever they
happened to be when they came into the function. This isn’t a problem for the output
string, necessarily, but it will become a serious issue for the output length.
Question No: 36 ( M a r k s: 5 )
Why Code portability is so important ? Give out 3 ways / Guide lines to improve the code portability with examples
(5+5)
Stick to the standard
1. Use ANSI/ISO standard C++
2. Instead of using vendor specific language extensions, use STL as much as
possible
Program in the mainstream
Although C++ standard does not require function prototypes, one should always write
them.
double sqrt(); // old style acceptable by ANSI C
double sqrt(double); // ANSI – the right approach
Size of data types
Sizes of data types cause major portability issues as they vary from one machine to the
other so one should be careful with them.
int i, j, k;
…
j = 20000;
k = 30000;
i = j + k;
Order of Evaluation
As mentioned earlier during the discussion of side effects, order of evaluation varies from
one implementation to other. This therefore also causes portability issues. We should
therefore follow guidelines mentioned in the side effect discussion.
Signedness of char
The language does not specify whether char is signed or unsigned.
char c;
// between 0 and 255 if unsigned
// -128 to 127 if signed
c = getchar();
if (c == EOF) ??
// will fail if it is unsigned
It should therefore be written as follows:
int c;
c = getchar();
if (c == EOF)
Equivalence Classes
Equivalence classes help you in designing test cases to test the system effectively and
efficiently. One should have reasons to believe that the test cases are equivalent. As for
this purpose, one would need to understand the system and see in how many partitions it
can be divided. These partitions should be devised such that a clear distinction should be
marked. Test cases written for one partition should not yield the same results when run
for the second partition as otherwise these two partitions should become one. However,
finding equivalence classes is a subjective process, as two people analyzing a program
will probably come up with different sets of equivalence classes
where the term compute method use.
The term compute can be used in methods where something is computed
valueSet.computeAverage(); matrix.computeInverse()
Describe three coverage schemes related to white box testing
Statement Coverage: In this scheme, statements of the code are tested for a successful test that checks all the statements lying on the path of a successful scenario.
Branch Coverage: In this scheme, all the possible branches of decision structures are tested. Therefore, sequences of statements following a decision are tested.
Path Coverage: In path coverage, all possible paths of a program from input instruction to the output instruction are tested. An exhaustive list of test cases is generated and tested against the code.
Memory over-runs and their symptoms
a memory overrun occurs when you use memory that does not belong to you. This can be
caused by overstepping an array boundary or by copying a string that is too big for the
block of memory it is defined to hold. Memory overruns were once extremely common in
the programming world because of the inability to tell what the actual size of something
really was.
Symptoms
Program crashes quite regularly after a given routine is called, that routine should
be examined for a possible overrun condition.
If the routine in question does not appear to have any such problem the most
likely cause is that another routine, called in the prior sequence, has already
trashed variables or memory blocks.
Checking the trace log of the called routines leading up to one with the problem
will often show up the error.
The use of do .... while loops should be avoided, why is that?
The use of do .... while loops should be avoided. There are two reasons for this. First
is that the construct is superflous; Any statement that can be written as a do .... while
loop can equally well be written as a while lopp or a for loop. Complexity is reduced
by minimizing the number of constructs being used. The other reason is of
readability. A loop with the conditional part at the end is more difficult to read than
one with the conditional at the top.
write a note on Usefulness of testing
Software testing is the process of examining the software product against its requirements. Thus it is a process that involves verification of product with respect to its written requirements and conformance of requirements with user needs. From another perspective, software testing is the process of executing software product on test data and examining its output vis-Ã vis the documented behavior.
Identifier names also play a significant role
Identifier names also play a significant role in enhancing the readability of a program.
The names should be chosen in order to make them meaningful to the reader. In order to
understand the concept, let us look at the following statement.
if (x==0) // this is the case when we are allocating a new number
In this particular case, the meanings of the condition in the if-statement are not clear and
we had to write a comment to explain it. This can be improved if, instead of using x, we
use a more meaningful name. Our new code becomes:
if (AllocFlag == 0)
The situation has improved a little bit but the semantics of the condition are still not very
clear as the meaning of 0 is not very clear. Now consider the following statement:
If (AllocFlag == NEW_NUMBER)
We have improved the quality of the code by replacing the number 0 with a named
constant NEW_NUMBER. Now, the semantics are clear and do not need any extra
comments, hence this piece of code is self-documenting.
Good clues, Easy Bugs explain this term.
Get A Stack Trace
In the debugging process a stack trace is a very useful tool.
Following stack trace information may help in debugging process.
„h Source line numbers in stack trace is the single, most useful piece of debugging
information.
„h After that, values of arguments are important
o Are the values improbable (zero, very large, negative, character strings
with non-alphabetic characters?
„h Debuggers can be used to display values of local or global variables.
o These give additional information about what went wrong.