Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

The number can be compared using __________.

Answer»

The NUMBER can be compared using __________.
(1)toBeGreaterThanOrEqual
(2)All the OPTIONS
(3)toBeLessThan
(4)toEqual
(5)toBeGreaterThan

Answer:-(2)All the options

2.

For Code Coverage Support Jest requires some additional setup and libr

Answer»

For CODE Coverage SUPPORT Jest REQUIRES some ADDITIONAL setup and libraries .
(1)FALSE
(2)True

Answer:-(1)False

3.

______________ resets all information stored in the mockFn.mock.calls and mockFn.mock.instances arrays.

Answer»

______________ resets all INFORMATION stored in the mockFn.mock.calls and mockFn.mock.instances arrays.
(1)mockClear()
(2)mockRestore()
(3)mockReset()
(4)All the options

Answer:-(1)mockClear()

4.

How to install Jest using yarn?

Answer»

How to INSTALL Jest using yarn?
(1)yarn install dev jest
(2)yarn add --dev jest
(3)yarn install --SAVE--dev jest
(4)yarn add save--dev jest

Answer:-(2)yarn add --dev jest

5.

______________ matcher matches only undefined.

Answer»

______________ matcher MATCHES only UNDEFINED.
(1)toBeDefined
(2)toBeTruthy
(3)toBeUndefined

Answer:-(3)toBeUndefined

6.

To test a particular function which throws an error when it's called, you can use toThrow.

Answer»

To test a particular function which THROWS an error when it's called, you can USE toThrow.
(1)False
(2)True

Answer:-(2)True

7.

______________ resets all information stored in the mock, including any inital implementation given.

Answer»

______________ resets all INFORMATION STORED in the mock, including any inital implementation GIVEN.
(1)mockReset()
(2)All the options
(3)mockClear()
(4)mockRestore()

ANSWER:-(1)mockReset()

8.

Jest uses ________ and ________ matchers to test a value is with exact equality.

Answer» JEST uses ________ and ________ matchers to TEST a value is with EXACT equality.
(1)toBeTruthy, toBeFalsy
(2)ToBeEqual , toMatch
(3)ToBe , toEqual
(4)toBeUndefined, toBeDefined

Answer:-(3)ToBe , toEqual
9.

Jest records all calls that have been made during mock function and it is stored in ______________ array.

Answer»

Jest RECORDS all CALLS that have been made during MOCK FUNCTION and it is stored in ______________ array.
(1)mock.instances
(2)mock.calls
(3)mock.objectCalls
(4)None of the options

Answer:-(2)mock.calls

10.

Snapshot tests are a useful tool whenever you want to make sure your UI does not change unexpectedly.

Answer»

Snapshot tests are a useful tool whenever you want to make sure your UI does not CHANGE unexpectedly.
(1)TRUE
(2)False

Answer:-(1)True

11.

Jest will wait until the ______________ callback is called before finishing the test.

Answer»

Jest will WAIT until the ______________ CALLBACK is called before finishing the test.
(1)finish
(2)do
(3)DONE
(4)NONE of the options

Answer:-(3)done

12.

mockRestore() removes the mock and restores the initial implementation

Answer»

mockRestore() removes the MOCK and restores the initial IMPLEMENTATION.
(1)FALSE
(2)True

Answer:-(2)True

13.

The matcher toContain is used _________.

Answer»

The matcher toContain is used _________.
(1)to CHECK an OBJECT is PRESENT in a list
(2)To check if a string contains a letter
(3)none of the options
(4)To check if an array contains a particular ITEM

Answer:-(4)To check if an array contains a particular item

14.

Snapshot Testing is not supported in Jest.

Answer»

Snapshot Testing is not SUPPORTED in JEST.
(1)FALSE
(2)True

Answer:-(1)False

15.

_____ returns the value only once when mock function is called.

Answer»

