Monday, 12 May 2025

Write any 4 tests cases for traffic signal.

 

Write any 4 tests cases for traffic signal.

Test Case 1: Red Light Duration

  • Test Case ID: TS001
  • Test Description: Verify that the Red light stays on for the correct duration.
  • Test Steps:

1.      Start the traffic signal system.

2.      Observe the Red light when it turns on.

3.      Use a timer to measure how long it stays on.

  • Expected Result: The Red light should stay on for the specified time (e.g., 60 seconds).
  • Pass/Fail Criteria: Pass if the duration matches 60 seconds; Fail if it is too short or too long.

 

Test Case 2: Green Light After Red

  • Test Case ID: TS002
  • Test Description: Verify that the Green light turns on after the Red light and stays for the correct duration.
  • Test Steps:

1.      Wait for the Red light to turn off.

2.      Observe the Green light turning on.

3.      Measure how long it stays on using a timer.

  • Expected Result: The Green light should turn on immediately after the Red light and stay on for the specified time (e.g., 45 seconds).
  • Pass/Fail Criteria: Pass if the Green light follows the Red light and stays for 45 seconds; Fail otherwise.

 

Test Case 3: Yellow Light Transition

  • Test Case ID: TS003
  • Test Description: Verify that the Yellow light turns on before switching between Red and Green lights.
  • Test Steps:

1.      Observe the Yellow light turning on after the Green light.

2.      Measure how long the Yellow light stays on.

  • Expected Result: The Yellow light should turn on for a short time (e.g., 5 seconds) before changing to Red.
  • Pass/Fail Criteria: Pass if the Yellow light is on for the correct time; Fail otherwise.

 

Test Case 4: Pedestrian Crossing

  • Test Case ID: TS004
  • Test Description: Verify that the pedestrian crossing signal works correctly.
  • Test Steps:

1.      Press the pedestrian crossing button.

2.      Observe the pedestrian signal (e.g., Green light for crossing).

3.      Check if it stops after the crossing duration ends.

  • Expected Result: The pedestrian signal should turn Green when the traffic light is Red and stop after the crossing time (e.g., 30 seconds).
  • Pass/Fail Criteria: Pass if the pedestrian signal behaves as expected; Fail otherwise.


 






Write a test plan for the following sections of IEEE 829 test plan template for a online library system. a) Scope of testing. b) Objectives. c) Risks. d) Strategy. e) Approach.

 

Write a test plan for the following sections of IEEE 829 test plan template for a online library system. 

a) Scope of testing. b) Objectives. c) Risks. d) Strategy. e) Approach.

 

a) Scope of Testing

  • User registration and login

  • Searching and browsing books

  • Viewing book details (author, availability, ISBN)

  • Issuing and returning books

  • Viewing user’s issued book history

  • Admin functions: add/edit/delete books

  • Notifications for due dates


b) Objectives

  • To check that all main features of the online library system are working properly.
  • To make sure both user and admin features are built as needed.
  • To test if the system runs well, is easy to use, and keeps data safe.
  • To find and fix any errors, design issues, or slow parts before the system is launched.

c) Risks

 

Risks

Impact

Mitigation

Unclear or changing requirements

High

Regular reviews with stakeholders

Data inconsistency due to improper return/book status updates

Medium

Conduct integration testing

Limited testing resources or devices

Medium

Cloud testing tools

Network issues affecting access to the online library

Low

Test under different network conditions


D)Test Strategy

  • Functional Testing: To verify each module (search, issue, return) works as expected
  • Usability Testing: To ensure the user interface is intuitive for students and admins
  • Performance Testing: To check how the system performs under heavy user load
  • Security Testing: To ensure secure login and protect user data and records
  • Regression Testing: To make sure new changes don’t break existing features

E)Test Approach

  • Use black-box testing focusing on user inputs and expected output
  • Perform manual testing for exploratory and usability tests
  • Use automated scripts for repetitive tasks like login, search, and book issue/return
  • Divide the test cases into positive (valid inputs) and negative (invalid inputs)
  • Perform testing across different browsers and devices for compatibility
  • Log defects in a defect tracking tool and retest after fixes.

 

Saturday, 26 April 2025

DS Question Bank

                                                               Data Structure Using C

         Question Bank 


  1. What is Graph ? Explain Adjacency list of graph ,adjacency matrix with example

  2. Consider the following Graph and attempt the following :

Weighted graph - Hyperskill

