Redis Interview Question-Answer

Q.1 ____________ is the number of sentinels that need to agree to the fact that the master is not reachable and make a failover procedure promoting the slave to master.

       A. Master

       B. Quorum

       C. Sentinel

       D. Total number of servers in the cluster

Ans : Quorum

Q.2 Which is the best way to achieve persistence in Redis?

       A. Value

       B. Fork ()

       C. SAVE command

       D. AOF

Ans : AOF

Q.3 Which is a difference between Memcached and Redis?

       A. Single threaded

       B. Key-value datastore

       C. Used for caching

       D. In-memory

Ans : Single threaded

Q.4 Redis is widely used as a secondary database for ___________.

       A. Storing

       B. Primary Memory

       C. Caching

       D. Secondary Memory

Ans : Caching

Q.5 When using Pipelining, will the additional memory used be high?

       A. Yes

       B. Very less

       C. No

       D. Partially high

Ans : Yes

Q.6 Which configuration setting specifies the file to which the RDB snapshot dump is saved?

       A. dbfilename

       B. pidfile

       C. dir

       D. logfile

Ans : dbfilename

Q.7 Redis is single threaded.

       A. True

       B. False

Ans : True

Q.8 Which is the default persistence mode in Redis?

       A. AOF

       B. RDB

Ans : RDB

Q.9 Redis provides multi-state architecture during replication, where every instance can both read and write.

       A. True

       B. False

Ans : False

Q.10 redis.conf is configured for changing ____________ to connect to the Redis server.

       A. Port

       B. Key

       C. Memory

       D. Value

Ans : Port

Q.11 Redis can be configured to meet different requirements by editing the configuration settings in __________.

       A. redis.conf

       B. del.conf

       C. redis-cli

       D. redis.edit

Ans : redis.conf

Q.12 The following are all Key Value databases, except __________.

       A. Riak

       B. Memcached

       C. MongoDB

       D. Redis

Ans : Memcached

Q.13 Which of the following set commands removes and returns members of a set?

       A. SMOVE

       B. SDEL

       C. SREM

       D. SPOP

Ans : SPOP

Q.14 _______ returns an array of values.

       A. HMGET

       B. ZADD

       C. HGET

       D. HKEYS

Ans : HGET

Q.15 _________ returns the number of elements in a set.

       A. SLEN

       B. SCARD

       C. SINDEX

       D. SMEMBERS


Q.16 _______ sets the key to expire within the given number of seconds.

       A. EXPIRE

       B. TTL

       C. ZRANGE

       D. PERSIST


Q.17 Consider “a” as a shared key among two processes, A and B.
Process A: Set a 10, INCRBY a 2, get a.
Process B: INCR a, get a.

Which of the following will be the final value for a?

       A. 13

       B. 10

       C. 11

       D. 12

Ans : 13

Q.18 Which of the following does the Redis Hashes store?

       A. Length of the file

       B. Key

       C. Value

       D. Key value pairs

Ans : Key value pairs

Q.19 Given is a code snippet.> lpush numbers 4> lpush numbers 3> lpush numbers 7> rpush numbers 10> rpush numbers 15> lpush numbers 12

Which of the following will be the output for the given code?

       A. 15, 10, 7, 3, 4, 12

       B. 3, 4, 7, 10, 12, 15

       C. 4, 3, 7, 12, 15, 10

       D. 12, 7, 3, 4, 10, 15

Ans : 12, 7, 3, 4, 10, 15

Q.20 The _________ command is used to remove the expiration from a key.

       A. Rem

       B. Expire

       C. Persist

       D. Del

Ans : Persist

Q.21 The data structure commonly used in Redis is ____________.

       A. Sets

       B. Queue

       C. Batches

       D. Get

Ans : Sets

Q.22 _______ sets the key to expire within the given number of seconds.

       A. PERSIST

       B. TTL

       C. EXPIRE

       D. ZRANGE


Q.23 Which of the following commands returns the remaining time for the key to expire?

       A. PPL

       B. TTL

       C. EXISTS

Ans : TTL

Q.24 The following are commands of sorted sets, except ________.


       B. ZADD

       C. ZREVRANK



Q.25 Sets are unordered collection of strings.

       A. True

       B. False

Ans : True

Leave a Comment

Your email address will not be published. Required fields are marked *