______________ RETURNS the VALUE only once when mock function is CALLED.
(1)NONE of the options
(2)mockReturnOnce(value)
(3)mockReturnValue(value)
(4)mockReturnValueOnce(value)

Answer:-(4)mockReturnValueOnce(value)

16.

Code coverage tests that how much code is covered under tests.

Answer» CODE coverage TESTS that how MUCH code is covered under tests.
(1)TRUE
(2)False

Answer:-(1)True
17.

When you execute ______________ Code, it will move on to another task before it finishes.

Answer»

When you execute ______________ Code, it will MOVE on to another TASK before it finishes.
(1)SYNCHRONOUS
(2)Asynchronous
(3)both

Answer:-(2)Asynchronous

18.

Jest works well with other testing libraries like ______________.

Answer»

Jest works well with other testing libraries LIKE ______________.
(1)ENZYME
(2)Chai
(3)all the options
(4)TestUtils

Answer:-(3)all the options

19.

Jest is maintained by ______________ .

Answer»

Jest is maintained by ______________ .
(1)Google
(2)Facebook
(3)Microsoft
(4)apache

Answer:-(2)Facebook

20.

Jest is a JavaScript unit testing framework.

Answer»

Jest is a JAVASCRIPT unit testing FRAMEWORK.
(1)True
(2)False

Answer:-(1)True

21.

Jest is used to test _____________.

Answer»

Jest is used to TEST _____________.
(1)Java
(2)PYTHON
(3)JAVASCRIPT
(4)Ruby

Answer:-(3)JavaScript

22.

______________ recursively checks every field of an object or array.

Answer»

______________ recursively checks every field of an object or ARRAY.
(1)TOMATCH
(2)toBe
(3)toBeEqual
(4)toEqual

Answer:-(4)toEqual

23.

.mock is a property of mock function, the place where all information about how the function has been called is kept.

Answer»

.MOCK is a property of mock function, the place where all information about how the function has been CALLED is kept.
(1)FALSE
(2)TRUE

Answer:-(2)True

24.

How to run your test in terminal?

Answer»

How to run your test in TERMINAL?
(1)npm test
(2)all the OPTIONS
(3)npm run test
(4)npm t

Answer:-(2)all the options

25.

Jest supports _____for Isolating functionality into small testable

Answer»

Jest SUPPORTS ______________ for Isolating FUNCTIONALITY into small, testable units under test.
(1)MATCHERS
(2)Mock Functions
(3)Static Functions
(4)None of the options

Answer:-(2)Mock Functions

26.

mockRestore() works only when mock was created with ______________.

Answer»

mockRestore() works only when MOCK was CREATED with ______________.
(1)jest.fn()
(2)jest.spyFn()
(3)jest.spyOn
(4)jest.create()

ANSWER:-(3)jest.spyOn

27.

The Asynchronous code will move on to another task before it finishes.

Answer»

The Asynchronous code will MOVE on to another TASK before it finishes.
(1)FALSE
(2)True

Answer:-(2)True

28.

What is the command to install Jest and the babel-jest?

Answer»

What is the COMMAND to INSTALL Jest and the babel-jest?
(1)$ npm install --save-dev jest babel-jest
(2)$ npm install jest --save-dev babel-jest
(3)$ npm install dev-save jest babel-jest
(4)$ npm install -save-dev jest babel-jest

Answer:-(1)$ npm install --save-dev jest babel-jest

29.

The below test will pass.

Answer»

The below test will pass.
const value = 0.1 + 0.2;
expect(value).TOBE(0.3);
(1)True
(2)FALSE

Answer:-(2)False

30.

You can check strings against regular expressions with ______________

Answer»

You can check strings against regular expressions with ______________ .
(1)TOMATCH
(2)ToClose
(3)TOBE
(4)ToStrMatch

Answer:-(1)toMatch

31.

To create a mock function, we use ***jest.fn()***.

Answer»

To create a MOCK function, we USE ***jest.fn()***.
(1)True
(2)False

Answer:-(1)True