Computer Knowledge
Software Testing and Quality Control
2,598 Questions
Software testing and quality control questions cover testing methodologies, unit testing, and defect management. These concepts are crucial for the computer knowledge sections of competitive exams. Practice these questions to understand verification and validation processes thoroughly.
Quality control typesUnit testing purposeSoftware vulnerability testingTest planning tasksLoop testing criteriaTest harness functions
Software Testing and Quality Control Questions
-
a.) Test a single unit of code
-
b.)Test a one module of the application
-
c.)Test a whole application
-
d.)Test the data, stored in database.
A
Correct answer
Explanation
Unit testing specifically focuses on testing the smallest testable part of an application - a single unit of code such as a method, function, or class (Option A). It does NOT test entire modules (Option B), whole applications (Option C), or database data directly (Option D) - those are integration or system testing levels.
-
a.) Name of the Class must end with “Test”
-
b.) Name of the method must start with “test”
-
c.) Return type of the test method must be “void”
-
d.) Test method must not have any parameter.
-
e.) All of the above
E
Correct answer
Explanation
JUnit framework conventions require: test class names ending with 'Test', test method names starting with 'test', test methods returning void, and test methods having no parameters. All of these conventions (Options A-D) are standard JUnit practices, making Option E correct. These conventions help test runners identify and execute test methods correctly.
A
Correct answer
Explanation
JUnit does support both static (using test suites and test runners) and dynamic (using JUnit 4's @Test annotation and JUnit 5's @TestFactory) approaches to run single unit tests. The static approach involves explicit test suite creation, while the dynamic approach uses runtime test discovery and execution through annotations.
-
a.) Using the Mock class, related to corresponding Test class
-
b.) Using the reflection if using Jdk 1.3 or higher version
-
c.) Both a.) & b.)
-
d.) No way to test it
C
Correct answer
Explanation
Private methods can be unit tested using Java Reflection to bypass access modifiers, or by using mocking frameworks and testing subclass/helper structures. Thus, both options are valid approaches.
-
a.) There is no option to test it in Junit
-
b.) Modifying the testcase to run with SecurityManager that prevents calling System.exit, then catch the SecurityException.
-
c.) Remove the System.Exit() line then continue the testing with that methods.
-
d.) Test it everything as-is.
B
Correct answer
Explanation
To test methods containing System.exit(), you can configure a custom SecurityManager that throws a SecurityException when checkExit is called. The test case can then catch this exception to verify that the exit was triggered without terminating the JVM.
-
a.) Reflection provides the option to do this.
-
b.) Copy the method content into the testcase methods.
-
c.) Place your tests in the same package as the classes under test.
-
d.) Can't do the testing for protected methods.
C
Correct answer
Explanation
Protected methods can be tested by placing test classes in the same package as the classes under test (Option C), giving tests access to package-protected members. Reflection (Option A) is possible but not the recommended approach. Copying method content (Option B) defeats the purpose of testing. Option D is incorrect because protected methods are testable.
-
The JUnit JAR file.
-
b.) Location of your JUnit test classes.
-
c.) Location of classes to be tested.
-
d.) JAR files of class libraries that are required by classes to be tested
-
e.) All of the above
E
Correct answer
Explanation
To run JUnit tests, the CLASSPATH must include: the JUnit JAR file itself (Option A), the location of JUnit test classes (Option B), the location of classes being tested (Option C), and any dependent library JARs (Option D). All four components (Option E) are essential for the test runner to find and execute tests properly.
-
a.) Container class, which used to group multiple test cases into a collection and run them together.
-
b.) defines test fixture, which contains all the test methods.
-
c.) interface, which contains the declaration of all the methods, needs to be implemented by Testcases.
-
d.) None of the above
A
Correct answer
Explanation
A JUnit TestSuite is a container class (Option A) used to group multiple test cases into a collection and run them together. It does NOT define test fixtures (Option B) - that's the purpose of @Before/@BeforeAll methods. It is NOT an interface (Option C) - TestSuite is a concrete class. Option D is incorrect because Option A accurately describes TestSuite functionality.
A
Correct answer
Explanation
Yes, you can run JUnit tests in debug mode within modern IDEs (like Eclipse or IntelliJ), allowing you to use breakpoints and step through unit tests just like any other Java application.
-
(A)Version
-
(B)Update
-
(C)Help
-
(D)Patch
-
(E)Syntax
D
Correct answer
Explanation
A patch is a small piece of software designed to fix bugs, defects, or security vulnerabilities. Unlike major version updates or upgrades, patches are typically focused fixes provided free of charge by software vendors to maintain software stability and security.
-
black-box testing
-
white-box testing
-
behavioural testing
-
grey-box testing
B
Correct answer
Explanation
White-box testing (also called glass-box, clear-box, or structural testing) examines the internal structure, design, and coding of software. It requires the tester to have knowledge of the internal code and logic to design test cases that exercise different paths, branches, and conditions within the module. This is in contrast to black-box testing, which focuses on inputs and outputs without knowledge of internal code.
-
Checking that we are building the right system
-
Performed by an independent test team
-
Making sure that it is what the user really wants
-
Checking that we are building the system right
D
Correct answer
Explanation
Verification is the process of checking that we are building the system right - meaning it meets the specified requirements and technical specifications. It answers the question: Are we building the product correctly? This is different from validation, which checks that we are building the right system (whether it meets user needs and expectations).
-
Path Testing
-
Data flow testing
-
Statement testing
-
State Transition testing
D
Correct answer
Explanation
State Transition testing is a black-box testing technique that models system behavior as states and transitions between them. It focuses on the system's external behavior rather than internal code structure. In contrast, Path Testing, Data flow testing, and Statement testing are all white-box techniques that require knowledge of the internal code logic and structure.
-
System Testing
-
Smoke Testing
-
Sanity Testing
-
Performance Testing
B
Correct answer
Explanation
Smoke Testing (also called build verification testing) is performed to verify that the most critical functions of an application work properly without failing, ensuring the build is stable enough for further detailed testing. It acts as a preliminary check to decide whether to proceed with more comprehensive testing. Sanity Testing is similar but focuses on a specific functional area after a regression.
-
One
-
More than two
-
Two
-
Three
C
Correct answer
Explanation
The two main techniques in Black-box testing are Equivalence Partitioning and Boundary Value Analysis. Equivalence Partitioning divides input data into groups expected to be treated similarly, while Boundary Value Analysis focuses on testing at the boundaries between these partitions. These are foundational black-box testing methods.