Redis is an in-memory data structure store, used as a distributed, in-memory key–value database, cache and message broker, with optional durability.
Redis MCQs: This section contains multiple-choice questions and answers on the various topics of Redis. Practice these MCQs to test and enhance your skills on Redis.
List of Redis MCQs
1. Redis is a NoSQL database, which stores the value in ____ format.
- Document format
- Key-value store
- Column-oriented
- Graph format
Answer: B) Key-value store
Explanation:
Redis is a NoSQL database, which stores the value in key-pair format.
2. Who was the man behind the Redis database?
- Raymond Boyce
- Donald Chamberlin.
- Salvatore Sanfilippo
- Dwight Merriman
Answer: C) Salvatore Sanfilippo
Explanation:
Salvatore Sanfilippo, is the man behind the Redis database.
3. When was the Redis database invented?
- 2001
- 2011
- 2010
- 2009
Answer: B) 2011
Explanation:
In 2011, Redis was founded.
4. Redis architecture contains how many processes?
- 4
- 5
- 3
- 2
Answer: D) 2
Explanation:
Redis architecture mainly consists of two processes which are known as Redis client and Redis server.
5. Which process in the Redis architecture is responsible for storing the data in memory and is also responsible for controlling every type of management?
- Redis client
- Redis server.
Answer: B) Redis server.
Explanation:
The redis server is the main part of the architecture, it is used to store the data in memory and is also responsible for controlling every type of management.
6. Which of the following data structures are supported by Redis?
- Bitmaps
- Hyper log
- Geospatial indexes
- Sorted sets
- All of the above
Answer: E) All of the above
Explanation:
Redis supports a variety of data structures which includes: hashes, sets, lists, sorted sets with range queries, bitmaps, hyper log, and geospatial indexes.
7. In which language, Redis has written?
- ANSI C language
- Python
- Java
- PHP
Answer: A) ANSI C language
Explanation:
Redis is written in the ANSI C language.
8. Does the concept of Sharding is supported by Redis?
- Yes
- No
Answer: A) YES
Explanation:
Redis supports the concept of sharding.
9. Does Redis support languages like Scala and Smalltalk?
- Yes
- No
Answer: A) YES
Explanation:
Redis supports a variety of languages such as C, C++, C#, Clojure, Common Lisp, D, Dart, Erlang, Go, Haskell, Haxe, Io, Java, JavaScript (Node.js), Julia, Lua, Objective-C, Perl, PHP, Pure Data, Python, R, Racket, Ruby, Rust, Scala, Smalltalk, and Tcl.
10. Among Redis and RDBMS, which of them stores the data in primary memory?
- RDBMS
- Redis
Answer: B) Redis
Explanation:
Redis stores almost everything in primary memory whereas RDBMS stores everything in secondary memory.
11. Among Redis and RDBMS, which of them takes the longest time in reading and writing operations?
- RDBMS
- Redis
Answer: A) RDBMS
Explanation:
RDBMS takes more time in comparison to Redis in reading and writing operations, RDBMS stores the data in secondary memory.
12. How many data types are there in Redis?
- 4
- 5
- 3
- 2
Answer: B) 5
Explanation:
There are 5 types of data types that Redis support:
- Strings
- Hashes
- Lists
- Sets
- Sorted Sets
13. Which of the following commands is used in Redis to store a key name in the string format?
- Get
- Put
- Set
- Post
Answer: C) Set
Explanation:
Set command is used in Redis to store a key name in the string format.
14. Which data type in Redis are maps between string fields and string values?
- Strings
- Hashes
- Lists
- Sets
- Sorted Sets
Answer: B) Hashes
Explanation:
Hashes data types in Redis are maps between string fields and string values.
15. Which of the following commands is used to set the specified fields to their particular values in the hash stored at the key?
- Set
- Get
- HMSET
- HMGET
Answer: C) HMSET
Explanation:
HMSET command is used to set the specified fields to their particular values in the hash stored at the key.
16. Which of the following data types are usually known as the unordered collection of strings?
- Strings
- Hashes
- Lists
- Sets
- Sorted Sets
Answer: D) Sets
Explanation:
Sets are usually known as the unordered collection of strings in the Redis Database.
17. Which of the following commands is used to delete a key?
- Del
- Dump
- Expire
- Delete
Answer: A) Del
Explanation:
To delete a key in Redis DEL command is used.
18. Which of the following commands will you use if you are asked to find all keys matching the specified pattern?
- Like pattern
- Keys pattern
- Like keys Pattern
Answer: B) Keys pattern
Explanation:
If you are asked to find all keys matching with the specified pattern, then the keys pattern is the command you will use.
19. Which of the following commands is used to check whether the key exists or not?
- Is_there
- Is_key
- Exist key
- Key_exist
Answer: C) Exist key
Explanation:
Exist key command is used to check whether the key exists or not.
20. Does the DUMP key command and DEL key command both work the same?
- Yes
- No
Answer: B) NO
Explanation:
DEL key command is used to delete the key, whereas the DUMP key command is used to return a serialized version of the value stored at the specified key.
21. Which of the following commands is used when you want to retrieve the value of a key?
- SET
- GET
- GETSET
- GETRANGE
Answer: B) GET
Explanation:
GET command is used when you want to retrieve the value of a key.
22. Which of the following data types is known to be the perfect data type to represent objects in Redis?
- Strings
- Hashes
- Lists
- Sets
- Sorted Sets
Answer: B) Hashes
Explanation:
Hashes in Redis are known to be the perfect data type to represent objects.
23. Which of the following commands is used when you want to retrieve the value of a key?
- SET
- GET
- GETSET
- GETRANGE
Answer: B) GET
Explanation:
GET command is used when you want to retrieve the value of a key.
24. Which of the following commands is used to get the number of fields in a hash?
- HDEL key field2 [field2]
- HKEYS key
- HVALS key
- HLENS key
Answer: D) HLENS key
Explanation:
HLENS key command is used to get the number of fields in a hash.
25. Suppose you want to get the value of a hash field stored at the specified key, which of the following commands will you use?
- HGET key field
- HKEYS key
- HVALS key
- GET key
Answer: A) HGET key field
Explanation:
HGET Key field command is used if you want to get the value of a hash field stored at the specified key.
26. Which of the following commands is used to add the element to a set?
- ADD
- SADD key member1 [member2]
- SADD KEY
- ADDSET KEY
Answer: B) SADD key member1 [member2]
Explanation:
SADD key member1 [member2] command is used when you want to add an element to a set.
27. Suppose you are asked to intersect multiple sets and store the resulting set in a key, in this situation which of the following commands will you use?
- INTERSECTSTORE destination key1 [key2]
- SINTERSECT destination key1 [key2]
- SINTERSTORE destination key1 [key2]
- SSTOREINTER destination key1 [key2]
Answer: C) SINTERSTORE destination key1 [key2]
Explanation:
SINTERSTORE destination key1 [key2] is the command you will use in a situation where you are asked to intersect multiple sets and store the resulting set in a key.
28. Which of the following commands will give you the index of a member in a sorted set?
- INDEXSORTED KEY MEMBER
- SINDEX KEY
- ZINDEX KEY
- ZRANK KEY MEMBER
Answer: D) ZRANK KEY MEMBER
Explanation:
ZRANK Key member command will give you the index of a member in a sorted set.
29. What are transactions in Redis?
- A transaction in Redis allows a group of commands to be executed at once.
- A transaction in Redis is a group of properties that are commonly known as ACID properties.
- A transaction in Redis allows a group of commands to be executed at multiple steps.
Answer: A) A transaction in Redis allows a group of commands to be executed at once.
Explanation:
A transaction in Redis allows a group of commands to be executed at once.
30. Does Redis support all the ACID properties?
- Yes
- No
Answer: B) NO
Explanation:
No, Redis does not support all the ACID properties as it is not able to accomplish consistency and durability.
31. Do Redis transactions are atomic in nature?
- Yes
- No
Answer: A) YES
Explanation:
Yes, Redis transactions are atomic in nature which means all the commands will be processed or none will be processed.
32. In Redis, which of the following commands is used to initiate the transaction?
- START
- MULTI
- SET
- GO
Answer: B) MULTI
Explanation:
MULTI command is used to initiate the transaction in Redis.
33. In Redis, which of the following commands is used to execute the particular command?
- EXECUTE
- EXE
- EXEC
- START
Answer: C) EXEC
Explanation:
EXEC command in Redis is used to execute a particular command.
34. Scripts in Redis are written in which language?
- ANSI C
- LUA
- DART
- JAVA
Answer: B) LUA
Explanation:
Scripts in Redis are actually written in LUA language.
35. Which of the following commands is used for scripting in Redis?
- SCRIPT
- SCI
- EVAL
Answer: C) EVAL
Explanation:
EVAL is the command which is used for scripting in Redis.
36. Which of the following commands is used to validate the server whether it is running or not?
- VALIDATE
- PONG
- PING
- ECHO
Answer: C) PING
Explanation:
PING command is used to validate the server whether it is running or not.
37. Which of the following commands is used to close the connection?
- CLOSE
- QUIT
- DISCLOSE
- VACATE
Answer: B) QUIT
Explanation:
QUIT command is used to close the connection.
38. Suppose you are asked to remove all the keys from all databases, which of the following commands will you use?
- FLUSHKEY
- FLUSHALLKEY
- FLUSHALL
- FLUSHDB
Answer: C) FLUSHALL
Explanation:
FLUSHALL will remove all the keys from all databases.
39. Suppose you are asked to remove all the keys from the current database, which of the following commands will you use?
- FLUSHKEY
- FLUSHALLKEY
- FLUSHALL
- FLUSHDB
Answer: D) FLUSHDB
Explanation:
FLUSHALL will remove all the keys from the current databases.
40. Which of the following commands create a backup of a current Redis database?
- BACKUP
- BG
- SAVE
Answer: C) SAVE
Explanation:
SAVE command is used to create a backup of a current Redis database.
41. Which of the following files is created by executing the SAVE command?
- Backup.rdb
- Backup.redis
- Save.rdb
- Dump.rdb
Answer: D) Dump.rdb
Explanation:
Dump.rdb file is created when we execute the SAVE command for the backup.
42. Dump.rdb file will be created in ____?
- Redis directory
- Redis client side
- Redis backup folder
Answer: A) Redis directory
Explanation:
In the Redis directory, Dump.rdb file will be created.
43. Which of the following commands is the alternative command to create a backup?
- BACKUP
- BG
- BACKUPSAVE
- BGSAVE
Answer: D) BGSAVE
Explanation:
BGSAVE command is the other alternative command which will help us to create a backup in Redis.
44. A ____ test is a method of assessing Redis performance by running multiple (n) commands simultaneously.
- Redis security
- Redis performance
- Redis benchmark
- Redis Latency
Answer: C) Redis benchmark
Explanation:
A Redis benchmark test is a method of assessing Redis performance by running multiple (n) commands simultaneously.
45. Which of the following commands closes a given client connection?
- CLIENT CLOSE
- CLOSE
- CLIENT QUIT
- CLIENT KILL
Answer: D) CLIENT KILL
Explanation:
With the help of CLIENT KILL command the client connection is closed.
46. On which of the following protocols does the Redis server run?
- RESP (Redis Serialization Protocol)
- User Datagram Protocol (UDP)
- Post office Protocol (POP)
Answer: A) RESP (Redis Serialization Protocol)
Explanation:
Clients in Redis basically use RESP (Redis Serialization Protocol) to communicate with servers.
47. Does Redis follow UDP for connection?
- Yes
- No
Answer: B) NO
Explanation:
Redis follows TCP for connection.
48. With____, multiple commands can be executed simultaneously without waiting on the results of each one.
- Redis Benchmark
- Redis Pipelining
- Redis Security
- Redis Latency
Answer: B) Redis Pipelining
Explanation:
With Redis pipelining, multiple commands can be executed simultaneously without waiting on the results of each one.
49. With ____, your Redis data is split between multiple Redis instances so that each one only contains a subset of your keys.?
- Redis Benchmark
- Redis Pipelining
- Redis Security
- Redis Latency
- Redis Partitioning
Answer: E) Redis Partitioning
Explanation:
With partitioning, your Redis data is split between multiple Redis instances so that each one only contains a subset of your keys.
50. How many types of partitioning are provided by Redis?
- 2
- 3
- 4
- 5
Answer: A) 2
Explanation:
Two types of partitioning are provided by Redis:
- Range Partitioning
- Hash Partitioning
51. In which type of partitioning, specific Redis instances are mapped to ranges of objects?
- Range Partitioning
- Hash Partitioning
Answer: A) Range Partitioning
Explanation:
In Range Partitioning, specific Redis instances are mapped to ranges of objects.
52. In which type of partitioning, data is stored in different Redis instances using hashed keys to convert them into numbers?
- Range Partitioning
- Hash Partitioning
Answer: B) Hash Partitioning
Explanation:
In hash partitioning, data is stored in different Redis instances using hashed keys to convert them into numbers.
53. What is Memcached?
- Memcached is an in-memory key-value store.
- Memcached is an in-memory document store.
- Memcached is an in-memory column-oriented store.
- Memcached is an in-memory graph store.
Answer: A) Memcached is an in-memory key-value store.
Explanation:
Memcached is an in-memory key-value store.
54. Does Memcached support replication?
- Yes
- No
Answer: B) NO
Explanation:
Memcached does not support replication.
55. Among Memcached and Redis, which is more efficient in handling the traffic?
- Memcached
- Redis
Answer: A) Memcached
Explanation:
Memcached is good at handling traffic whereas Redis cannot handle heavy traffic.
56. Is Redis a NoSQL DB or a Relational management database?
- NoSQL
- Relational management database
Answer: A) NoSQL
Explanation:
Redis is a NoSQL DB.
57. Which type of value-storing model does MongoDB support?
- Key-value store model
- Document store model
- Column-oriented store model
- Graph store model
Answer: B) Document store model
Explanation:
MongoDB supports a document store model.
58. In which language, MongoDB has been written?
- ANSI C language
- Python
- Java
- C++
Answer: D) C++
Explanation:
MongoDB is written in the C++ language.
59. Which server-side scripting language does MongoDB use?
- ANSI C
- LUA
- JAVASCRIPT
- JAVA
Answer: C) JAVASCRIPT
Explanation:
MongoDB uses JAVASCRIPT as its scripting language.
60. Which of the following DB purposes is to store and analyze data?
- Redis
- MongoDB
- Memcached
- ElasticSearch
- Aerospike
Answer: D) ElasticSearch
Explanation:
Elasticsearch is a tool whose purpose is to store and analyze data.
61. Which of the following DB is known to be a flash-optimized in-memory NoSQL Database?
- Redis
- MongoDB
- Memcached
- ElasticSearch
- Aerospike
Answer: E) Aerospike
Explanation:
Aerospike is known to be a flash-optimized in-memory NoSQL Database.
62. Which type of value-storing model does Aerospike support?
- Key-value store model
- Document store model
- Column-oriented store model
- Graph store model
Answer: A) Key-value store model
Explanation:
Aerospike supports the Key-value store model.