wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

NodeJs: Cron jobs

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is a cron job in the context of Node.js?

a)

A web server

b)

A scheduled task

c)

An asynchronous function

d)

A database query

2.

Which npm package is commonly used for scheduling cron jobs in Node.js?

a)

express

b)

mongoose

c)

node-schedule

d)

nodemon

3.

What is the purpose of a cron expression in Node.js?

a)

To define a function

b)

To specify a time schedule

c)

To handle errors

d)

To declare variables

4.

In a cron expression, what does "0 0 ***" represent?

a)

Every minute

b)

Every hour

c)

Every midnight

d)

Every second

5.

What is a recommended approach for testing cron jobs in a Node.js project?

a)

Using unit tests for the scheduled function

b)

Manually running the cron job and checking the logs

c)

Running integration tests

d)

All of the options

6.

Every 15 minutes, we want to check the users that just signed up on our platform. Which expression can we use?

a)

*/15 * * * *

b)
  • * */15 * * *

c)
  • * * */15 * *

d)
  • * * * */15 *

7.

We have written our cron job task in main.js. How do we start the process for the cron job

a)

node-schedule main.js

b)

schedule main.js

c)

node main.js

d)

npm start:main

8.
  • * * * * *

    What does the first asterisk signify

a)

days

b)

hours

c)

weeks

d)

minutes

9.

What would be the expression for at every half hour

a)

*/60 * * * *

b)

*/30 * * * *

c)
  • * */60 * * *

d)
  • * */30 * * *

10.

One of the following is not suitable for cron jobs

a)

Data cleanups

b)

Renewing subscriptions

c)

Uploading/Processing images or videos

d)

System maintenance