Memcached is a general-purpose, free, open-source software, and distributed memory-caching system. Memcached is used for speeding up dynamic database-driven websites. It caches data and objects in RAM to reduce the number of times an external data source must be read.
Memcached MCQs: This section contains multiple-choice questions and answers on the various topics of Memcached. Practice these MCQs to test and enhance your skills on Memcached.
List of Memcached MCQs
1. Memcached is a ____.
- Centralized memory object caching system
- Distributed memory object caching system
Answer: B) Distributed memory object caching system
Explanation:
Memcached is a Distributed memory object caching system.
2. Memcached is written in which of the following language?
- Python
- Ruby
- Java
- C
Answer: D) C
Explanation:
Memcached is written in C language.
3. Is Memcached Open-source?
- Yes
- No
Answer: A) Yes
Explanation:
Memcached is open-source.
4. What is the Memcached default port?
- 11220
- 11451
- 11211
- 11311
Answer: C) 11211
Explanation:
Memcached default port is 11211.
5. What is the Memcached telnet command’s basic syntax?
- $telnet HOST PORT
- $ HOST PORT
- $telnet HOST
- $telnet PORT_NAME
Answer: A) $telnet HOST PORT
Explanation:
The Memcached telnet command’s basic syntax is: $telnet HOST PORT.
6. The ____ command in Memcached is used to assign a new value to a new or existing key.
- Set
- Fix
- Change
- Setup
Answer: A) Set
Explanation:
The set command in Memcached is used to assign a new value to a new or existing key.
7. The ____ command in Memcached is used to assign a value to a new key.
- Create
- Add
- Set
- Assign
Answer: B) Add
Explanation:
The add command in Memcached is used to assign a value to a new key.
8. What will happen if you use add command to assign a value to a new key, and the key already exists?
- the output is NOT STORED.
- the output is STORED.
- the output is DUPLICATED
Answer: A) the output is NOT STORED.
Explanation:
The add command in Memcached is used to assign a value to a new key. If the key already exists, the output is NOT STORED.
9. In the below syntax of add command, which of the following keyword in a syntax represent the data that needs to be stored?
add key flags exptime bytes [noreply]
- Key
- Flags
- Value
- Exptime
- Bytes
Answer: C) Value
Explanation:
Value represents the data that needs to be stored.
10. The ____ command in Memcached is used to replace the value of an existing key.
- Swap
- Change
- Replace
- Substitute
Answer: C) Replace
Explanation:
The replace command in Memcached is used to replace the value of an existing key.
11. If you are using replace command in Memcached and the key does not exist, what will happen?
- the output is NOT STORED.
- the output is STORED.
- the output is DUPLICATED
Answer: A) the output is NOT STORED.
Explanation:
The replace command in Memcached is used to replace the value of an existing key. If the key does not exist, the output is NOT STORED.
12. The ____ command in Memcached is used to add data to an existing key.
- Extend
- Append
- Prepend
- Add
Answer: B) Append
Explanation:
The append command in Memcached is used to add data to an existing key.
13. When using the append command the data is stored ____ the existing data.
- Before
- After
- Middle
Answer: B) After
Explanation:
The append command in Memcached is used to add data to an existing key. The data is stored after the key’s existing data.
14. The ____ command is used to append data to the beginning of an existing Memcached value for a specific key.
- Extend
- Append
- Prepend
- Add
Answer: C) Prepend
Explanation:
The prepend command is used to append data to the beginning of an existing Memcached value for a specific key.
15. If the key does not exist while appending the data using prepend command then what will be the result?
- The prepend command will append at the end of the key if the key does not exist.
- The prepend command will fail if the key does not exist.
- The prepend command will append in the middle of any key if the key does not exist.
Answer: B) The prepend command will fail if the key does not exist.
Explanation:
The prepend command will fail if the key does not exist.
16. What is CAS in Memcached?
- Check-And-Set
- Compare-And-Swap
- Both
Answer: C) Both
Explanation:
CAS stands for Check-And-Set or Compare-And-Swap.
17. Which of the following command is used to set the data, if the data hasn’t been updated since the last retrieve?
- Retrieve
- Set
- Recover
- CAS
Answer: D) CAS
Explanation:
If the data hasn’t been updated since the last retrieve, the Memcached CAS command is used to set it.
18. Which command is used to retrieve the value stored at the key?
- Retrieve
- Get
- Obtain
Answer: B) Get
Explanation:
The Memcached get command is used to retrieve the value stored at the key.
19. Which command is used to remove an existing key from the Memcached server?
- Delete
- Drop
- Remove
- Erase
Answer: A) Delete
Explanation:
The Memcached delete command is used to remove an existing key from the Memcached server.
20. Which of the following command in Memcached is used to increase the numeric value of an existing key?
- Increase
- Raise
- Increment
- Incr
Answer: D) Incr
Explanation:
Incr command in Memcached is used to increase the numeric value of an existing key.
21. Which of the following command in Memcached is used to decrease the numeric value of an existing key?
- decrease
- lower
- Decrement
- Decr
Answer: D) Decr
Explanation:
Decr command in Memcached is used to decrease the numeric value of an existing key.
22. As we know that the Decr command in Memcached is used to decrease the numeric value of an existing key, what will happen if the key is not numeric?
- NOT FOUND
- Returns Nothing
- CLIENT_ERROR cannot increment or decrement non-numeric value
Answer: C) CLIENT_ERROR cannot increment or decrement non-numeric value
Explanation:
CLIENT_ERROR cannot increment or decrement non-numeric value.
23. In which year Memcached was launched?
- 2002
- 2004
- 2003
- 2007
Answer: C) 2003
Explanation:
Memcached’s first version was released on May 22, 2003.
24. Is Memcached a database?
- Yes
- No
Answer: B) No
Explanation:
Memcached is a memory cache, not a database. It just saves transient data.
25. Which of the following command is used to close the connection?
- Close
- End
- Quit
- Delete
Answer: C) Quit
Explanation:
The quit command is used to close the connection.
26. Which of the following command returns server statistics such as version, and connections?
- Statistics
- Stats
- Info
- Facts
Answer: B) Stats
Explanation:
The Memcached stats command returns server statistics such as PID, version, connections, and so on.
27. Which of the following command returns item statistics such as count, age, and eviction?
- Statistics item
- Item
- Stats item
Answer: C) Stats item
Explanation:
The Memcached stats items command returns item statistics such as count, age, eviction, and so on, sorted by slab ID.
28. Each Memcached have ____ unique key.
- One
- More than one
- Many
Answer: A) One
Explanation:
Each Memcached has one unique key.
29. The ____ occurs when the cache expires and websites are attacked by many requests from the client at the same time.
- Dogpile effect
- Slab allocator
- LRU
- CAS
Answer: A) Dogpile effect
Explanation:
The Dogpile effect occurs when the cache expires and websites are attacked by many requests from the client at the same time.
30. Dogpile effect can be prevented using which of the following?
- Scheduler Locker
- Semaphore Lock
- Deadlock
- Bootloader
Answer: B) Semaphore Lock
Explanation:
The dogpile effect can be prevented using a semaphore lock.
31. Is Data stored in Memcached permanently stored?
- Yes
- No
Answer: B) No
Explanation:
No, data stored in Memcached is not permanently stored. It is temporally stored data.
32. When the server is shut down or restarted, all Memcached data is ____?
- Restored
- Rolled Back
- Destroyed
Answer: C) Destroyed
Explanation:
When the server is shut down or restarted, all Memcached data is destroyed.
33. What is LRU?
- Last recently used
- Late reset utilized
- Least recently utilized
- Least recently used
Answer: D) Least recently used
Explanation:
LRU stands for least recently used.
34. Memcached use ____ to free up memory when it becomes full?
- TTL
- Slab allocator
- LRU
Answer: C) LRU
Explanation:
Memcached use LRU to free up memory when it becomes full.
35. What is TTL?
- Total time left
- Time to live
- Total time live
- Time to load
Answer: B) Time to live
Explanation:
TTL stands for time to live.
36. ____ refers to the length of time a value is held in Memcached before being evicted.
- TTL
- Slab allocator
- LRU
Answer: A) TTL
Explanation:
TTL refers to the length of time a value is held in Memcached before being evicted.
37. The ____ command deletes all data (key-value pairs) from the Memcached server.
- Delete_all
- Drop_all
- Flush_all
- Remove_all
Answer: C) Flush_all
Explanation:
The flush_all Memcached command deletes all data (key-value pairs) from the Memcached server.
38. The maximum number of concurrent connections is set to ____ by default.
- 8000
- 2000
- 1050
- 1024
Answer: D) 1024
Explanation:
The maximum number of concurrent connections is set to 1024 by default.
39. Which of the following correctly states the meaning of eviction in Memcached?
- you’ve run out of Memory
- you’re writing too quickly
- extstore can’t keep up
- All of the above
Answer: D) All of the above
Explanation:
Evictions can indicate that you’ve run out of Memory or that you’re writing too quickly and extstore can’t keep up.
40. In Memcached UDP server is ____ by default.
- Disabled
- Enabled
Answer: A) Disabled
Explanation:
In Memcached, the UDP server is Disabled by default.
41. Is Memcached fault-tolerant?
- Yes
- No
Answer: B) No
Explanation:
Memcached is not a fault-tolerant tool.
42. Does Memcached support the replication of data?
- Yes
- No
Answer: A) Yes
Explanation:
Yes, Memcached allows replication, which means that data may be replicated across numerous servers in a cluster.
43. The maximum length of a key in Memcached is ____.
- 200 characters
- 250 characters
- 500 characters
- No limit
Answer: B) 250 characters
Explanation:
The maximum length of a key in Memcached is 250 characters.
44. What is the maximum size of a value that can be stored in Memcached?
- 10 MB
- 2MB
- 1MB
- No limit
Answer: C) 1MB
Explanation:
The maximum size of a value that can be stored in Memcached is 1 megabyte (MB).
45. What is the maximum TTL?
- 60 days
- 24 hours
- 90 days
- 30 days
Answer: D) 30 days
Explanation:
The maximum TTL is 30 days.
46. ____ is the method of distributing a big data set over numerous Memcached servers in a cluster.
- Sharding
- Fragmentation
- Segmentation
- Dogpile effect
Answer: A) Sharding
Explanation:
Sharding is the method of distributing a big data set over numerous Memcached servers in a cluster.
47. How many methods are there to update the Memcached when data changes?
- 5
- 4
- 3
- 2
Answer: D) 2
Explanation:
There are two methods to update Memcached when data changes:
- By clearing the cache proactively:
- By resetting the cache
48. Which of the following command provides you with the version of Memcached?
- Ver
- Version—
- –version
- version
Answer: D) version
Explanation:
The version command provides you with the version of Memcached.
49. Which of the following companies are using Memcached?
- WordPress
- Airbnb
- All of the above
Answer: E) All of the above
Explanation:
Following companies are using Memcached:
- WordPress
- Airbnb
50. What are the alternatives to Memcached?
- Redis
- Couchbase
- Apache Ignite
- All of the above
Answer: D) All of the above
Explanation:
Following are the alternatives of Memcached:
- Redis
- Couchbase
- Apache Ignite
- Varnish