Redis Certified Developer: Exam Practice Tests by Scutaru Cristian
Author:Scutaru, Cristian [Scutaru, Cristian]
Language: eng
Format: epub
Published: 2020-08-20T16:00:00+00:00
Practice Test 2 - Answers and Explanations
Question 1:
What is the most effective way to get the number of keys in a database? (select one)
A) INFO KEYSPACE
B) KEYS
C) DBSIZE
D) KEYCOUNT
Answer: C
Domain: Performance
Explanation:
DBSIZE is specifically designed to return the number of keys in the currently-selected database, in O(1) time. INFO KEYSPACE is also fast and returns this information, but is not the most efficient way here, as it displays other data as well.
KEYS is an overkill way to return all keys from a database, a command to be generally avoided. And there is no KEYCOUNT command in Redis.
You'll be frequently asked about performance issues on the total number of keys, or set members.
References:
https://redis.io/commands/dbsize
https://redis.io/commands/info
Question 2:
What Redis command can remove a field-value pair from a stream entry? (select one)
A) XDEL
B) XREM
C) XTRIM
D) There is no such command.
Answer: D
Domain: Data Structures
Explanation:
Streams are read-only and append-only collections of map-like entries. So you cannot modify or remove anything from the field-value pairs of an entry.
XDEL removes entries from the stream, while XTRIM can reduce the stream to a certain size. HDEL can remove field-value pairs, but from hashes.
There is no XREM command. There are SREM and ZREM to remove members from sets and sorted sets.
Important to remember stream entries are read-only, cannot be modified.
References:
https://redis.io/topics/streams-intro
Question 3:
Which is NOT a value that can be returned by TYPE? (select one)
A) nil
B) hash
C) none
D) string
Answer: A
Domain: Data Structures
Explanation:
TYPE can return one of the following values: string, list, set, zset, hash or stream. Also, it returns none (not nil) for the key not found.
References:
https://redis.io/commands/type
Question 4:
You have a myzset sorted set with { a, b, c, d, e, f, g } members, all with the same score.
What command can return the { f, e, d, c, b } members, in this exact order? (select one)
A)
ZREVRANGE myzset (g [aaa
B)
ZREVRANGEBYLEX myzset [g [a
C)
ZRANGEBYLEX myzset (g [aaa
D)
ZREVRANGEBYLEX myzset (g [aaa
Answer: D
Domain: Data Structures
Explanation:
The lexicographic range here could be from (a to (g, or even [aaa to (g (because aaa comes after a). A reverse order would rather specify from (g to [aaa.
First call will fail, because ZREVRANGE (like ZRANGE) must take index positions as integer arguments, not regex patter expressions.
Second call looks good, except a is also included in the result. Corrected similar version is the last call.
Third call is similar to the correct answer, but it returns { b, c, d, e, f } without reversing the order.
Get familiar with the ZRANGE, ZRANGEBYLEX and ZRANGEBYSCORE commands. Also with their reverse forms ZREVRANGE, ZREVRANGEBYLEX and ZREVRANGEBYSCORE.
References:
https://redis.io/commands/zrevrangebylex
Question 5:
What patterns can you implement with RPOPLPUSH? (check all that apply)
A) circular list
B) blocking stack
C) blocking queue
D) reliable queue
Answer: A, D
Domain: Data Modeling
Explanation:
Reliable queue and circular list patterns are described in the referenced article.
References:
https://redis.io/commands/rpoplpush
Question 6:
What is the meaning of this text sent to the server through the RESP protocol? (select one)
"*3\r\n$3\r\nfoo\r\n+OK\r\n:1\r\n"
A) A command with code 3 and "foo", "OK", 1 arguments.
B) A ["foo", "OK", 1] array.
C) A ["foo", "OK", "1"] array.
D) This is an invalid string for the RESP protocol.
Answer: B
Domain: Debugging
Explanation:
RESP (REdis Serialization Protocol) is a text-based simple protocol Redis sends back and forth commands.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
CISA - Certified Information Systems Auditor Study Guide by Hemang Doshi(1365)
Implementing Microsoft Azure Architect Technologies: AZ-303 Exam Prep and Beyond by Brett Hargreaves and Sjoukje Zaal(1245)
Microsoft Python Certification Exam 98-281 & PCEP âPreparation Guide: Introduction To Programming Using Python, PCEP â Certified Entry Level Python Programmer by Raman Archith & Raman Dhyanashri & Raman R & Publications Raman(817)
CompTIA Security+: SY0-601 Certification Guide Second Edition by Ian Neil(645)
CompTIA CySA+ Cybersecurity Analyst Certification All-in-One Exam Guide (Exam CS0-002) by Brent Chapman(625)
CompTIA PenTest+ Certification For Dummies by Glen E. Clarke(567)
CCNP Data Center Application Centric Infrastructure 300-620 DCACI Official Cert Guide by Ammar Ahmadi(518)
Exam Ref AZ-500 Microsoft Azure Security Technologies by Yuri Diogenes & Orin Thomas(509)
AZ-303 : Microsoft Azure Architect Technologies : Volume : 01 by Specialist IP(491)
CompTIA Security+ Practice Tests by David Seidl(484)
Casp+ Comptia Advanced Security Practitioner Certification All-in-one Exam Guide, Exam Cas-003 (9781260441345) by Lane Nicholas; Conklin Arthur; White Gregory B.; Williams Dwayne(451)
CompTIA PenTest+ Certification All-in-One Exam Guide (Exam PT0-001) by Raymond Nutting(443)
Official Google Cloud Certified Associate Cloud Engineer Study Guide by Dan Sullivan(432)
AWS Certified Solutions Architect Study Guide Associate (SAA-C01) Exam Second Edition by Ben Piper & David Clinton(390)
AWS Certified SysOps Administrator Practice Tests 2021: AWS Exam-Difficulty Practice Questions with Answers & detailed Explanations by Davis Neal(373)
Cisco Certified DevNet Associate DEVASC 200-901 Official Cert Guide by Chris Jackson & Adrian Iliesiu & Ashutosh Malegaonkar & Jason Gooley(364)
Exam Ref MS-500 Microsoft 365 Security Administration by Ed Fisher & Nate Chamberlain(354)
AWS Certified SysOps Administrator Study Guide by Sara Perrott & Brett McLaughlin(354)
Redis Certified Developer: Exam Practice Tests by Scutaru Cristian(349)