Redis Questions and Answers

Redis Multiple Choice Questions and Answers

Question#1 _ is used to flush the transaction queue and exit from the transaction.

i) Discard

ii) Multi

iii) Exec

Answer:- Discard

Question#2 Which of the following does the Redis Hashes store?

i) Key

ii) Key value pairs

iii) Length of the file

iv) Value

Answer:- Key value pairs

Question#3 _ is a type of lock that allows you to limit the number of processes that can concurrently access a resource to some fixed number.
i) Lock with timeouts

ii) Optimistic locking

iii) Counting semaphore

iv) Distributed locking

Answer:- Counting semaphore

Question#4 In a Redis transaction, we can use __ command to enter into the transaction and queue the transaction commands instead of executing them.

i) Multi

ii) Discard

iii) Exec

Answer:- Multi

Question#5 ZSCORE command returns the range of members in a sorted set, by score.

i) True

ii) False

Answer:- False

Question#6 Which of the following commands returns the remaining time for the key to expire?

i) TTL

ii) EXISTS

iii) PPL

Answer:- TTL

Question#7 Which of the following commands is used to post the message to the channel?

i) PRINT

ii) PUBLISH

iii) All the options

Answer:- PUBLISH

Question#8 Which is the short structure that Redis provides for the compact representation of Sets?

i) Intset-max

ii) intset

iii) ziplist

iv) Set-max

Answer:- intset

Question#9 __ implies the maximum allowed size of each individual element in the data structure to be encoded to ziplist short structure.

i) max-ziplist-entries

ii) list-max-ziplist-value

iii) hash-max-ziplist-entries

iv) max-ziplist-value

Answer:- max-ziplist-value

Question#10 Which among the following factors helps in calculating the number of shards in Redis?

i) Number of keys in a single shard

ii) Number of keys in multiple shards

iii) Partition key

iv) Hash data structure

Answer:- Number of keys in a single shard

Question#11 _ is the memory policy that returns errors when the memory limit is reached, and the client is trying to execute commands that result in higher memory usage.

i) allkeys-random

ii) noeviction

iii) allkeys-lru

Answer:- noeviction

Question#12 Which configuration setting is used to specify the memory eviction policy in Redis?

i) maxmemory-samples

ii) max-memory

iii) flushdb

iv) maxmemory-policy

Answer:- maxmemory-policy

Question#13 Which among the following is a benefit of Pipelining?

i) Less commands

ii) Data as batches

iii) Speed

iv) Primary memory

Answer:- Speed

Question#14 Twemproxy is a proxy developed at Twitter for Redis protocol for automatic partitioning among multiple Redis instances and optional ejection of the node if it is not available.

i) True

ii) False

Answer:- True

Question#15 Consider an example where a range of users from 0 to 10000 goes to a Redis instance R0, and another range of users 10001 to 20000 goes to R1. This is _ partitioning.

i) Hash partitioning

ii) Range partitioning

iii) Client partitioning

Answer:- Range partitioning

Question#16 How many commands can be sent to a server in pipelining?

i) Multiple

ii) 2

iii) None

iv) Single

Answer:- Multiple

Question#17 Which is the mechanism to enforce limits on the access of a resource when multiple threads are executed?

i) EXPIRE

ii) Publish

iii) Locking

iv) PERSIST

Answer:- Locking

Question#18 _ is an implementation of partitioning where you can send your query to a random instance, and the instance will forward your query to the right node.

i) Query routing

ii) Proxy assisted partitioning

iii) Client side partitioning

Answer:- Query routing

Question#19 _ is the configuration setting that tells the maximum number of items allowed in a Hash table for ziplist encoding.

i) list-max-ziplist-entries

ii) hash-max-ziplist-entries

iii) list-max-ziplist-value

iv) hash-max-ziplist-value

Answer:- hash-max-ziplist-entries

Question#20 The __ command is used to set a lock in string dataset.

i) SETEX

ii) SETNX

iii) PSETEX

iv) SET

Answer:- SETNX

Question#21 The persistent server should be the _ once the whole environment is started.

i) Master Server

ii) Slave

iii) Primary memory

iv) Secondary storage

Answer:- Master Server

Question#22 In-Memory database stores data in the memory.

i) True

ii) False

Answer:- True

Question#23 _ is required in the distributed backend systems where cache state needs to be maintained uniformly across the systems.

i) Hashing

ii) Sharding

iii) Centralized cache

Answer:- Centralized cache

Question#24 __ is the memory eviction policy where keys are evicted by removing the less recently used keys first but only among keys that have an ‘expire’ field set, to make space for the newly added data.

i) allkeys-lru

ii) Volatile-random

iii) Volatile-ttl

iv) Volatile-lru

Answer:- Volatile-lru

Question#25 _ is the technique of breaking down data into multiple parts.

i) Optimizing

ii) Hashing

iii) Sharding

Answer:- Sharding

Question#26 List is a sequence of _.

i) Ordered element

