CS504 Solved Subjective Final Term by Junaid PDF
CS504 Solved Subjective Final Term by Junaid PDF
CS504 Solved Subjective Final Term by Junaid PDF
Engineering-II
(Solved Subjective)
LECTURE FROM
(23 to 45)
[email protected] FOR MORE VISIT JUNAID MALIK
[email protected]
VULMSHELP.COME 0304-1659294
AL-JUNAID TECH INSTITUTE
Question No: 1 ( Marks: 2 )
What is Software Testing?
Answer:- (Page 192)
To understand the concept of software testing correctly, we need to understand a few related concepts.
Answer:-
(a) User friendliness
Example
The array only has 50 slots available in its allocation. What happens at that point is that the function goes past
the end of the array and starts to walk on things beyond its control. const kMaxEntries = 50;
int gArray[kMaxEntries];
char szDummyBuffer[256];
int nState = 10;
int ZeroArray (int *pArray)
{
for (inti=0;i<100;++i)
pArray[i] = 0;
}
3. Names representing constants must be all uppercase using underscore to separate words.
MAX_ITERATIONS, COLOR_RED
4. Names representing methods and functions should be verbs and written in mixed case starting with lower
case.
AL-JUNAID TECH INSTITUTE
getName(), computeTotalWidth()
While
A while loop structure consists of a loop guard instruction through which the iteration in the loop is controlled.
The control keeps iterating in the loop as long as the loop guard condition is true. It branches to the last
instruction when it becomes false.
int i, j, k;
…
j = 20000;
k = 30000;
i = j + k;
// works if int is 4 bytes
// what will happen if int is 2 bytes?
Question No. 24
What do we mean by ambiguous requirements. Explain with the help of a example.
Answer:- (Page 198)
Ambiguity means that two different readers of the same document interpret the requirement differently.
Ambiguity arises from the use of natural language. Because of the imprecise nature of the language, different
readers interpret the statements differently. As an example, consider the following Urdu Phrase: “Rooko mut
jane doo”. Now, depending upon where a reader places the comma in this statement, two different readers may
interpret it in totally different manner. If a comma is palced after “Rooko”, the sentence will become “Rooko,
mut jane doo”, meaning “don’t let him go”. On the other hand if the comma id placed after “mut”, the
AL-JUNAID TECH INSTITUTE
sentence will become “Rooko mut, jane doo”, meaning “let him go”. Ambiguous requirements therefore result
in misunderstandings and mismatched expectations, resulting in a wasted time and effort and an undesirable
product.
QuestionNo:28 (marks 5)
Below is the chunk of code :
Result=squareRoot(arget;
Assert (abs (result * result – argument) < epsilon);
Write the Contract for square root routine keeping in view unit testing.
Answer:-(Page 207)
Pass in a negative argument and ensure that it is rejected
Pass in an argument of zero to ensure that it is accepted (this is a boundary value)
Pass in values between zero and the maximum expressible argument and verify that the
difference between the square of the result and the original argument is less than some value
epsilon.
Question No.33
Differentiate between Black box testing and white box testing.
Answer:- (Page 198)
In this type of testing, a component or system is treated as a black box and it is tested for the required
behavior. This type of testing is not concerned with how the inputs are transformed into outputs.
As opposed to black box testing, in structural or white box testing we look inside the system and
evaluate what it consists of and how is it implemented.
Answer:-(Page 197)
This statement liberally uses a number of operators and hence is very difficult to follow and understand. If it is
broken down into simple set of statements, the logic becomes easier to follow as shown below:
if (2*k < n-m)
*xp = c[k+1];
else
*xp = d[k--];
AL-JUNAID TECH INSTITUTE
*x = *x + *xp;
Question No. 40
Consider the following Use Case diagram: Identify the system actors in given use case diagram.
(a) Input data and output results often fall into different classes where all members of a class are related.
(b) It is a method to partition the requirements into equivalent classes during the requirement analysis process.
(c) Test cases should be chosen to be representative of each equivalence partition.
(d) It is recommended that only boundaries are checked in each partition.
(e) It is recommended that boundaries as well as mid points are checked in each partition.
Answer:-
( A ,b ,c, ) are the true statements with respect to equivalence partitioning
Question No. 42
Bit fields do suffer from a lack of portability between platforms. Why?
Bit fields are a convenient way to express many difficult operations. However, bit fields
do suffer from a lack of portability between platforms:
Answer:- (Page 183)
integers may be signed or unsigned
Many compilers limit the maximum number of bits in the bit field to the size of an integer which may
be either 16-bit or 32-bit varieties.
Some bit field members are stored left to right others are stored right to left in memory.
If bit fields too large, next bit field may be stored consecutively in memory (overlapping the boundary
between memory locations) or in the next word of memory.
Special characters like TAB and page break must be avoided. These characters are bound to cause problem
for editors, printers, terminal emulators or debuggers when used in a multi-programmer, multi-platform
environment
Question No.44
Define these terms: Branch Coverage, Statement Coverage.
Answer:- (Page 202)
Branch Coverage: In this scheme, all the possible branches of decision structures are tested. Therefore,
sequences of statements following a decision are tested.
AL-JUNAID TECH INSTITUTE
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.
Successful Test
From the following sayings, a successful test can be defined “If you think your task is to find problems then
you will look harder for them than if you think your task is to verify that the program has none” – Myers 1979.
Question No.46
Memory over-runs and their symptoms
Answer:- (Page 220)
A memory overrun occurs when you use memory that does not belong to you. (Symptoms repeated)
Question No.47
Identifier names also play a significant role
Answer:- (Page 148)
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 (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.
Question No. 48
Good clues, Easy Bugs
explain this term.
Answer:- (Page 226)
Good clues, Easy Bugs
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.
Source line numbers in stack trace is the single, most useful piece of debugging information.
After that, values of arguments are important
Are the values improbable (zero, very large, negative, character strings with non-alphabetic
characters?
Debuggers can be used to display values of local or global variables.
These give additional information about what went wrong.
Question No. 49
What is the syntax used for naming objects in a sequence diagrams?
Answer:- (Page 107)
The syntax used for naming objects in a sequence diagram is as follows:
syntax: [instanceName][:className]
Name classes consistently with your class diagram (same classes).
Include instance names when objects are referred to in messages or when several objects of the same
type exist in the diagram.
Question No: 50
Define Textual Analysis? 3 Numbers
Answer:- (Page 90)
The oldest techniques to identify objects and their relationships. This technique is called Textual Analysis. It
was initially developed by Abbot and then extended by Graham and others. In this technique different parts of
speech are identified within the text of the specification and these parts are modeled using different
components.
AL-JUNAID TECH INSTITUTE
Question No: 51
Describe Loop Errors and symptoms? 5 Numbers
Answer:- (Page 220)
Loop Errors
Loop errors break down into several different subtypes.
They occur around a loop construct in a program.
Infinite loops, off-by-one loops, and improperly exited loops.
Symptoms
If your program simply locks up, repeatedly displays the same data over and over, or infinitely displays
the same message box, you should immediately suspect an infinite loop error.
Off-by-one loop errors are quite often seen in processes that perform calculations.
If a hand calculation shows that the total or final sum is incorrect by the last data point, you can quickly
surmise that an off-by-one loop error is to blame.
Likewise, if you were using graphics software and saw all of the points on the screen, but the last two
were unconnected, you would suspect an off-by-one error.
Question No: 52
Write Note on Partitioning? 5 Numbers
Answer:- (Page 135)
Partitioning of architecture is an important concept. What we basically want to do is distribute the
responsibilities to different subsystems so that we get a software system which is easy to maintain. Partitioning
results in a system that suffers from fewer side effects. This ultimately means that we get a system that is easier
to test and extend and hence is easier to maintain.
In the horizontal partitioning we define separate branches of the module hierarchy for each major function and
control modules are used to coordinate communication between functions.
Vertical partitioning divides the application from a decision making perspective. The architecture is partitioned
in horizontal layers so that decision making and work are stratified with the decision making modules residing
at the top of the hierarchy and worker coming at the bottom. This partitioning is also known as factoring.
Question No: 53
How software engineer can work on domains if he gets the technical work..?
Answer:- (Page 5)
“All aspects of software production’ Software engineering is not just concerned with the technical processes of
software development but also with activities such as software project management and with the development of
tools, methods and theories to support software production”.
These definitions make it clear that Software Engineering is not just about writing code.
Question No:54
equivalence classes
Answer:- (Page 199)
Equivalence Classes or Equivalence Partitioning
Two tests are considered to be equivalent if it is believed that:
AL-JUNAID TECH INSTITUTE
if one discovers a defect, the other probably will too, and
If one does not discover a defect, the other probably won’t either.
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.
Question No: 55
Memory and resource leak symptoms 3 marks
Answer:- (Page 216)
Symptoms
System slowdowns
Crashes that occur "randomly" over a long period of time
Question No: 56
Tools and Methods used in software engineering
Answer:- (Page 6 & 11)
Programming Language
Programming Language Design
Software Design Techniques
Tools
Testing
Maintenance
Development etc.
Methods: Methods provide the technical “how-to’s” to carryout these tasks. There could be more than one
technique to perform a task and different techniques could be used in different situations.
Tools: Tools provide automated or semi-automated support for software processes, methods, and quality
control.
Question No: 57
Five guidelines using for Code
Answer:- (Page 150)
1. Names representing types must be nouns and written in mixed case starting with upper case.
Line, FilePrefix
2. Variable names must be in mixed case starting with lower case. line, filePrefix
3. Names representing constants must be all uppercase using underscore to separate words.
MAX_ITERATIONS, COLOR_RED
4. Names representing methods and functions should be verbs and written in mixed case starting with lower
case.
getName(), computeTotalWidth()
Question No: 58
Inspection pre-conditions?
Answer:- (Page 210)
AL-JUNAID TECH INSTITUTE
A precise specification must be available before inspections. Team members must be familiar with the
organization standards. In addition to it, syntactically correct code must be available to the inspectors.
Inspectors should prepare a checklist that can help them during the inspection process.
Question No: 59
WHITE BOX TESTING?
Answer:- (Page 202)
In white box testing we test the structure of the program. In this technique the test cases are written in a manner
to cover different possibilities in code.
Question No: 60
Software development processes?
Answer:- (Page 8)
Software development is a process of balancing among different characteristics of software described in the
previous section. And it is an art to come up with such a good balance and that art can be learned from e
Question No: 61
INCLUDE FILES AND INCLUDE STATEMENT?
Answer:- (Page 157)
1. Header files must include a construction that prevents multiple inclusions. The convention is an all
uppercase construction of the module name, the file name and the h
Suffix.
#ifndef MOD_FILENAME_H
#define MOD_FILENAME_H
:
#endif
The construction is to avoid compilation errors. The construction should appear in the top of the file (before the
file header) so file parsing is aborted immediately and compilation time is reduced.
xperience.
Question No: 62
BALANCING ACT IN SOFTWARE ENGINEERING?
Answer:- (Page 7)
Software Engineering is actually the balancing act. You have to balance many things like cost, user
friendliness, Efficiency, Reliability etc. You have to analyze which one is the more important feature for your
software is it reliability, efficiency, user friendliness or something else.
Question No: 63
THREE NON EXCEPTIONAL PATHS?
Answer:- (Page 185)
if (e.Title() == “CEO” || e.Salary() > 10000)
· if e.Title() == “CEO” is true then the second part is not evaluated and e.Salary() will not be called.
· cout will be performed
AL-JUNAID TECH INSTITUTE
if e.Title() != “CEO” and e.Salary() > 10000
· both parts of the condition will be evaluated
· cout will be performed.
if e.Title() != “CEO” and e.Salary() <= 10000
· both parts of the condition will be evaluated
· cout will not be performed.