0
0
Redisquery~20 mins

HEXISTS for field check in Redis - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
HEXISTS Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
1:30remaining
Check if a field exists in a Redis hash
Given a Redis hash named user:1000 with fields name and email, what is the output of the command HEXISTS user:1000 email?
Redis
HSET user:1000 name "Alice" email "alice@example.com"
Aerror
B0
Cnil
D1
Attempts:
2 left
💡 Hint
HEXISTS returns 1 if the field exists, otherwise 0.
query_result
intermediate
1:30remaining
Check non-existing field in Redis hash
What is the output of HEXISTS user:1000 age if the hash user:1000 only contains fields name and email?
Redis
HSET user:1000 name "Alice" email "alice@example.com"
A1
B0
Cnil
Derror
Attempts:
2 left
💡 Hint
Check if the field is present or not.
📝 Syntax
advanced
1:30remaining
Identify the correct HEXISTS command syntax
Which of the following commands correctly checks if the field status exists in the hash order:123?
AHEXISTS order:123 status
BHEXISTS status order:123
CHEXISTS order:123:status
DHEXISTS order:123 status extra
Attempts:
2 left
💡 Hint
The syntax is HEXISTS key field
query_result
advanced
1:30remaining
HEXISTS behavior with non-hash key
What happens when you run HEXISTS mykey field1 if mykey is a string key with value hello?
Redis
SET mykey "hello"
A1
B0
Cerror
Dnil
Attempts:
2 left
💡 Hint
HEXISTS only works on hashes.
🧠 Conceptual
expert
2:00remaining
Using HEXISTS in conditional logic
You want to increment a numeric field visits in a Redis hash page:home only if the field exists. Which Redis command sequence correctly achieves this?
AUse a Lua script to check HEXISTS and then HINCRBY
BHINCRBY page:home visits 1
CHEXISTS page:home visits && HINCRBY page:home visits 1
DIF HEXISTS page:home visits THEN HINCRBY page:home visits 1
Attempts:
2 left
💡 Hint
Redis commands are atomic but do not support IF statements directly.