ii) LRANGE

iii) Unordered element

iv) Linked List

Answer:- Ordered element

Question#27 In a key-value pair, _ is represented by a string.

i) Key

ii) Data

iii) Value

iv) Text

Answer:- Value

Question#28 Redis string cannot hold any value beyond a certain length. What is it?

i) 5 GB

ii) 512 MB

iii) 1 GB

iv) 256 MB

Answer:- 512 MB

Question#29 The environment continues to work even if a slave fails.

i) True

ii) False

Answer:- True

Question#30 __ 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.

i) Master

ii) Quorum

iii) Sentinel

iv) Total number of servers in the cluster

Answer:- Quorum

Question#31 Which is the best way to achieve persistence in Redis?

i) Value

ii) Fork ()

iii) SAVE command

iv) AOF

Answer:- AOF

Question#32 Which is a difference between Memcached and Redis?

i) Single threaded

ii) Key-value datastore

iii) Used for caching

iv) In-memory

Answer:- Single threaded

Question#33 Redis is widely used as a secondary database for _.

i) Storing

ii) Primary Memory

iii) Caching

iv) Secondary Memory

Answer:- Caching

Question#34 When using Pipelining, will the additional memory used be high?

i) Yes

ii) Very less

iii) No

iv) Partially high

Answer:- Yes

Question#35 Which configuration setting specifies the file to which the RDB snapshot dump is saved?

i) dbfilename

ii) pidfile

iii) dir

iv) logfile

Answer:- dbfilename

Question#36 Redis is single threaded.

i) True

ii) False

Answer:- True

Question#37 Which is the default persistence mode in Redis?

i) AOF

ii) RDB

Answer:- RDB

Question#38 Redis provides multi-state architecture during replication, where every instance can both read and write.

i) True

ii) False

Answer:- False

Question#39 redis.conf is configured for changing __ to connect to the Redis server.

i) Port

ii) Key

iii) Memory

iv) Value

Answer:- Port

Question#40 Redis can be configured to meet different requirements by editing the configuration settings in __.

i) redis.conf

ii) del.conf

iii) redis-cli

iv) redis.edit

Answer:- redis.conf

Question#41 The following are all Key Value databases, except __.

i) Riak

ii) Memcached

iii) MongoDB

iv) Redis

Answer:- Memcached

Question#42 Which of the following set commands removes and returns members of a set?

i) SMOVE

ii) SDEL

iii) SREM

iv) SPOP

Answer:- SPOP

Question#43 _ returns an array of values.

i) HMGET

ii) ZADD

iii) HGET

iv) HKEYS

Answer:- HGET

Question#44 _ returns the number of elements in a set.

i) SLEN

ii) SCARD

iii) SINDEX

iv) SMEMBERS

Answer:- SCARD

Question#45 _ sets the key to expire within the given number of seconds.

i) EXPIRE

ii) TTL

iii) ZRANGE

iv) PERSIST

Answer:- EXPIRE

Question#46 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?

i) 13

ii) 10

iii) 11

iv) 12

Answer:- 13

Question#47 Which of the following does the Redis Hashes store?

i) Length of the file

ii) Key

iii) Value

iv) Key value pairs

Answer:- Key value pairs

Question#48 Given is a code snippet.
127.0.0.1:6379> lpush numbers 4
127.0.0.1:6379> lpush numbers 3
127.0.0.1:6379> lpush numbers 7
127.0.0.1:6379> rpush numbers 10
127.0.0.1:6379> rpush numbers 15
127.0.0.1:6379> lpush numbers 12

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

i) 15, 10, 7, 3, 4, 12

ii) 3, 4, 7, 10, 12, 15

iii) 4, 3, 7, 12, 15, 10

iv) 12, 7, 3, 4, 10, 15

Answer:- 12, 7, 3, 4, 10, 15

Question#49 The _ command is used to remove the expiration from a key.

i) Rem

ii) Expire

iii) Persist

iv) Del

Answer:- Persist

Question#50 The data structure commonly used in Redis is __.

i) Sets

ii) Queue

iii) Batches

iv) Get

Answer:- Sets

Question#51 _ sets the key to expire within the given number of seconds.

i) PERSIST

ii) TTL

iii) EXPIRE

iv) ZRANGE

Answer:- EXPIRE

Question#52 Which of the following commands returns the remaining time for the key to expire?

i) PPL

ii) TTL

iii) EXISTS

Answer:- TTL

Question#53 The following are commands of sorted sets, except __.

i) ZREVRANGE

ii) ZADD

iii) ZREVRANK

iv) ZRANGEBYEX

Answer:- ZRANGEBYEX

Question#54 Sets are unordered collection of strings.

i) True

ii) False

Answer:- True

About Author


After years of Technical Work, I feel like an expert when it comes to Develop wordpress website. Check out How to Create a Wordpress Website in 5 Mins, and Earn Money Online Follow me on Facebook for all the latest updates.

Leave a Comment