Loading

Quipoin Menu

Learn • Practice • Grow

angular / Testing Basics
mcq
Direction: Choose the correct option

Q1.

What testing framework does Angular use by default?
A. Jasmine
B. Jest
C. Karma
D. Mocha
Direction: Choose the correct option

Q2.

What is TestBed in Angular testing?
A. A test bed
B. A test environment
C. A utility for configuring and creating Angular testing modules
D. A testing tool
Direction: Choose the correct option

Q3.

How do you create a component for testing?
A. `new MyComponent()`
B. `MyComponent.create()`
C. `renderComponent(MyComponent)`
D. `TestBed.createComponent(MyComponent)`
Direction: Choose the correct option

Q4.

What is a `ComponentFixture`?
A. A debug element
B. A handle to interact with the component and its template
C. A test component
D. A fixture for components
Direction: Choose the correct option

Q5.

What does `fixture.detectChanges()` do?
A. Detects changes in the test
B. Updates the fixture
C. Compiles the template
D. Triggers change detection for the component
Direction: Choose the correct option

Q6.

What is the `DebugElement`?
A. A wrapper around the DOM element that provides additional testing capabilities
B. Element wrapper
C. Testing element
D. Debug element
Direction: Choose the correct option

Q7.

How do you query an element in a test?
A. `fixture.find('div')`
B. `fixture.query('div')`
C. `fixture.element('div')`
D. `fixture.debugElement.query(By.css('div'))`
Direction: Choose the correct option

Q8.

What is the purpose of `fakeAsync`?
A. Mock async
B. Async testing
C. Fake async
D. To write asynchronous tests in a synchronous way
Direction: Choose the correct option

Q9.

What does `tick()` do in a `fakeAsync` test?
A. Ticks the clock
B. Simulates the passage of time
C. All of the above
D. Advances time
Direction: Choose the correct option

Q10.

What is the `async` function in testing?
A. Async helper
B. A utility for writing tests that contain asynchronous code
C. Async function
D. Async test