To test a function, the programmer has to write a ___ which call the function and passes it test data.

  1. Stub

  2. Driver

  3. Proxy

  4. None of the above


Correct Option: B
Explanation:

To solve this question, the user needs to know about software testing and the different types of testing techniques. In particular, the user needs to understand the purpose of test drivers in software testing.

A test driver is a program that calls a software function with specific inputs and checks the return value to verify that the function behaves correctly. The purpose of the test driver is to automate the testing process and ensure that the function works as expected in different scenarios.

Now, let's go through each option and explain whether it is right or wrong:

A. Driver: This option is correct. A driver is a type of test harness that is used to test a software function. It calls the function and passes it test data to verify that the function works as expected. Therefore, option A is the correct answer.

B. Stub: This option is incorrect. A stub is a type of test double that provides a simplified version of a software component for testing purposes. It is used to replace a component that is not yet available or is too complex to test. A stub is not the same as a test driver, so option B is wrong.

C. Proxy: This option is incorrect. A proxy is a type of software component that acts as an intermediary between two applications or systems. It is used to provide security, scalability, or other features. A proxy is not the same as a test driver, so option C is wrong.

D. None of the above: This option is incorrect. At least one of the options (option A) is correct, so option D cannot be the correct answer.

Therefore, the answer is: A. Driver

Find more quizzes: