# Celery Interview Question-Answer Part – 2

Q.1 consider

def xsum(numbers):
return sum(numbers)
What is the map equivalent of

def
temp():
return [xsum(range(10)), xsum(range(100))]
Assume all needed methods are imported

A. ~xsum.map([range(100), range(100)])

B. ~xsum.map([range(100), range(10)])

C. ~xsum.map([range(10), range(100)])

D. ~xsum.map([range(10), range(10)])

Ans : ~xsum.map([range(10), range(100)])

Q.2 consider a method

return a + b

What is a partial signature?

B. s2 = sum.s(2, 3)

D. s2 = sum.s(2)

Ans : s2 = sum.s(2, 3)

Q.3 Consider a chain

res = chain(add.s(4, 4), mul.s(8), mul.s(10))()

where add is defined as a+b and mul is defined as a*b. How can we get intermediate parent results

A. res.parent.parent.get()

B. res.parent.get()

C. res.parent.parent

D. All the options

Ans : res.parent.get()

Q.4 To ensure a job runs every 15 mins using crontab(), what should be given?

A. crontab(minute=’15’)

B. crontab(minute=’15,30,45′)

C. crontab(minute=’*/15′)

D. crontab(minute=’15,30,45′) AND crontab(minute=’15’)

Ans : crontab(minute=’*/15′)

Q.5 When using solar scheduling, what is sunrise event?

A. Execute when the upper edge of the sun appears over the eastern horizon in the morning.

B. Execute at the moment after which the sky is no longer completely dark. This is when the sun is 18 degrees below the horizon.

C. Execute when there’s enough sunlight for the horizon and some objects to be distinguishable; formally, when the sun is 12 degrees below the horizon.

D. Execute when there’s enough light for objects to be distinguishable so that outdoor activities can commence; formally, when the Sun is 6 degrees below the horizon.

Ans : Execute when the upper edge of the sun appears over the eastern horizon in the morning.

Q.6 Solar events are

A. sunset

B. sunrise

C. dawn

D. dusk

E. All the options

Ans : All the options

Q.7 To start celery beat service using a custom file is achieved using

A. celery -A proj beat /home/celery/var/run/celerybeat-schedule

B. celery -A proj beat -s /home/celery/var/run/celerybeat-schedule

C. celery -A proj beat -file /home/celery/var/run/celerybeat-schedule

D. celery -A proj beat -f /home/celery/var/run/celerybeat-schedule

Ans : celery -A proj beat -s /home/celery/var/run/celerybeat-schedule

Q.8 What does the command do

\$ celery -A proj inspect query_task id1 id2 … idN

A. show the corresponding queues

B. show the task status of id1 id2 … idN

C. show the workers for the corresponding tasks

Q.9 Worker-hearbeat events are sent every

A. 2 min

B. 1 min

C. 4 min

D. 3 min

Ans : 1 min

Q.10 Following command gives

\$ rabbitmqctl list_queues name memory

B. amount of memory allocated to queue

C. command options incorrect error

D. number of workers currently consuming from a queue named memory

Q.11 Django database scheduler can detect timezone changes and automatically reset schedule.

A. True

B. False

Ans : False

Q.12 What does the command do

\$ celery -A proj purge -X celery

A. Purge messages from the celery queue

B. Purge messages from all configured task queues

C. Purge messages from all queues other than celery queue

D. None of the options

Ans : Purge messages from all queues other than celery queue

Q.13 To process events in real time you need

A. State

B. A set of handlers

C. An event consumer

D. All the options

Ans : All the options

Q.14 What dependencies does celery have?

A. billiard

B. pytz

C. kombu

D. All the options

Ans : All the options

Q.15 If app=celery(), task is created using _____ decorator?

B. app

D. All the options

Q.16 To configure a database backend as a result backend, the configuration is

Which databases are supported?

A. mysql and postgresql

B. mysql

C. postgresql

D. oracle

E. All the options

Ans : All the options

Q.17 consider

Name the broker.

A. Amazon SQS

B. Redis

C. RabbitMQ

D. None of the options

Ans : Redis

Q.18 What brokers does celery support?

A. RabbitMQ, Oracle Message Broker, IBM Websphere

B. RabbitMQ, Redis, Oracle Message Broker

C. RabbitMQ, Redis, Amazon SQS

D. Oracle Message Broker, IBM Websphere, Redis

Ans : RabbitMQ, Redis, Amazon SQS

Q.19 heartbeat_sent, worker_init and celeryd_init are ____ signals

A. beat

B. worker

C. eventlet

Ans : worker

Q.20 Which are the features of celery

A. time & rate limts

B. Scheduling

C. work-flows

D. Monitoring

E. All the options

Ans : All the options

Q.21 Celery supports the following serialization

A. pickle

B. YAML

C. JSON

D. msgpack

E. All the options

Ans : All the options

Q.22 Queues created by celery are ____ by default

A. transient

B. persistent

C. none

D. both

Ans : persistent

Q.23 Celery uses headers to store the content type of the message and its content encoding.

A. True

B. False

Ans : True

Q.24 Broadcast routing delivers copies of all tasks to all workers connected to a queue.

A. True

B. False

Ans : True

Q.25 If no custom application has been initiated, celery always creates a special app. It is called

A. app

B. default

C. special

D. celery

Ans : celery

Q.26 \$ celery -A proj control enable_events

is used to

B. dump events

C. disable event messages

D. enable event messages

Ans : enable event messages

Q.27 To create a queue not defined on task_queues, use

Q.28 A client sending messages is a

A. consumer

B. publisher

C. Broker is RabbitMQ, backend is Redis

D. None of the options

Ans : Broker is RabbitMQ, backend is Redis

Q.29 Creating a celery instance will do the following

A. Create a logical clock instance, used for events