KU 5TH SEM ASSIGNMENT – BSIT (TA) – 52 (WEB PROGRAMMING)
By Ashish Kumar
Assignment: TA (Compulsory)
1. What is the meaning of Web? Explain in detail the building elements of web
Web is a complex network of international , cross plateform, and cross cultural communicating devices, connected to each other without any ordering or pattern.
There are two most important building blocks of web:
HTML and HTTP.
HTML: – HTML stands for Hyper Text Markup Language. HTML is a very simple language used
to “describe” the logical structure of a document. Actually, HTML is often called programming
language it is really not. Programming languages are “Turing-complete”, or “computable”. That
is, programming languages can be used to compute something such as the square root of pi or
some other such task. Typically programming languages use conditional branches and loops
and operate on data contained in abstract data structures. HTML is much easier than all of that.
HTML is simply a ‘markup language’ used to define a logical structure rather than compute
anything.
HTTP: - HTTP is a “request-response” type protocol. It is a language spoken between web
browser (client software) and a web server (server software) so that can communicate with each
other and exchange files. Now let us understand how client/server system works using HTTP. A
client/server system works something like this: A big piece of computer (called a server) sits in
some office somewhere with a bunch of files that people might want access to. This computer
runs a software package that listens all day long to requests over the wires.
2. “ HTML is the Language of the Web” Justify the statement
HTML is often called a programming language it is really not. Programming languages
are ‘Turing-complete’, or ‘computable’. That is, programming languages can be used to compute something
such as the square root of pi or some other such task. Typically programming languages use conditional
branches and loops and operate on data contained in abstract data structures. HTML is much easier than
all of that. HTML is simply a ‘markup language’ used to define a logical structure rather than compute
anything.
For example, it can describe which text the browser should emphasize, which text should be considered
body text versus header text, and so forth.
The beauty of HTML of course is that it is generic enough that it can be read and interpreted by a web
browser running on any machine or operating system. This is because it only focuses on describing the
logical nature of the document, not on the specific style. The web browser is responsible for adding style.
For instance emphasized text might be bolded in one browser and italicized in another. it is up to the
browser to decide
3. Give the different classification of HTML tags with examples for each category
LIST OF HTML TAGS :-
Tags for Document Structure
· HTML
· HEAD
· BODY
Heading Tags
· TITLE
· BASE
· META
· STYLE
· LINK
Block-Level Text Elements
· ADDRESS
· BLOCKQUOTE
· DIV
· H1 through H6
· P
· PRE
· XMP
Lists
· DD
· DIR
· DL
· DT
· LI
· MENU
· OL
· UL
Text Characteristics
· B
· BASEFONT
· BIG
· BLINK
· CITE
· CODE
· EM
· FONT
· I
· KBD
· PLAINTEXT
· S
· SMALL
4. Write CGI application which accepts 3 numbers from the user and displays biggest number using GET and POST methods
#!/usr/bin/perl
#print “Content-type:text/html\n\n”;
#$form = $ENV{‘QUERY_STRING’};
use CGI;
$cgi = new CGI;
print $cgi->header;
print $cgi->start_html( “Question Ten” );
my $one = $cgi->param( ‘one’ );
my $two = $cgi->param( ‘two’ );
my $three = $cgi->param( ‘three’ );
if( $one && $two && $three )
{
$lcm = &findLCM( &findLCM( $one, $two ), $three );
print “LCM is $lcm”;
}
else
{
print ‘
‘;
print ‘Enter First Number
‘;
print ‘Enter Second Number
‘;
print ‘Enter Third Number
‘;
print ‘
‘;
print “
“;
}
print $cgi->end_html;
sub findLCM(){
my $x = shift;
my $y = shift;
my $temp, $ans;
if ($x < $y) {
$temp = $y;
$y = $x;
$x = $temp;
}
$ans = $y;
$temp = 1;
while ($ans % $x)
{
$ans = $y * $temp;
$temp++ ;
}
return $ans;
}
5. What is Javascript? Give its importance in web.
JavaScript is an easy to learn way to “Script“your web pages that is have them to do actions that cannot be handled with HTML alone. With JavaScript, you can make text scroll across the screen like ticker tape; you can make pictures change when you move over them, or any other number of dynamic enhancement.
JavaScript is generally only used inside of HTML document.
i) JavaScript control document appearance and content.
ii) JavaScript control the browser.
iii) JavaScript interact with document content.
iv) JavaScript interact with the user.
v) JavaScript read and write client state with cookies.
vi) JavaScript interact with applets.
vii) JavaScript manipulate embedded images.
6. Explain briefly Cascading Style Sheets
Cascading Style Sheet (CSS) is a part of DHTML that controls the look and placement of the element on the page. With CSS you can basically set any style sheet property of any element on a html page. One of the biggest advantages with the CSS instead of the regular way of changing the look of elements is that you split content from design. You can for instance link a CSS file to all the pages in your site that sets the look of the pages, so if you want to change like the font size of your main text you just change it in the CSS file and all pages are updated.
7. What is CGI? List the different CGI environment variables
CGI or “Common Gateway Interface” is a specification which allows web users to run program from their computer.CGI is a part of the web server that can communicate with other programs running on the server. With CGI, the web server can call up a program, while passing user specific data to a program. The program then processes that data and the server passes the program’s response back to the web browser.
When a CGI program is called, the information that is made available to it can be roughly broken into three groups:-
i). Information about client, server and user.
ii). Form data that are user supplied.
iii). Additional pathname information.
Most Information about client, server and user is placed in CGI environmental variables. Form data that are user supplied is incorporated in environment variables. Extra pathname information is placed in environment variables.
i). GATEWAY_INTERFACE –T he revision of the common Gateway interface that the server uses.
ii). SERVER_NAME – The Server’s hostname or IP address.
iii). SERVER_PORT – The port number of the host on which the server is running.
iv). REQUEST_METHOD – The method with which the information request is issued.
v). PATH_INFO – Extra path information passed to the CGI program
8. What is PERL? Explain PERl control structures with the help of an example
Perl control structures include conditional statement, such as if/elseif/else blocks as well as loop like for each, for and while.
i). Conditional statements
– If condition – The structure is always started by the word if, followed by a condition to be evaluated, then a pair the braces indicating the beginning and end of the code to be executed if the condition is true.
If(condition)
{condition to be executed
}
– Unless – Unless is similar to if. You wanted to execute code only if a certain condition were false.
If($ varname! = 23) {
#code to execute if $ varname is not 23
}
– The same test can be done using unless:
Unless ($ varname== 23) {
#code to execute if $ varname is not 23
}
ii). Looping – Looping allow you to repeat code for as long as a condition is met. Perl has several loop control structures: foreach, for, while and until.
- While Loop – A while loop executes as long as a particular condition is true:
While (condition) {
#code to run as long as condition is true.
}
- Until Loop – A until loops the reverse of while. It executes as long as a particular condition is not true:
While (condition) {
#code to run as long as condition is not true.
}
Assignment: TA (Compulsory)
1. What is the meaning of Web? Explain in detail the building elements of web
Web is a complex network of international , cross plateform, and cross cultural communicating devices, connected to each other without any ordering or pattern.
There are two most important building blocks of web:
HTML and HTTP.
HTML: – HTML stands for Hyper Text Markup Language. HTML is a very simple language used
to “describe” the logical structure of a document. Actually, HTML is often called programming
language it is really not. Programming languages are “Turing-complete”, or “computable”. That
is, programming languages can be used to compute something such as the square root of pi or
some other such task. Typically programming languages use conditional branches and loops
and operate on data contained in abstract data structures. HTML is much easier than all of that.
HTML is simply a ‘markup language’ used to define a logical structure rather than compute
anything.
HTTP: - HTTP is a “request-response” type protocol. It is a language spoken between web
browser (client software) and a web server (server software) so that can communicate with each
other and exchange files. Now let us understand how client/server system works using HTTP. A
client/server system works something like this: A big piece of computer (called a server) sits in
some office somewhere with a bunch of files that people might want access to. This computer
runs a software package that listens all day long to requests over the wires.
2. “ HTML is the Language of the Web” Justify the statement
HTML is often called a programming language it is really not. Programming languages
are ‘Turing-complete’, or ‘computable’. That is, programming languages can be used to compute something
such as the square root of pi or some other such task. Typically programming languages use conditional
branches and loops and operate on data contained in abstract data structures. HTML is much easier than
all of that. HTML is simply a ‘markup language’ used to define a logical structure rather than compute
anything.
For example, it can describe which text the browser should emphasize, which text should be considered
body text versus header text, and so forth.
The beauty of HTML of course is that it is generic enough that it can be read and interpreted by a web
browser running on any machine or operating system. This is because it only focuses on describing the
logical nature of the document, not on the specific style. The web browser is responsible for adding style.
For instance emphasized text might be bolded in one browser and italicized in another. it is up to the
browser to decide
3. Give the different classification of HTML tags with examples for each category
LIST OF HTML TAGS :-
Tags for Document Structure
· HTML
· HEAD
· BODY
Heading Tags
· TITLE
· BASE
· META
· STYLE
· LINK
Block-Level Text Elements
· ADDRESS
· BLOCKQUOTE
· DIV
· H1 through H6
· P
· PRE
· XMP
Lists
· DD
· DIR
· DL
· DT
· LI
· MENU
· OL
· UL
Text Characteristics
· B
· BASEFONT
· BIG
· BLINK
· CITE
· CODE
· EM
· FONT
· I
· KBD
· PLAINTEXT
· S
· SMALL
4. Write CGI application which accepts 3 numbers from the user and displays biggest number using GET and POST methods
#!/usr/bin/perl
#print “Content-type:text/html\n\n”;
#$form = $ENV{‘QUERY_STRING’};
use CGI;
$cgi = new CGI;
print $cgi->header;
print $cgi->start_html( “Question Ten” );
my $one = $cgi->param( ‘one’ );
my $two = $cgi->param( ‘two’ );
my $three = $cgi->param( ‘three’ );
if( $one && $two && $three )
{
$lcm = &findLCM( &findLCM( $one, $two ), $three );
print “LCM is $lcm”;
}
else
{
print ‘
‘;
print ‘Enter First Number
‘;
print ‘Enter Second Number
‘;
print ‘Enter Third Number
‘;
print ‘
‘;
print “
“;
}
print $cgi->end_html;
sub findLCM(){
my $x = shift;
my $y = shift;
my $temp, $ans;
if ($x < $y) {
$temp = $y;
$y = $x;
$x = $temp;
}
$ans = $y;
$temp = 1;
while ($ans % $x)
{
$ans = $y * $temp;
$temp++ ;
}
return $ans;
}
5. What is Javascript? Give its importance in web.
JavaScript is an easy to learn way to “Script“your web pages that is have them to do actions that cannot be handled with HTML alone. With JavaScript, you can make text scroll across the screen like ticker tape; you can make pictures change when you move over them, or any other number of dynamic enhancement.
JavaScript is generally only used inside of HTML document.
i) JavaScript control document appearance and content.
ii) JavaScript control the browser.
iii) JavaScript interact with document content.
iv) JavaScript interact with the user.
v) JavaScript read and write client state with cookies.
vi) JavaScript interact with applets.
vii) JavaScript manipulate embedded images.
6. Explain briefly Cascading Style Sheets
Cascading Style Sheet (CSS) is a part of DHTML that controls the look and placement of the element on the page. With CSS you can basically set any style sheet property of any element on a html page. One of the biggest advantages with the CSS instead of the regular way of changing the look of elements is that you split content from design. You can for instance link a CSS file to all the pages in your site that sets the look of the pages, so if you want to change like the font size of your main text you just change it in the CSS file and all pages are updated.
7. What is CGI? List the different CGI environment variables
CGI or “Common Gateway Interface” is a specification which allows web users to run program from their computer.CGI is a part of the web server that can communicate with other programs running on the server. With CGI, the web server can call up a program, while passing user specific data to a program. The program then processes that data and the server passes the program’s response back to the web browser.
When a CGI program is called, the information that is made available to it can be roughly broken into three groups:-
i). Information about client, server and user.
ii). Form data that are user supplied.
iii). Additional pathname information.
Most Information about client, server and user is placed in CGI environmental variables. Form data that are user supplied is incorporated in environment variables. Extra pathname information is placed in environment variables.
i). GATEWAY_INTERFACE –T he revision of the common Gateway interface that the server uses.
ii). SERVER_NAME – The Server’s hostname or IP address.
iii). SERVER_PORT – The port number of the host on which the server is running.
iv). REQUEST_METHOD – The method with which the information request is issued.
v). PATH_INFO – Extra path information passed to the CGI program
8. What is PERL? Explain PERl control structures with the help of an example
Perl control structures include conditional statement, such as if/elseif/else blocks as well as loop like for each, for and while.
i). Conditional statements
– If condition – The structure is always started by the word if, followed by a condition to be evaluated, then a pair the braces indicating the beginning and end of the code to be executed if the condition is true.
If(condition)
{condition to be executed
}
– Unless – Unless is similar to if. You wanted to execute code only if a certain condition were false.
If($ varname! = 23) {
#code to execute if $ varname is not 23
}
– The same test can be done using unless:
Unless ($ varname== 23) {
#code to execute if $ varname is not 23
}
ii). Looping – Looping allow you to repeat code for as long as a condition is met. Perl has several loop control structures: foreach, for, while and until.
- While Loop – A while loop executes as long as a particular condition is true:
While (condition) {
#code to run as long as condition is true.
}
- Until Loop – A until loops the reverse of while. It executes as long as a particular condition is not true:
While (condition) {
#code to run as long as condition is not true.
}
BSC-IT 5TH SEM ASSIGNMENT BSIT-54 (TA)
By Ashish Kumar
subject:-Software Quality and Testing
Assignment: TA (Compulsory)
1.What is software testing? Software testing is tougher than hardware testing, justify your answer.
Ans:-Software testing is the process of executing a program with the intent of finding errors. It is used to ensure the correctness of a software product. Software testing is also done to add value to software so that its quality and reliability is raised.
Software testing is a critical element of software quality assurance and represents the ultimate process to ensure the correctness of the product. The quality of product always enhances the customer confidence in using the product thereby increasing the business economics. In other words, a good quality product means zero defects, which is derived from a better quality processin testing.Testing the product means adding value to it which means raising the quality or reliability of the program. Raising the reliability of the product means finding and removing errors. Hence one should not test a product to show that it works; rather, one should start with the assumption that the program contains errors and then test the program to find as many errors as possible.
2. Explain the test information flow in a typical software test life cycle.
Ans:- Testing is a complex process and requires effort similar to software development . a typicaltest information flow is show in figure
Predicted Reliability
Software Configuration includes a Software Requirements Specification, a Design Specification, and source code. A test configuration includes a Test Plan and Procedures, test cases, and testing tools. It is difficult to predict the time to debug the code, hence it is difficult to schedule.
Once the right software is available for testing, proper test plan and test cases are developed. Then the software is subjected to test with simulated test data. After the test execution, the testresults are examined. It may have defects or the software is passed with out any defect. The software with defect is subjected to debugging and again tested for its correctness. This process will continue till the testing reports zero defects or run out of time for testing.
3.What is risk in software testing? How risk management improves the quality of the software?
Ans:- The risk associated with a software application being developed are called software risks. These risks can lead to errors in the code affecting the functioning of the application.
Following are the factors that lead to software risks:
- Skills of software
ii. Disgruntled
iii. Poorly defined project objectives
iv. Project risks
v. Technical risks
5. Explain the black and white box testing? Explain with an example. Which method better? List out drawbacks of each one.
Ans:- Black box testing treats the system as a “black-box”, so it doesn’t explicitly use Knowledge of the internal structure or code. Or in other words the Test engineer need not know the internal working of the “Black box” or application.
Main focus in black box testing is on functionality of the system as a whole. The term‘behavioral testing’ is also used for black box testing and white box testing is also sometimes called ‘structural testing’. Behavioral test design is slightly different from black-box test design because the use of internal knowledge isn’t strictly forbidden, but it’s still discouraged.
Disadvantages of Black Box Testing
- The test inputs needs to be from large sample space.
- It is difficult to identify all possible inputs in limited testing time. So writing test cases is slow and difficult
- Chances of having unidentified paths during this testing
White box testing involves looking at the structure of the code. When you know the internal structure of a product, tests can be conducted to ensure that the internal operations performed according to the specification. And all internal components have been adequately exercised. Drawbacks of WBT:
Not possible for testing each and every path of the loops in program. This means exhaustive testing is impossible for large systems.
This does not mean that WBT is not effective. By selecting important logical paths and data structure for testing is practically possible and effective.
6. What is cyclomatic complexity? Explain with an illustration. Discuss its role in software testing and generating test cases.
Ans:-
The cyclomatic complexity gives a quantitative measure of the logical complexity. This value gives the number of independent paths in the basis set, and an upper bound for the number of tests to ensure that each statement is executed at least once. An independent path is any path through a program that introduces at least one new set of processing statements or a new condition
Cyclomatic Complexity of 4 can be calculated as:
1. Number of regions of flow graph, which is 4.
2. #Edges – #Nodes + 2, which is 11-9+2=4.
3. #Predicate Nodes + 1, which is 3+1=4.
The above complexity provides the upper bound on the number of tests cases to be generated or independent execution paths in the program. The independent paths (4 paths) for the program shown in
Independent Paths:
1. 1, 8
2. 1, 2, 3, 7b, 1, 8
3. 1, 2, 4, 5, 7a, 7b, 1, 8
4. 1, 2, 4, 6, 7a, 7b, 1, 8
Cyclomatic complexity provides upper bound for number of tests required to guarantee the coverage of all program statements.
7. What is coupling and cohesion? Mention different types of coupling and cohesion. Explain their role in testing.
Ans:- cohesion is a measure of how strongly-related each piece of functionality expressed by thesource code of a software module is. Methods of measuring cohesion vary from qualitative measures classifying the source text being analyzed using a rubric with a hermeneutics approach to quantitative measures which examine textual characteristics of the source code to arrive at a numerical cohesion score.
Types of cohesion
Coincidental cohesion (worst)
Coincidental cohesion is when parts of a module are grouped arbitrarily; the only relationship between the parts is that they have been grouped together (e.g. a “Utilities” class).
Logical cohesion
Logical cohesion is when parts of a module are grouped because they logically are categorized to do the same thing, even if they are different by nature (e.g. grouping all mouse and keyboard input handling routines).
Temporal cohesion
Temporal cohesion is when parts of a module are grouped by when they are processed – the parts are processed at a particular time in program execution (e.g. a function which is called after catching an exception which closes open files, creates an error log, and notifies the user).
Procedural cohesion
Procedural cohesion is when parts of a module are grouped because they always follow a certain sequence of execution (e.g. a function which checks file permissions and then opens the file).
Communicational cohesion
Communicational cohesion is when parts of a module are grouped because they operate on the same data (e.g. a module which operates on the same record of information).
Sequential cohesion
Sequential cohesion is when parts of a module are grouped because the output from one part is the input to another part like an assembly line (e.g. a function which reads data from a file and processes the data).
coupling or dependency is the degree to which each program module relies on each one of the other modules. Coupling is usually contrasted with cohesion. Low coupling often correlates with high cohesion, and vice versa.
Types of coupling
Content coupling (high)
Content coupling (also known as Pathological coupling) is when one module modifies or relies on the internal workings of another module (e.g., accessing local data of another module).
Therefore changing the way the second module produces data (location, type, timing) will lead to changing the dependent module.
Common coupling
Common coupling (also known as Global coupling) is when two modules share the same global data (e.g., a global variable).
Changing the shared resource implies changing all the modules using it.
External coupling
External coupling occurs when two modules share an externally imposed data format, communication protocol, or device interface.This is basically related to the communication to external tools and devices.
Control coupling
Control coupling is one module controlling the flow of another, by passing it information on what to do (e.g., passing a what-to-do flag).
Stamp coupling (Data-structured coupling)
Stamp coupling is when modules share a composite data structure and use only a part of it, possibly a different part (e.g., passing a whole record to a function that only needs one field of it).
This may lead to changing the way a module reads a record because a field that the module doesn’t need has been modified.
Data coupling
Data coupling is when modules share data through, for example, parameters. Each datum is an elementary piece, and these are the only data shared (e.g., passing an integer to a function that computes a square root).
8. Compare and contrast between Verification and Validation with examples.
Ans:- Verification testing ensures that the expressed user requirements, gathered in the Project Initiation phase, have been met in the Project Execution phase. One way to do this is to produce auser requirements matrix or checklist and indicate how you would test for each requirement. For example, if the product is required to weigh no more than 15 kg. (about 33 lbs.), the test could be, ”Weigh the object – does it weigh 15 kg. or less?”, and note “yes” or “no” on the matrix or checklist.
Validation testing ensures that any implied requirement has been met. It usually occurs in theProject Monitoring and Control phase of project management. Using the above product as an example, you ask the customer, “Why must it be ‘no more than 15 kg.’?” One answer is, “It must be easy to lift by hand.” You could validate that requirement by having twenty different people lift the object and asking each one, “Was the object easily to lift?” If 90% of them said it was easy, you could conclude that the object meets the requirement.
8.What is stress testing? Where do you need this testing? Explain.
Ans:- Stress testing is a form of testing that is used to determine the stability of a given system or entity. It involves testing beyond normal operational capacity, often to a breaking point, in order to observe the results
The Need of stress Testing:-
- A web server may be stress tested using scripts, bots, and various denial of service tools to observe the performance of a web site during peak loads.
Stress testing may be contrasted with load testing:
- Load testing examines the entire environment and database, while measuring the response time, whereas stress testing focuses on identified transactions, pushing to a level so as to break transactions or systems.
- During stress testing, if transactions are selectively stressed, the database may not experience much load, but the transactions are heavily stressed. On the other hand, during load testing the database experiences a heavy load, while some transactions may not be stressed.
System stress testing, also known as stress testing, is loading the concurrent users over and beyond the level that the system can handle, so it breaks at the weakest link within the entire system
10. Software testing is difficult than implementation. Yes or no, justify your answer.
Ans:- Software testing is any activity aimed at evaluating an attribute or capability of a program or system and determining that it meets its required results. Although crucial to software quality and widely deployed by programmers and testers, software testing still remains an art, due to limited understanding of the principles of software. The difficulty in software testing stems from the complexity of software: we cannot completely test a program with moderate complexity. Testing is more than just debugging. The purpose of testing can be quality assurance, verification and validation, or reliability estimation. Testing can be used as a generic metric as well. Correctness testing and reliability testing are two major areas of testing. Software testing is a trade-off between budget, time and quality.
11. What are test cases? Explain the importance of Domain knowledge in test case generation. Mention the difficulties in preparing test cases.
Ans:- A test case is a detailed procedure that fully tests a feature or an aspect of a feature in a test process. These cases describe how to perform a particular test . a test case should be developed for each type of test listed in the test process. Domain knowledge helps to preparing test design easily that’s why it is important.
Difficulties in preparing test data :-
Test data set examples:
1) No data: Run your test cases on blank or default data. See if proper error messages are generated.
2) Valid data set: Create it to check if application is functioning as per requirements and valid input data is properly saved in database or files.
3) Invalid data set: Prepare invalid data set to check application behavior for negative values, alphanumeric string inputs.
4) Illegal data format: Make one data set of illegal data format. System should not accept data in invalid or illegal format. Also check proper error messages are generated.
5) Boundary Condition data set: Data set containing out of range data. Identify application boundary cases and prepare data set that will cover lower as well as upper boundary conditions.
6) Data set for performance, load and stress testing: This data set should be large in volume.
By Ashish Kumar
subject:-Software Quality and Testing
Assignment: TA (Compulsory)
1.What is software testing? Software testing is tougher than hardware testing, justify your answer.
Ans:-Software testing is the process of executing a program with the intent of finding errors. It is used to ensure the correctness of a software product. Software testing is also done to add value to software so that its quality and reliability is raised.
Software testing is a critical element of software quality assurance and represents the ultimate process to ensure the correctness of the product. The quality of product always enhances the customer confidence in using the product thereby increasing the business economics. In other words, a good quality product means zero defects, which is derived from a better quality processin testing.Testing the product means adding value to it which means raising the quality or reliability of the program. Raising the reliability of the product means finding and removing errors. Hence one should not test a product to show that it works; rather, one should start with the assumption that the program contains errors and then test the program to find as many errors as possible.
2. Explain the test information flow in a typical software test life cycle.
Ans:- Testing is a complex process and requires effort similar to software development . a typicaltest information flow is show in figure
Predicted Reliability
Software Configuration includes a Software Requirements Specification, a Design Specification, and source code. A test configuration includes a Test Plan and Procedures, test cases, and testing tools. It is difficult to predict the time to debug the code, hence it is difficult to schedule.
Once the right software is available for testing, proper test plan and test cases are developed. Then the software is subjected to test with simulated test data. After the test execution, the testresults are examined. It may have defects or the software is passed with out any defect. The software with defect is subjected to debugging and again tested for its correctness. This process will continue till the testing reports zero defects or run out of time for testing.
3.What is risk in software testing? How risk management improves the quality of the software?
Ans:- The risk associated with a software application being developed are called software risks. These risks can lead to errors in the code affecting the functioning of the application.
Following are the factors that lead to software risks:
- Skills of software
ii. Disgruntled
iii. Poorly defined project objectives
iv. Project risks
v. Technical risks
5. Explain the black and white box testing? Explain with an example. Which method better? List out drawbacks of each one.
Ans:- Black box testing treats the system as a “black-box”, so it doesn’t explicitly use Knowledge of the internal structure or code. Or in other words the Test engineer need not know the internal working of the “Black box” or application.
Main focus in black box testing is on functionality of the system as a whole. The term‘behavioral testing’ is also used for black box testing and white box testing is also sometimes called ‘structural testing’. Behavioral test design is slightly different from black-box test design because the use of internal knowledge isn’t strictly forbidden, but it’s still discouraged.
Disadvantages of Black Box Testing
- The test inputs needs to be from large sample space.
- It is difficult to identify all possible inputs in limited testing time. So writing test cases is slow and difficult
- Chances of having unidentified paths during this testing
White box testing involves looking at the structure of the code. When you know the internal structure of a product, tests can be conducted to ensure that the internal operations performed according to the specification. And all internal components have been adequately exercised. Drawbacks of WBT:
Not possible for testing each and every path of the loops in program. This means exhaustive testing is impossible for large systems.
This does not mean that WBT is not effective. By selecting important logical paths and data structure for testing is practically possible and effective.
6. What is cyclomatic complexity? Explain with an illustration. Discuss its role in software testing and generating test cases.
Ans:-
The cyclomatic complexity gives a quantitative measure of the logical complexity. This value gives the number of independent paths in the basis set, and an upper bound for the number of tests to ensure that each statement is executed at least once. An independent path is any path through a program that introduces at least one new set of processing statements or a new condition
Cyclomatic Complexity of 4 can be calculated as:
1. Number of regions of flow graph, which is 4.
2. #Edges – #Nodes + 2, which is 11-9+2=4.
3. #Predicate Nodes + 1, which is 3+1=4.
The above complexity provides the upper bound on the number of tests cases to be generated or independent execution paths in the program. The independent paths (4 paths) for the program shown in
Independent Paths:
1. 1, 8
2. 1, 2, 3, 7b, 1, 8
3. 1, 2, 4, 5, 7a, 7b, 1, 8
4. 1, 2, 4, 6, 7a, 7b, 1, 8
Cyclomatic complexity provides upper bound for number of tests required to guarantee the coverage of all program statements.
7. What is coupling and cohesion? Mention different types of coupling and cohesion. Explain their role in testing.
Ans:- cohesion is a measure of how strongly-related each piece of functionality expressed by thesource code of a software module is. Methods of measuring cohesion vary from qualitative measures classifying the source text being analyzed using a rubric with a hermeneutics approach to quantitative measures which examine textual characteristics of the source code to arrive at a numerical cohesion score.
Types of cohesion
Coincidental cohesion (worst)
Coincidental cohesion is when parts of a module are grouped arbitrarily; the only relationship between the parts is that they have been grouped together (e.g. a “Utilities” class).
Logical cohesion
Logical cohesion is when parts of a module are grouped because they logically are categorized to do the same thing, even if they are different by nature (e.g. grouping all mouse and keyboard input handling routines).
Temporal cohesion
Temporal cohesion is when parts of a module are grouped by when they are processed – the parts are processed at a particular time in program execution (e.g. a function which is called after catching an exception which closes open files, creates an error log, and notifies the user).
Procedural cohesion
Procedural cohesion is when parts of a module are grouped because they always follow a certain sequence of execution (e.g. a function which checks file permissions and then opens the file).
Communicational cohesion
Communicational cohesion is when parts of a module are grouped because they operate on the same data (e.g. a module which operates on the same record of information).
Sequential cohesion
Sequential cohesion is when parts of a module are grouped because the output from one part is the input to another part like an assembly line (e.g. a function which reads data from a file and processes the data).
coupling or dependency is the degree to which each program module relies on each one of the other modules. Coupling is usually contrasted with cohesion. Low coupling often correlates with high cohesion, and vice versa.
Types of coupling
Content coupling (high)
Content coupling (also known as Pathological coupling) is when one module modifies or relies on the internal workings of another module (e.g., accessing local data of another module).
Therefore changing the way the second module produces data (location, type, timing) will lead to changing the dependent module.
Common coupling
Common coupling (also known as Global coupling) is when two modules share the same global data (e.g., a global variable).
Changing the shared resource implies changing all the modules using it.
External coupling
External coupling occurs when two modules share an externally imposed data format, communication protocol, or device interface.This is basically related to the communication to external tools and devices.
Control coupling
Control coupling is one module controlling the flow of another, by passing it information on what to do (e.g., passing a what-to-do flag).
Stamp coupling (Data-structured coupling)
Stamp coupling is when modules share a composite data structure and use only a part of it, possibly a different part (e.g., passing a whole record to a function that only needs one field of it).
This may lead to changing the way a module reads a record because a field that the module doesn’t need has been modified.
Data coupling
Data coupling is when modules share data through, for example, parameters. Each datum is an elementary piece, and these are the only data shared (e.g., passing an integer to a function that computes a square root).
8. Compare and contrast between Verification and Validation with examples.
Ans:- Verification testing ensures that the expressed user requirements, gathered in the Project Initiation phase, have been met in the Project Execution phase. One way to do this is to produce auser requirements matrix or checklist and indicate how you would test for each requirement. For example, if the product is required to weigh no more than 15 kg. (about 33 lbs.), the test could be, ”Weigh the object – does it weigh 15 kg. or less?”, and note “yes” or “no” on the matrix or checklist.
Validation testing ensures that any implied requirement has been met. It usually occurs in theProject Monitoring and Control phase of project management. Using the above product as an example, you ask the customer, “Why must it be ‘no more than 15 kg.’?” One answer is, “It must be easy to lift by hand.” You could validate that requirement by having twenty different people lift the object and asking each one, “Was the object easily to lift?” If 90% of them said it was easy, you could conclude that the object meets the requirement.
8.What is stress testing? Where do you need this testing? Explain.
Ans:- Stress testing is a form of testing that is used to determine the stability of a given system or entity. It involves testing beyond normal operational capacity, often to a breaking point, in order to observe the results
The Need of stress Testing:-
- A web server may be stress tested using scripts, bots, and various denial of service tools to observe the performance of a web site during peak loads.
Stress testing may be contrasted with load testing:
- Load testing examines the entire environment and database, while measuring the response time, whereas stress testing focuses on identified transactions, pushing to a level so as to break transactions or systems.
- During stress testing, if transactions are selectively stressed, the database may not experience much load, but the transactions are heavily stressed. On the other hand, during load testing the database experiences a heavy load, while some transactions may not be stressed.
System stress testing, also known as stress testing, is loading the concurrent users over and beyond the level that the system can handle, so it breaks at the weakest link within the entire system
10. Software testing is difficult than implementation. Yes or no, justify your answer.
Ans:- Software testing is any activity aimed at evaluating an attribute or capability of a program or system and determining that it meets its required results. Although crucial to software quality and widely deployed by programmers and testers, software testing still remains an art, due to limited understanding of the principles of software. The difficulty in software testing stems from the complexity of software: we cannot completely test a program with moderate complexity. Testing is more than just debugging. The purpose of testing can be quality assurance, verification and validation, or reliability estimation. Testing can be used as a generic metric as well. Correctness testing and reliability testing are two major areas of testing. Software testing is a trade-off between budget, time and quality.
11. What are test cases? Explain the importance of Domain knowledge in test case generation. Mention the difficulties in preparing test cases.
Ans:- A test case is a detailed procedure that fully tests a feature or an aspect of a feature in a test process. These cases describe how to perform a particular test . a test case should be developed for each type of test listed in the test process. Domain knowledge helps to preparing test design easily that’s why it is important.
Difficulties in preparing test data :-
Test data set examples:
1) No data: Run your test cases on blank or default data. See if proper error messages are generated.
Test data set examples:
1) No data: Run your test cases on blank or default data. See if proper error messages are generated.
2) Valid data set: Create it to check if application is functioning as per requirements and valid input data is properly saved in database or files.
3) Invalid data set: Prepare invalid data set to check application behavior for negative values, alphanumeric string inputs.
4) Illegal data format: Make one data set of illegal data format. System should not accept data in invalid or illegal format. Also check proper error messages are generated.
5) Boundary Condition data set: Data set containing out of range data. Identify application boundary cases and prepare data set that will cover lower as well as upper boundary conditions.
6) Data set for performance, load and stress testing: This data set should be large in volume.
BSC-IT 5TH SEMESTER ASSIGNMENTS BSIT-51(TA) & (TB)
By Ashish Kumar
By Ashish Kumar
BSC-IT 5TH SEM ASSIGNMENT – BSIT (TA) – 51 (GRAPHICS & MULTIMEDIA)
Assignment: TA (Compulsory)
Subject: Graphics and multimedia
1.What is the meaning of interactive computer graphics? List the various applications of the computer graphics.
The term “interactive graphics” refers to devices and systems that facilitate the man-machine graphic communication, in a way, which is more convenient than the writing convention. For example, to draw a straight line between two points, one has to input the coordinates of the two end points. In interactive graphics with the help of graphical input technique by indicating two end points on the display screen draws the line.
Various applications of the computer graphics are listed below :-
i). Building Design and Construction
ii). Electronics Design
iii). Mechanical Design
iv). Entertainment and Animation
v). Aerospace Industry
vi). Medical Technology
vii). Cartography
viii). Art and Commerce.
2. Explain in detail the Hardware required for effective graphics on the computer system.
The hardware components required to generate interactive graphics are the input device, the outputdevice (usually display) and the computer system. The human operator is also an integral part of the interactive system. The text and graphics displayed act as an input to the human vision system and, therefore, the reaction of the human being will depend on how quickly one can see and appreciate the graphics present on the display.
3. Compare Raster scan system with random scan system.
In raster scan display, the electron beam is swept across the screen, one row at a time from top to bottom. The picture definition is stored in a memory area called refresh buffer or frame buffer. In random scan display unit, a CRT has the electron beam directed only to the parts of the screen where a picture is to be drawn. It draws a picture one line at a time and so it is referred to as vector displays.
Raster scan The Most common type of graphics monitor employing a CRT is the raster-scan Display, based on television technology. In a raster- scan system; the electron beam is swept across the screen, one row at a time from top to bottom. The picture definition is stored in a memory area called the refresh buffer or frame buffer. Each point on the screen is called pixel. On a black and system with one bit per pixel, the frame buffer is called bitmap. For systems with multiple bits per pixel, the frame buffer is referred to as a pix map.Refreshing on raster scan display is carried out at the rate of 60 to 80 frames per second. Some displays use interlaced refresh procedure. First, all points on the even numbered scan lines are displayed then all the points along odd numbered lines are displayed. This is an effective technique for avoiding flickering.
Random scan display When operated as a random-scan display unit, a CRT has the electron beam directed only to the parts of the screen where a picture is to be drawn. Random scan monitors draw a picture one line at a time and for this reason they are also referred as vector displays (or stroke-writing or calligraphic displays). The component lines of a picture can be drawn and refreshed by a random-scan system in any specified order. A pen plotter operates in a similar way and is an example of a random-scan, hard-copy device.Refresh rate on a random-scan system depends on the number of lines to be displayed. Picture definition is now stored as a set of line- drawing commands in an area of memory referred to as the refresh display file. Sometimes the refresh display file is called the display list, display program, or simply the refresh buffer.
4. How many colors are possible if a. 24 bits / pixel is used b. 8 bits / pixel is used Justify your answer
a). 24 bit color provides 16.7 million colors per pixels, That 24 bits are divided into 3 bytes; one each for the read, green, and blue components of a pixel.
b). 256, 8 bits per pixel = 2^8 colours.
Widely accepted industry standard uses 3 bytes, or 24 bits, per pixel, with one byte for each primary color results in 256 different intensity levels for each primary color. Thus a pixel can take on a color from 256 X 256 X 256 or 16.7 million possible choices. In Bi-level image representation one bit per pixel is used to represent black-and white images. In gray level image 8 bits per pixel to allow a total of 256 intensity or gray levels. Image representation using lookup table can be viewed as a compromise between our desire to have a lower storage requirement and our need to support a reasonably sufficient number of simultaneous colors.
5. List and explain different text mode built-in functions of C Programming language.
The different text mode built-in functions of C Programming language are listed below :-
i). textmode( int mode); This function sets the number of rows and columns of the screen, mode variable can take the values 0, 1, 1, or 3. 0: represents 40 column black and white 1: represents 40 column color 2: represents 80 column black and white 3: represents 80 column color Example: textmode(2); // sets the screen to 80 column black and white
ii). clrscr(); This function clears the entire screen and locates the cursor on the top left corner(1,1) Example clrscr(); // clears the screen
iii). gotoxy(int x, int y); This function positions the cursor to the location specified by x and y. x represents the row number and y represents the column number. Example: gotoxy(10,20) // cursor is placed in 20th column of 10th row
iv). text background (int color); This function changes the background color of the text mode. Valid colors for the CGA are from 0 to 6 namely BLACK, BLUE, GREEN, CYAN, RED, MAGENTA and BROWN. Example: textbackground(2); Or //changes background color to blue text background(BLUE);
v). text color (int color); This function sets the subsequent text color numbered between 0 to 15 and 128 for blinking. Example : textcolor(3); // set the next text color to Green
vi). delline (); It is possible to delete a line of text and after the deletion all the subsequent lines will be pushed up by one line Example : /* deletes the 5th line*/ gotoxy (5,4); delline ( );
vii). insline() Inserts a blank line at the current cursor position Example: /* inserts line at the 3rd row */ gotoxy (3,5); insline ( );
6. Write a C program to create Indian national flag.
#include”graphics.h”
#include”conio.h”
void main()
{
int gd=DETECT,gm,x,y;
initgraph(&gd,&gm,”c:\\tc\\bgi”);
x=getmaxx();
y=getmaxy();
clearviewport();
setfillstyle(LINE_FILL,BLUE);
bar(0,0,639,479);
setcolor(6);
rectangle(50,50,300,200);
setfillstyle(SOLID_FILL,6);
bar(50,50,300,100);
setfillstyle(SOLID_FILL,WHITE);
bar(50,100,300,150);
setfillstyle(SOLID_FILL,GREEN);
bar(50,150,300,200);
setcolor(BLUE);
rectangle(45,45,50,300);
setfillpattern(0×20,MAGENTA);
bar(45,45,50,400);
setcolor(BLUE);
circle(175,125,25);
line(175,125,200,125);
line(175,125,175,150);
line(175,125,150,125);
line(175,125,175,100);
line(175,125,159,107);
line(175,125,193,143);
line(175,125,159,143);
line(175,125,193,107);
setcolor(YELLOW);
rectangle(0,0,640,43);
setfillstyle(SOLID_FILL,YELLOW);
bar(0,0,640,43);
setcolor(BLACK);
settextstyle(1,HORIZ_DIR,5);
outtextxy(150,0,”INDIAN FLAG”);
getch();
}
Assignment: TA (Compulsory)
Subject: Graphics and multimedia
1.What is the meaning of interactive computer graphics? List the various applications of the computer graphics.
The term “interactive graphics” refers to devices and systems that facilitate the man-machine graphic communication, in a way, which is more convenient than the writing convention. For example, to draw a straight line between two points, one has to input the coordinates of the two end points. In interactive graphics with the help of graphical input technique by indicating two end points on the display screen draws the line.
Various applications of the computer graphics are listed below :-
i). Building Design and Construction
ii). Electronics Design
iii). Mechanical Design
iv). Entertainment and Animation
v). Aerospace Industry
vi). Medical Technology
vii). Cartography
viii). Art and Commerce.
2. Explain in detail the Hardware required for effective graphics on the computer system.
The hardware components required to generate interactive graphics are the input device, the outputdevice (usually display) and the computer system. The human operator is also an integral part of the interactive system. The text and graphics displayed act as an input to the human vision system and, therefore, the reaction of the human being will depend on how quickly one can see and appreciate the graphics present on the display.
3. Compare Raster scan system with random scan system.
In raster scan display, the electron beam is swept across the screen, one row at a time from top to bottom. The picture definition is stored in a memory area called refresh buffer or frame buffer. In random scan display unit, a CRT has the electron beam directed only to the parts of the screen where a picture is to be drawn. It draws a picture one line at a time and so it is referred to as vector displays.
Raster scan The Most common type of graphics monitor employing a CRT is the raster-scan Display, based on television technology. In a raster- scan system; the electron beam is swept across the screen, one row at a time from top to bottom. The picture definition is stored in a memory area called the refresh buffer or frame buffer. Each point on the screen is called pixel. On a black and system with one bit per pixel, the frame buffer is called bitmap. For systems with multiple bits per pixel, the frame buffer is referred to as a pix map.Refreshing on raster scan display is carried out at the rate of 60 to 80 frames per second. Some displays use interlaced refresh procedure. First, all points on the even numbered scan lines are displayed then all the points along odd numbered lines are displayed. This is an effective technique for avoiding flickering.
Random scan display When operated as a random-scan display unit, a CRT has the electron beam directed only to the parts of the screen where a picture is to be drawn. Random scan monitors draw a picture one line at a time and for this reason they are also referred as vector displays (or stroke-writing or calligraphic displays). The component lines of a picture can be drawn and refreshed by a random-scan system in any specified order. A pen plotter operates in a similar way and is an example of a random-scan, hard-copy device.Refresh rate on a random-scan system depends on the number of lines to be displayed. Picture definition is now stored as a set of line- drawing commands in an area of memory referred to as the refresh display file. Sometimes the refresh display file is called the display list, display program, or simply the refresh buffer.
4. How many colors are possible if a. 24 bits / pixel is used b. 8 bits / pixel is used Justify your answer
a). 24 bit color provides 16.7 million colors per pixels, That 24 bits are divided into 3 bytes; one each for the read, green, and blue components of a pixel.
b). 256, 8 bits per pixel = 2^8 colours.
Widely accepted industry standard uses 3 bytes, or 24 bits, per pixel, with one byte for each primary color results in 256 different intensity levels for each primary color. Thus a pixel can take on a color from 256 X 256 X 256 or 16.7 million possible choices. In Bi-level image representation one bit per pixel is used to represent black-and white images. In gray level image 8 bits per pixel to allow a total of 256 intensity or gray levels. Image representation using lookup table can be viewed as a compromise between our desire to have a lower storage requirement and our need to support a reasonably sufficient number of simultaneous colors.
5. List and explain different text mode built-in functions of C Programming language.
The different text mode built-in functions of C Programming language are listed below :-
i). textmode( int mode); This function sets the number of rows and columns of the screen, mode variable can take the values 0, 1, 1, or 3. 0: represents 40 column black and white 1: represents 40 column color 2: represents 80 column black and white 3: represents 80 column color Example: textmode(2); // sets the screen to 80 column black and white
ii). clrscr(); This function clears the entire screen and locates the cursor on the top left corner(1,1) Example clrscr(); // clears the screen
iii). gotoxy(int x, int y); This function positions the cursor to the location specified by x and y. x represents the row number and y represents the column number. Example: gotoxy(10,20) // cursor is placed in 20th column of 10th row
iv). text background (int color); This function changes the background color of the text mode. Valid colors for the CGA are from 0 to 6 namely BLACK, BLUE, GREEN, CYAN, RED, MAGENTA and BROWN. Example: textbackground(2); Or //changes background color to blue text background(BLUE);
v). text color (int color); This function sets the subsequent text color numbered between 0 to 15 and 128 for blinking. Example : textcolor(3); // set the next text color to Green
vi). delline (); It is possible to delete a line of text and after the deletion all the subsequent lines will be pushed up by one line Example : /* deletes the 5th line*/ gotoxy (5,4); delline ( );
vii). insline() Inserts a blank line at the current cursor position Example: /* inserts line at the 3rd row */ gotoxy (3,5); insline ( );
6. Write a C program to create Indian national flag.
#include”graphics.h”
#include”conio.h”
void main()
{
int gd=DETECT,gm,x,y;
initgraph(&gd,&gm,”c:\\tc\\bgi”);
x=getmaxx();
y=getmaxy();
clearviewport();
setfillstyle(LINE_FILL,BLUE);
bar(0,0,639,479);
setcolor(6);
rectangle(50,50,300,200);
setfillstyle(SOLID_FILL,6);
bar(50,50,300,100);
setfillstyle(SOLID_FILL,WHITE);
bar(50,100,300,150);
setfillstyle(SOLID_FILL,GREEN);
bar(50,150,300,200);
setcolor(BLUE);
rectangle(45,45,50,300);
setfillpattern(0×20,MAGENTA);
bar(45,45,50,400);
setcolor(BLUE);
circle(175,125,25);
line(175,125,200,125);
line(175,125,175,150);
line(175,125,150,125);
line(175,125,175,100);
line(175,125,159,107);
line(175,125,193,143);
line(175,125,159,143);
line(175,125,193,107);
setcolor(YELLOW);
rectangle(0,0,640,43);
setfillstyle(SOLID_FILL,YELLOW);
bar(0,0,640,43);
setcolor(BLACK);
settextstyle(1,HORIZ_DIR,5);
outtextxy(150,0,”INDIAN FLAG”);
getch();
}
Post a Comment