Home »
MCQs
Jasmine.js Multiple-Choice Questions (MCQs)
Jasmine is an open-source testing framework for JavaScript. It aims to run on any JavaScript-enabled platform, to not intrude on the application nor the IDE, and to have easy-to-read syntax. It is heavily influenced by other unit testing frameworks, such as ScrewUnit, JSSpec, JSpec, and RSpec. Wikipedia
Jasmine.js MCQs: This section contains multiple-choice questions and answers on the various topics of Jasmine.js. Practice these MCQs to test and enhance your skills on Jasmine.js.
List of Jasmine.js MCQs
1. What is Jasmine.js?
- JavaScript testing framework
- JavaScript mobile development framework
- JavaScript web development framework
Answer: A) JavaScript testing framework
Explanation:
Jasmine.js is a JavaScript testing framework.
Discuss this Question
2. Is Jasmine.js open-source?
- Yes
- No
Answer: A) Yes
Explanation:
Yes, Jasmine.js is an open-source framework.
Discuss this Question
3. Does Jasmine.js requires DOM?
- Yes
- No
Answer: B) No
Explanation:
Jasmine.js does not require any DOM.
Discuss this Question
4. Which architecture does Jasmine.js follows?
- MVM
- BDD
- MVVM
- MVP
Answer: B) BDD
Explanation:
Behaviour-driven development architecture does Jasmine.js follows.
Discuss this Question
5. A ____ is a set of related type test cases developed for a given file or function.
- Groups
- Cluster
- Suite
- Collection
Answer: C) Suite
Explanation:
A suite is a set of related type test cases developed for a given file or function.
Discuss this Question
6. Which of the following method is used to define suites?
- Define
- Suits
- Test
- Describe
Answer: D) Describe
Explanation:
Describe method is used to define suites.
Discuss this Question
7. How many arguments does Describe function take?
- 2
- 3
- 4
- 5
Answer: A) 2
Explanation:
Describe function takes two arguments: a text that describes the collection of tests, and a function that includes the tests.
Discuss this Question
8. The ____ block is a single test defined with its method.
- Nested Suites block
- Describe Block
- IT block
- Expect block
Answer: C) IT block
Explanation:
The "it" block is a single test defined by its method.
Discuss this Question
9. ____ is also known as a matcher.
- Nested Suites block
- Describe Block
- IT block
- Expect block
Answer: D) Expect block
Explanation:
Expect block is also known as a matcher.
Discuss this Question
10. Mainly how many types of matchers does Jasmine provides?
- 5
- 4
- 3
- 2
Answer: D) 2
Explanation:
2 types of matchers Jasmine provides: Inbuilt and user-defined.
Discuss this Question
11. Which of the following is an inbuilt matcher?
- toBe
- toEqual
- toBeNull
- All of the above
Answer: D) All of the above
Explanation:
Following are the inbuilt matchers:
Discuss this Question
12. User-defined matcher needs to be defined ____.
- Implicitly
- Explicitly
- Both
Answer: B) Explicitly
Explanation:
Custom matcher needs to be defined explicitly().
Discuss this Question
13. Which of the following inbuilt matcher just compares if the outcome of the operation sent as an argument to this method matches or not?
- Equal ()
- toMatch ()
- toEqual ()
Answer: C) toEqual ()
Explanation:
toEqual () just compares if the outcome of the operation sent as an argument to this method matches or not.
Discuss this Question
14. Which of the following inbuilt matcher is used to determine whether a value does not match the output of any function?
- NotEqual ()
- nottoMatch ()
- toEqual ()
- Not.toEqual()
Answer: D) Not.toEqual()
Explanation:
Not.toEqual () is used to determine whether a value does not match the output of any function.
Discuss this Question
15. In Jasmine, which of the following Boolean matcher is used to determine if the result is true or false?
- toBeTruthy()
- toTruthy():
- CheckTruthy():
Answer: A) toBeTruthy()
Explanation:
toBeTruthy() Boolean matcher is used to determine if the result is true or false.
Discuss this Question
16. Among toBe () and toEqual () which of the following compares objects recursively and checks property equality, and it is type sensitive.
- toBe ()
- toEqual ()
Answer: B) toEqual ()
Explanation:
toEqual () compares objects recursively and checks property equality, and it is type sensitive.
Discuss this Question
17. ____ matchers allow us to determine whether an element belongs to the same array or another sequential object.
- Tocheck ()
- toMatch()
- toContain()
Answer: C) toContain()
Explanation:
toContain() matchers allow us to determine whether an element belongs to the same array or another sequential object.
Discuss this Question
18. Suppose you want to Check to see whether any variables in the code are predefined, then which of the following matcher you will use?
- TobePredefined ()
- toBeDefined
- ToPredefined()
Answer: B) toBeDefined
Explanation:
toBeDefined () Check to see whether any variables in the code are predefined.
Discuss this Question
19. ____ matcher helps to check null values?
- ToNull()
- Null()
- toBeNull()
Answer: C) toBeNull()
Explanation:
toBeNull () matcher helps to check null values.
Discuss this Question
20. When we are unsure about the output, we employ the special matcher named as ____.
- Any
- All
- Some
- None
Answer: A) Any
Explanation:
When we are unsure about the output, we employ the special matcher any.
Discuss this Question
21. How many Spying technologies are available in Jasmine?
- 5
- 4
- 3
- 2
Answer: D) 2
Explanation:
There are two types of spying technology available in Jasmine: SpyOn() and CreateSpy().
Discuss this Question
22. ____ is a feature integrated into the Jasmine framework that allows you to spy on a specific section of code.
- SpyOn()
- Spy ()
- CreateSpy ()
Answer: A) SpyOn()
Explanation:
SpyOn() is a feature integrated into the Jasmine framework that allows you to spy on a specific section of code.
Discuss this Question
23. Which of the following command manages the Jasmine Clock, which may be used to regulate the flow of time in your tests?
- Clock ()
- toBeClock ()
- Jasmine.Clock()
Answer: C) Jasmine.Clock()
Explanation:
Jasmine.Clock () command manages the Jasmine Clock, which may be used to regulate the flow of time in your tests.
Discuss this Question
24. ____ check to see whether any variables were previously undefined.
- toBeNotDefined ()
- toUndefined()
- toBeUndefined ()
Answer: C) toBeUndefined ()
Explanation:
toBeUndefined () check to see whether any variables were previously undefined.
Discuss this Question
25. When jasmine.js was released?
- 2001
- 2019
- 2010
- 2000
Answer: C) 2010
Explanation:
In 2010 jasmine.js was released.
Discuss this Question
26. It() is global function or a Local function?
- Global
- Local
Answer: A) Global
Explanation:
it() function is a global function.
Discuss this Question
27. Which of the following companies uses Jasmine?
- Accenture.
- Walmart.
- E-Commerce.
- GitLab.
- All of the above
Answer: E) All of the above
Explanation:
Following companies use Jasmine:
- Accenture.
- Walmart.
- E-Commerce.
- GitLab.
Discuss this Question
28. Is toBeTruthy () and toBeFalsy the same?
- Yes
- No
Answer: B) No
Explanation:
toBeFalsy matches the output to be false whereas toBeTruthy matches the output to be true.
Discuss this Question
29. After each test specification has been executed, ____ method is invoked
- Each ()
- AfterEach ()
- EachAfter()
Answer: B) AfterEach ()
Explanation:
After each test specification has been executed, afterEach() method is invoked.
Discuss this Question
30. Which of the following are the alternative to Jasmine.js?
- Mocha
- Jest
- Tape
- All of the above
Answer: D) All of the above
Explanation:
Following are the alternatives of Jasmine.js:
Discuss this Question