- print the adjacency matrix of the graph 

  Traverse DFS and BFS

  1. Convert the following Infix expression into prefix using a table.

(A+B)/(C+D*E)

  1. Convert the following infix expression into postfix using stacks (symbol table)

A ^ (B – C * D /E) + F

  1. What is stack ? Write Operation on stack with example (Program)

  2. Write a program to implement a dynamic stack

  3. Write a Function Preorder,Postorder,Inorder Traversal

  4. Write a function to sort a DLL

  5. Write a function to print the minimum value from a BST

  6. Write a  program to add two polynomials using 1D Arrays

  7. Draw BST for the following and traverse inorder, preorder and postorder-

45, 40, 27, 58, 63, 72, 18, 44, 47, 50

  1. Write a program to Selection Sort 

  2. Write a Program Linear search on unsorted data 

  3. Explain different types of AVL Rotation with an example.

  4. Data Structured Type

  5. DEQUE, IRDEQ and ORDEQ

  6.  Define degree of a tree, generation, pendent node, depth of a tree 

  7. Algorithm Characteristics

  8. Depth First Search (DFS)


Thursday, 17 April 2025

Write a java servlet program to accept name from user & display on browser

        <html>

<head>

    <title>Enter Name</title>

</head>

<body>

    <form action="nameServlet" method="post">

        Enter your name: <input type="text" name="username">

        <input type="submit" value="Submit">

    </form>

</body>

</html>

 

NameServlet.java

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

 

public class NameServlet extends HttpServlet {

    public void doPost(HttpServletRequest request, HttpServletResponse response)

            throws ServletException, IOException {

 

        response.setContentType("text/html");

        PrintWriter out = response.getWriter();

 

        String name = request.getParameter("username");

 

        out.println("<html><body>");

        out.println("<h2>Hello, " + name + "!</h2>");

        out.println("</body></html>");

    }

}

 

 

C:\apache-tomcat-9\webapps\ROOT\WEB-INF\web.xml

<servlet>

        <servlet-name>NameServlet</servlet-name>

        <servlet-class>NameServlet</servlet-class>

    </servlet>

 

    <servlet-mapping>

        <servlet-name>NameServlet</servlet-name>

        <url-pattern>/nameServlet</url-pattern>

    </servlet-mapping>                 

Write servlet program to accept name of city from where employee belongs and display all records from employee table who belongs to that city in tabular format.


   cityform.html

<html>

<body>

    <h2>Enter City Name</h2>

    <form action="EmployeeCityServlet" method="post">

        City: <input type="text" name="city">

        <input type="submit" value="Search">

    </form>

</body>

</html>

EmployeeCityServlet.java

import java.io.*;

import java.sql.*;

import javax.servlet.*;

import javax.servlet.http.*;

 

public class EmployeeCityServlet extends HttpServlet {

    public void doPost(HttpServletRequest request, HttpServletResponse response)

            throws ServletException, IOException {

       

        response.setContentType("text/html");

        PrintWriter out = response.getWriter();

        String city = request.getParameter("city");

 

        // JDBC connection details (adjust as per your setup)

               try {

             Class.forName("com.mysql.jdbc.Driver");

 Connection con =  DriverManager.getConnection("jdbc:mysql://localhost:3306/mca", "root", "");

 

            String sql = "SELECT * FROM employee WHERE city = ?";

            PreparedStatement ps = con.prepareStatement(sql);

            ps.setString(1, city);

            ResultSet rs = ps.executeQuery();

 

            out.println("<html><body>");

            out.println("<h2>Employees from " + city + "</h2>");

            out.println("<table border='1'><tr><th>ID</th><th>Name</th><th>City</th><th>Salary</th></tr>");

 

            boolean found = false;

            while (rs.next()) {

                found = true;

                out.println("<tr>");

                out.println("<td>" + rs.getInt("id") + "</td>");

                out.println("<td>" + rs.getString("name") + "</td>");

                out.println("<td>" + rs.getString("city") + "</td>");

                out.println("<td>" + rs.getDouble("salary") + "</td>");

                out.println("</tr>");

            }

 

            if (!found) {

                out.println("<tr><td colspan='4'>No employees found in this city.</td></tr>");

            }

 

            out.println("</table>");

            out.println("</body></html>");

 

            rs.close();

            ps.close();

            con.close();

        } catch (Exception e) {

            out.println("<p>Error: " + e.getMessage() + "</p>");

        }

    }

}

 

C:\apac